-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Bind to unix socket instead of IP and port #2503
Comments
I think it's possible to use Unix sockets for the kernels, though I forget exactly how to set that up. @minrk can probably give more info. The web server needs to run on a TCP socket, as browsers can't connect to a Unix socket, as far as I know. |
Kernels can use unix sockets by setting |
I know that’s why I want to use a non-IP socket for the server. |
If jupyter supported listening on a unix socket, I could use normal unix permissions on the server to restrict who can access it without any passwords. Then, as OpenSSH supports redirecting client port to a unix socket on the server, I could just |
Oh neat, I didn't know that was possible. PRs welcome; the relevant code is here: notebook/notebook/notebookapp.py Line 1299 in b76c8d9
And tornado docs: |
You can control the permissions of a unix socket. Might be neater than a one time cookie? |
Unfortunately it doesn't help much for the default use case - the server has to be accessible on a TCP port, because browsers can't connect to unix sockets. |
Didn't know that - boo! |
The unix-socket solution would really only be useful as @ibukanov suggested -- on remote systems over an SSH tunnel However, there is a use-case for this now on HPC environments where users access shared login nodes. Reconnecting (even from another access terminal) is as simple and a new tunnel to that unix socket |
I'm interested in picking this one up soon - let me know if anyone else is already working on it. |
I implemented the below code as a quick hack for my team -- it is a "hack" to notebookapp.py, if a negative port is passed then create a unix socket in the home directory notebookapp.py 1399 self.http_server = httpserver.HTTPServer(self.web_app, ssl_options=ssl_options,
It works, but clearly not the full solution |
I have an initial PR out for this here: #4835 this is working well with local testing, just needs some kind of test coverage. if someone's available to take a look to provide high level guidance, that'd be great. |
tests are in and #4835 should be good to go now. cc @takluyver @minrk in case either of you can recommend someone to help review. |
I need the unix socket for the jupyter too much now. |
I don't know what state the PR is in, but if it's working correctly, you can use it by checking out a copy of the repository with |
we've been dogfooding #4835 in production at Twitter for a couple of weeks now with 100% of internal user traffic going over this mechanism - no issues on our side. would be great to get this landed for the 7.0.0 release tho. |
This is currently blocking the upstream VSCode security issue microsoft/vscode-python#8331. It would be lovely to get the upstream issue cleared 🙂 |
Is there any way to have Jupyter bind to a unix socket instead of a TCP port? We are looking into using Jupyter on our cluster and would like to avoid exposing ports, even on localhost.
We used Docker but ran into a security problem so that is out of the question.
The text was updated successfully, but these errors were encountered: