Skip to content

bind to unix domain socket #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leifwalsh opened this issue Oct 8, 2021 · 6 comments · Fixed by #145
Closed

bind to unix domain socket #144

leifwalsh opened this issue Oct 8, 2021 · 6 comments · Fixed by #145
Labels
help wanted Extra attention is needed

Comments

@leifwalsh
Copy link

Some people in other issues and discussions have asked for better security and it's been suggested to run openvscode-server behind a reverse proxy like NGINX. That works well if you can bind only to localhost or use firewall rules to prevent outsiders from bypassing the proxy, but doesn't help if you're on a shared machine that many people can SSH to.

For this case, it would help if there were an option (e.g. ./server.sh --socket /tmp/leif-openvscode-server.sock) to listen on a UNIX domain socket instead of a TCP port. This way, we could use file permissions to make sure no other users on the machine can connect to that socket, and I could run openvscode-server and my proxy as the same user, ensuring that the only way in is through the proxy.

I believe this change is simple: just add an option to the server and call this variant of http.Server.listen() that accepts a path: https://nodejs.org/api/net.html#net_server_listen_path_backlog_callback

@akosyakov
Copy link
Member

@jeanp413 It should be also alright we remote CLI? And the browser will connect to it via special proxy configured on the same machine correct? It would be good if someone could write a guideline for such approach.

@elgalu
Copy link

elgalu commented Oct 8, 2021

Can this also be solved via K8s network policies? (TCP firewall)

@leifwalsh
Copy link
Author

@akosyakov I'm not sure I understand your question. The reverse proxy architecture is where you run the server you want to protect in a mode where it's listening for connections from a limited set of sources, and then one of those sources is the reverse proxy, which it trusts to do authentication and authorization. The browser can then be anywhere that can reach the reverse proxy.

The only change I'm proposing here is to further restrict the sources the server is listening on, shrinking it from "anyone with access to localhost" to "only the current user on localhost".

@leifwalsh
Copy link
Author

@elgalu if you're in kubernetes, that's a completely reasonable way to establish a similar level of security. Only people who can exec into your pod would be able to bypass the proxy and connect without auth.

@akosyakov
Copy link
Member

@leifwalsh I think you can do ahead and suggest the PR.

@akosyakov akosyakov added the help wanted Extra attention is needed label Oct 8, 2021
leifwalsh added a commit to leifwalsh/openvscode-server that referenced this issue Oct 8, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes gitpod-io#144
leifwalsh added a commit to leifwalsh/openvscode-server that referenced this issue Oct 8, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes gitpod-io#144
leifwalsh added a commit to leifwalsh/openvscode-server that referenced this issue Oct 8, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes gitpod-io#144
@leifwalsh
Copy link
Author

There you go!

leifwalsh added a commit to leifwalsh/openvscode-server that referenced this issue Oct 8, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes gitpod-io#144
akosyakov pushed a commit that referenced this issue Oct 11, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
jeanp413 pushed a commit that referenced this issue Oct 12, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 12, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
jeanp413 pushed a commit that referenced this issue Oct 13, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 14, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
jeanp413 pushed a commit that referenced this issue Oct 15, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 15, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 15, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 19, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
akosyakov pushed a commit that referenced this issue Oct 19, 2021
This adds a CLI argument --socket, that takes a path.
The server will bind this path instead of a TCP port.

closes #144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants