coder / sshcode

Run VS Code on any server over SSH.
MIT License
5.74k stars 216 forks source link

Private editing without relying on password auth (+ socket behaviour) #174

Open TheTyrius opened 4 years ago

TheTyrius commented 4 years ago

I am interested in using sshcode+code-server to edit files remotely in a multi-user environment. By default anyone on localhost (both on the client and remote) can access the webserver (and edit my files). I want to avoid using a password and would prefer a solution that only makes available the webserver to the user that executes the sshcode command.

Here is what I tried so far: On the remote this can be achieved by binding to a socket-file in the user directory. Interestingly code-server doesn't seem to clean up the specified "--socket" file when exiting, and refuses to start if the file already exists (I do not know enough about the matter to assess whether this is expected/desired behavior or not, hence I mention it here instead of a separate issue). (already reported https://github.com/cdr/code-server/issues/1538)

On the clientside it is not quite so easy: While ssh supports forwarding both TCP->socket and socket->socket, there seems to be no way to access a ".sock" via a graphical browser (see this year old request for chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=451721).

Since this seems to be rather complex, I would like to ask you about your expertise/ideas. Can this be done, or is the use-case for code-server different from my goal (user-private editing).

Currently I use sshfs with local vscode, and was hoping that code-server could improve this workflow.

Best regards, Tyrius

Merith-TK commented 4 years ago

currently i dont think there is a way, maybe setup a specific hostname for that address in your hosts file, modify sshcode to use that hostname instead of 127.0.0.1, and use that?

TheTyrius commented 4 years ago

Thank you for the input :) If I understand correctly that would require to bind a port of the remote, which I am trying to avoid. Sadly it seems impossible to get a browser to connect to a socket file (I seems for example curl supports this for a while).