Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Apr 18, 2010 10:01 pm 
Offline
Senior Newbie

Joined: Fri Apr 02, 2010 3:17 pm
Posts: 13
I'm having trouble getting past iptables in a NFS setup. The NFS server iptable has the following rules:

-A INPUT -p tcp --dport 111 -j ACCEPT
-A INPUT -p udp --dport 111 -j ACCEPT
-A INPUT -p tcp --dport 2049 -j ACCEPT
-A INPUT -p udp --dport 2049 -j ACCEPT

My understanding is this should open the ports to my client machine, but it's not happening. If I comment out the last deny rule below I have no problem mounting from the client:

-A INPUT -j REJECT

With the above uncommented in the server iptable, I'm blocked. Obviously my 'accept' rules are incorrect. Any suggestions would be greatly appreciated.

Thanks,


Top
   
 Post subject:
PostPosted: Mon Apr 19, 2010 4:11 am 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
Only a guess, but doesn't having the REJECT last override all the ACCEPT lines? (assumes you have it in this order)

REJECT first then ACCEPT and see if that works.


Top
   
 Post subject:
PostPosted: Mon Apr 19, 2010 12:17 pm 
Offline
Senior Newbie

Joined: Fri Apr 02, 2010 3:17 pm
Posts: 13
I checked the daemon log and it appears that when the client mount was working, the port that was used was essentially random. Reading elsewhere, this appears to be common with NFS and consequently a problem connecting through iptables. Even locking the port in the nfs-kernel-server configuration didn't help. So I changed the iptables port to a wide range and set the connection to just my client's private ip, and it works now.

Thanks.


Top
   
 Post subject:
PostPosted: Mon Apr 19, 2010 4:55 pm 
Offline
Senior Member

Joined: Sat Mar 28, 2009 4:23 pm
Posts: 415
Website: http://jedsmith.org/
Location: Out of his depth and job-hopping without a clue about network security fundamentals
cap wrote:
I checked the daemon log and it appears that when the client mount was working, the port that was used was essentially random. Reading elsewhere, this appears to be common with NFS and consequently a problem connecting through iptables. Even locking the port in the nfs-kernel-server configuration didn't help. So I changed the iptables port to a wide range and set the connection to just my client's private ip, and it works now.

Thanks.

Yes. This is the function of the RPC mechanism. Lock down the RPC server to just the source IPs that you need -- RPC is a favorite target.

I was able to get all of NFS's daemons to lodge to one port using configuration options in /etc/defaults (Ubuntu), but not for NFSv4 -- just NFSv3.

_________________
Disclaimer: I am no longer employed by Linode; opinions are my own alone.


Top
   
 Post subject:
PostPosted: Mon Apr 19, 2010 5:52 pm 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
cap wrote:
So I changed the iptables port to a wide range and set the connection to just my client's private ip, and it works now.

Another option (if you're essentially locking things down to a specific client) is to set up a VPN, such as OpenVPN, from the client, and then let any VPN tunnel traffic through in general on the server side.

That way, you have a single client-side step of establishing the VPN, and after that you have full access to your server without requiring any further fiddling with any filters.

-- David


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group