home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / kb / Network_Other / nfs-firewalling < prev    next >
Internet Message Format  |  2006-01-08  |  2KB

  1. From: Allen Kistler <ackistler @oohay.moc>
  2. Newsgroups: comp.os.linux.security
  3. Subject: Re: Firewall & NFS
  4. Date: Sun, 04 Dec 2005 17:32:05 GMT
  5. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1
  6.  
  7. Some NFS-associated ports are dynamic, so the ports you specified probably aren't valid.  Typically outbound traffic on a connection allows the inbound traffic to return through netfilter.  Netfilter makes up a state at startup, allowing your "established" connections to continue.  (At least I suspect that's what's happening.)
  8.  
  9. portmap port is always 111
  10.  
  11. nfsd port is always 2049
  12.  
  13. lockd port can be defined in /etc/modprobe.conf
  14.  
  15. mountd and statd ports can be defined as startup options (how you define them varies with distro; RH and FC use /etc/sysconfig/nfs)
  16.  
  17. rquotad port can't be defined (last I checked, but you don't need it unless you're using quotas)
  18.  
  19. See man pages and assorted, existing howtos for more info.  
  20.  
  21.  
  22.  
  23.  
  24. From: EricT <ericteuber @web.de>
  25. Newsgroups: comp.os.linux.security
  26. Subject: Re: Firewall & NFS
  27. Date: Mon, 05 Dec 2005 22:37:24 +0100
  28. User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716)
  29.  
  30. 1) you can choose which protocol is used with nfs, so you don't need to open both protocols for that particular traffic.
  31.  
  32. 2) Allen is absolutely right, the ports can be dynamic, like passive ftp.
  33.  
  34. 3) you should use interface settings instead of ip addresses or use both.
  35.  
  36. 4) open the server port and allow established (related) traffic from one to the other.
  37.  
  38. As far as i know, these rules should do it.
  39.  
  40. server 1
  41. iptables -A INPUT -i <int-iface1> -s <nfs-ip2> -d <nfs-ip1> -p <protocol> --dport 111 -m state --state NEW,ESTABLISHED
  42. iptables -A OUTPUT -o <int-iface1> -d <nfs-ip2> -s <nfs-ip1> -p <protocol> -m state --state RELATED,ESTABLISHED
  43.  
  44. server 2
  45. iptables -A INPUT -i <int-iface2> -s <nfs-ip1> -d <nfs-ip2> -p <protocol> --dport 111 -m state --state NEW,ESTABLISHED
  46. iptables -A OUTPUT -o <int-iface2> -d <nfs-ip1> -s <nfs-ip2> -p <protocol> -m state --state RELATED,ESTABLISHED
  47.  
  48. greetz,
  49. Eric
  50.  
  51.  
  52.  
  53.  
  54.