charmbracelet / soft-serve

The mighty, self-hostable Git server for the command line🍦
MIT License
5.16k stars 127 forks source link

Allowing accessing server via an ssh proxy user #538

Open nea89o opened 1 month ago

nea89o commented 1 month ago

Is your feature request related to a problem? Please describe. Currently hosting soft serve requires to host it in another port, different from your regular ssh traffic. I want users to be able to just use git@my.server/my-repo.git like most git servers allow.

Describe the solution you'd like By using a custom shell or by specifying a command via .ssh/authorized_keys or AuthorizedKeysCommand one can execute a command when a certain user is trying to log in with a specific key (or even without a specific key when using the shell as a fallback). This can be used to launch any TTY program when logged in. The code required to do this is fairly easy to write and so far i have managed to write a script for this which works just invoking the command ssh localhost -p 23231 ${SSH_ORIGINAL_COMMAND[@]}. This is a bit annoying however, since i need to add an extra ssh key to the user i want to authenticate as. Adding a command like soft browse --as-user nea ${SSH_ORIGINAL_COMMAND[@]} would make this a lot easier and less intrusive.

Current workflow:

This workflow could be massively improved with changes in soft serve. While implementing all of this to the proper satisfaction of whatever standards this project might have might be a bit much, implementing just the last step of impersonating a user on the current tty using a soft browse --as-user <user> (or soft impersonate <user>) command would be pretty big step in making this easier to implement on my side, while also being a step that soft serve would eventually need to do itself anyway, if it wants to support a workflow like this.

Describe alternatives you've considered I can also host soft serve on port 22 and my other stuff on a non standard port. I would consider that a downgrade since git isnt the only public facing ssh feature i might have and most other git servers dont need me to do this.

I can also specify a Host in my client sided ssh config. I would consider this a downgrade since no other git server requires editing the ssh config in every client.

Additional context