hugelgupf / p9

Idiomatic Go 9P2000.L client and server, extracted from gVisor for general use
Apache License 2.0
90 stars 19 forks source link

local_server: add support for unix domain sockets #20

Closed nmeum closed 4 years ago

nmeum commented 4 years ago

This add support for binding local_server to UNIX domain socket, e.g. to restrict server usage to a specific system user / group. The Linux kernel 9p implementation does support transport over unix domain sockets as well. To verify that this change works correctly using the Linux implementation:

$ local_server -root . -unix /tmp/9p
$ mount -t 9p /tmp/9p /media/9pfs/ -o trans=unix
$ ls /media/9pfs/
…
hugelgupf commented 4 years ago

hey @nmeum are you using this stuff for anything? anything in particular i should be testing and not breaking?

nmeum commented 4 years ago

I am working on a setup for my NAS where I export my $HOME using 9p. Since authentication is a bit annoying with 9p, p9ufs creates a Unix domain socket on the NAS in my $HOME which I forward using ssh -L to my other machines. This allows me to do authentication over ssh without letting anyone else on the NAS access the 9p file server (which would be the case when binding to localhost). p9 was the most promising implementation I found for this purpose.