Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

we would like to move away from sshfs to nfs.

the last thing holding us back is the fact that rpcbind (which i assume is required for nfs to work) does not allow you to specify the tcp (not udp) ip that it binds to.

there is the -h flag, but this is only for the udp ports it opens up. this does not affect the tcp ports, they still open on 0.0.0.0:...

does anyone know how we can secure rpcbind by not exposing it to our public interface?

or even better, is there a way to use nfs without rpcbind?

thanks!

share|improve this question
add comment

2 Answers

The rpcbind is required to map RPC service to network ( read TCP or UDP ) address and port. NFS versions 2 and 3 require an additional service mountd to allow clients to get initial file handle. While nfs has a well know port number 2049, mountd doesn't. IOW, if you want to use NFSv3 you will need to run rpcbind as well (well, there are probably some mount options to tell where mound is running). In opposite to v3, NFSv4 requires only single port 2049 and does not need mountd at all. This makes rpcbind free NFS setup possible. Just be aware, that some (old) clients may still try to talk to rpcbind even for v4.

Now, about rpcbind. Why you want to protect it? If it's not available to clients, then they cant mount? The only reason to protect is to limit number of clients which can do updates. But this is already in place as rpcbind uses unix domain socket and disallow any remote client perform updates. Even on a local host you need to be root for that. If you want to protect from some clients only, then iptables is your friend (or what ever firewall your OS has):

# iptables -A INPUT -s 10.1.2.0/24 -p tcp --dport 111 -j ACCEPT
# iptables -A INPUT -s 10.1.3.0/24 -p udp --dport 111 -j ACCEPT
# iptables -A INPUT -p tcp --dport 111 -j DROP
# iptables -A INPUT -p udp --dport 111 -j DROP
share|improve this answer
add comment

The lookup for the service port is baked into the RPC protocol, so you'd have to do something quite exotic to avoid rpcbind when running NFS.

You could block connections from particular addresses or interfaces using iptables; with tcpwrappers (/etc/hosts.allow, /etc/hosts.deny); or - for the adventurous - with SELinux.

tcpwrappers is available natively if "ldd /sbin/rpcbind" shows a link to libwrap, otherwise you'd need to suppress the usual startup and instead run it out of inetd/xinetd through tcpd. I haven't tried that myself.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.