LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2003, 11:18 PM   #1
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
Geek problem 'bout NFS


Ok I have a problem about NFS, but I warn you, it's pretty complex :P

So... My architecture look like the following :
NFSD
|
|
Router
|
|
Clients

1-Please note that NFSD and Clients are on different Class C IP so I need a Linux Router in the middle to do NAT. Everything works fine 'bout it.

2-NFSD is a box who is running an NFS Server. This Server is for Log, because Router is also acting as a syslog server. Every client send their log to Router.

3-Router is mounting NFS partition RW because it has to put his logs on it. Clients should only be able to mount it RO for security reason.


TROUBLE : NFS is too stupid to support NAT, so when a client mount NFS partition (trough NAT Router) the NFSD authentify the connection as it is coming from the router. Becuz Router has full RW access to NFS partition, every clients got the RW access too.
So I'm trying to built some crazy iptables rules to ensure that all trafic going to NFSD from client will not be Nated. I'm not sure I'm right but I'm trying to use some -j DNAT and -j SNAT to change source/destination of packet.

So far it's not working, but I suspect the NFS protocol the be guilty since it doesn't respect standard (not always using Syn before tcp communication, sometime use port not identified for NFS/Portmap to talk).

Ok so here is these iptables line. It is commented, I know.

#echo " NFS/Portmap Forwarding"
# This is because NFS Protocol is stupid and doesn't suport NAT
# So I have to force forwarding to ensure my NFSD Safety

#$IPTABLES -t nat -A PREROUTING -p tcp -s 192.168.1.2 -d 192.168.0.2 --sport 111 -j DNAT --to-destination 192.168.0.2
#$IPTABLES -t nat -A POSTROUTING -p tcp -s 192.168.1.2 -d 192.168.0.2 --sport 111 -j SNAT --to-source 192.168.1.2
#$IPTABLES -t nat -A PREROUTING -p udp -s 192.168.1.2 -d 192.168.0.2 --sport 111 -j DNAT --to-destination 192.168.0.2
#$IPTABLES -t nat -A POSTROUTING -p udp -s 192.168.1.2 -d 192.168.0.2 --dport 111 -j SNAT --to-source 192.168.1.2


#$IPTABLES -t nat -A PREROUTING -p tcp -s 192.168.1.2 -d 192.168.0.2 --sport 2049 -j DNAT --to-destination 192.168.0.2
#$IPTABLES -t nat -A POSTROUTING -p tcp -s 192.168.1.2 -d 192.168.0.2 --dport 2049 -j SNAT --to-source 192.168.1.2
#$IPTABLES -t nat -A PREROUTING -p udp -s 192.168.1.2 -d 192.168.0.2 --sport 2049 -j DNAT --to-destination 192.168.0.2
#$IPTABLES -t nat -A POSTROUTING -p udp -s 192.168.1.2 -d 192.168.0.2 --dport 2049 -j SNAT --to-source 192.168.1.2


#$IPTABLES -t nat -A PREROUTING -p tcp -s 192.168.0.2 -d 192.168.1.2 --sport 111 -j DNAT --to-destination 192.168.1.2
#$IPTABLES -t nat -A POSTROUTING -p tcp -s 192.168.0.2 -d 192.168.1.2 --dport 111 -j SNAT --to-source 192.168.0.2
#$IPTABLES -t nat -A PREROUTING -p udp -s 192.168.0.2 -d 192.168.1.2 --sport 111 -j DNAT --to-destination 192.168.1.2
#$IPTABLES -t nat -A POSTROUTING -p udp -s 192.168.0.2 -d 192.168.1.2 --dport 111 -j SNAT --to-source 192.168.0.2

#$IPTABLES -t nat -A PREROUTING -p tcp -s 192.168.0.2 -d 192.168.1.2 --sport 2049 -j DNAT --to-destination 192.168.1.2
#$IPTABLES -t nat -A POSTROUTING -p tcp -s 192.168.0.2 -d 192.168.1.2 --dport 2049 -j SNAT --to-source 192.168.0.2
#$IPTABLES -t nat -A PREROUTING -p udp -s 192.168.0.2 -d 192.168.1.2 --sport 2049 -j DNAT --to-destination 192.168.1.2
#$IPTABLES -t nat -A POSTROUTING -p udp -s 192.168.0.2 -d 192.168.1.2 --dport 2049 -j SNAT --to-source 192.168.0.2

With these lines, everything works, BUT NFSD (192.168.0.2) still authentificate connection from clients (192.168.1.2) as it is coming from router (192.168.1.1/192.168.0.1).


It is a real problem and a real security hole.
Any (freak) idea how I can fix it?


NB: Please don't tell me "use something else", I HAVE to use NFS... just one word : University.
 
Old 04-23-2004, 09:02 PM   #2
h00chman
LQ Newbie
 
Registered: Mar 2004
Location: Spokane, WA
Distribution: Mandrake 9.1, 9.2, RH9, OpenBSD
Posts: 13

Rep: Reputation: 0
Did you find an answer...I have a similar problem?

I have similar problem using NFS, albeit on my small office network. Did you find a workaround to the problem? My NFS server keeps refusing a connection because it looks like everything is coming from the router.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS client = Linux, NFS server = Mac OS X Tiger --> Hell of a problem make Linux - Networking 9 03-10-2006 05:16 AM
nfs client on knoppix 3.9 - problem mounting nfs drive Rod Butcher Linux - Networking 1 09-21-2005 04:18 AM
You might be a geek if... jspenguin General 4 12-08-2003 09:14 PM
Well im just another geek in th world... tedist_god LinuxQuestions.org Member Intro 0 09-18-2003 05:39 PM
who's geek? zeky General 18 12-29-2002 02:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration