1b961
![]() |
|
|
|
|
|||||||
| Firewalls IPFW, PF, IPF (but not limited) related discussion |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I have a server and a client. I have set up an NFS server on the server and i can successfully connect to my backup file from my client machine. My issue is that this will only work with the firewall off. When i turn the firewall on i get Quote:
Is there any configuration changes i can make in order to allow this through? Thanks in advance |
|
#2
|
||||
|
||||
|
Code:
pass on $ext_if proto { tpc, udp } from any to any port { nfsd, lockd }
|
|
#3
|
||||
|
||||
|
NFS is somewhat tricky to firewall. RPC uses different ports each time.
__________________
Senior UNIX Engineer at Unix Support Nederland Experience is something you don't get until just after you need it. |
|
#4
|
||||
|
||||
|
In that case you can allow all ports form known to be "secure" hots... [similar to what i did with ftp
]
|
|
#5
|
|||
|
|||
|
Thanks for the replies.
I tried Quote:
You say i can allow all ports from known to be "secure" hosts? How do i go about doing this? |
|
#6
|
||||
|
||||
|
Well... this is probably not good... but for desktop...
I created list of hosts ip addresses. In my case I created sh script that extracted ftp addresses from ports tree [I need ftp to install ports ]Code:
table <ftp_ports_ip_w_list> const file "/etc/ftp_ports_wlist"
...
...
# enable passive ftp
pass out log on $ext_if inet proto tcp from { $ext_ip, <jail_ip_list> } port >1023 to <ftp_ports_ip_w_list> port { ftp, >1023 } group wheel keep state
pass out log on $ext_if inet proto tcp from { $ext_ip, <jail_ip_list> } port >1023 to <ftp_ip_w_list> port { ftp, >1023 } group { users, wheel } keep state
|
|
#7
|
|||
|
|||
|
This might help: nfs_reserved_port_only="YES"?
|
|
#8
|
|||
|
|||
|
Where does this go? rc.conf?
|
|
#10
|
||||
|
||||
|
If you control the NFS server, then you can tell all of the NFS utilities to listen to specific ports (search for _flags in /etc/defaults/rc.conf and look at nfs, rpcbind, lockd, statd, and so on).
Then you only have to allow TCP/UDP traffic through on those ports. For example, on one NFS server, we use the following: Code:
mountd_enable="yes" # Run mountd (or NO). mountd_flags="-r -h 192.168.0.186 -p 32000" # Flags to mountd (if NFS server enabled) rpc_lockd_enable="yes" # Run NFS rpc.lockd needed for client/server. rpc_lockd_flags="-h 192.168.0.186" # Flags to rpc.lockd (if enabled). rpc_statd_enable="yes" # Run NFS rpc.statd needed for client/server. rpc_statd_flags="-p 32001" # Flags to rpc.statd (if enabled). rpcbind_enable="yes" # Run the portmapper service (YES/NO). rpcbind_flags="-h 192.168.0.186" nfs_server_enable="yes" # This host is an NFS server (or NO). nfs_server_flags="-u -t -n 4 -h 192.168.0.186" # Flags to nfsd (if enabled). |
|
#11
|
||||
|
||||
|
There's another option... [this is how I solved pf+torrents problem]
create jail with aliased IP run NFS in jail.... allow all traffic to/from that IP.... I wonder what others think about this [perhaps it's totally bad] |
|
#12
|
||||
|
||||
|
That's not entirely going to work. IIRC it's mountd that you can't bind to a specific address. Which means it will listen on all addresses, including the ones belonging to other jails and the host itself.
__________________
Senior UNIX Engineer at Unix Support Nederland Experience is something you don't get until just after you need it. |
|
#13
|
||||
|
||||
|
I think allowing {sunrpc nfsd-status nfsd-keepalive nfsd lockd } should be enough. I normally use {sunrpc nfsd lockd }, which appears to be enough. Note two other things:
1. use no-df (pf.conf(5)) on nfs traffic 2. make sure your nfs host/client can resolve one another correctly (DNS or /etc/hosts)
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Adminstrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#14
|
||||
|
||||
|
See my post above. You can set everything to it's own IP, and even lock in the port that most of the NFS-related services can use.
|
|
#15
|
|||
|
|||
|
You see which packets are being blocked with
Code:
block log all BTW If your firewall is a corporate firewall, then the general consensus is to not allow NFS through the firewall. NFS = No File Security
|
|
#16
|
|||
|
|||
|
Agreed. Not that I am an expert by any means, but to get a quick snap shot of what is going on I like to use:
tcpdump -n -i pflog0 There are additional switches that you can add to the command and then you can it pipe to grep or whatever you want to do with the output. |
|
#17
|
|||
|
|||
|
rc.conf on the nfs-server:
Code:
## NFS-Server rpcbind_enable="YES" nfs_server_enable="YES" mountd_flags="-p 789" pf.conf on the firewall: Code:
pass log quick proto {udp tcp} from 172.16.1.0/24 to 172.16.3.2 port {111 789 2049} keep state
Code:
mount_nfs -o tcp,rw 172.16.3.2:/data /mnt To explain: At first the nfs-client contacts the portmapper on the server. The portmapper always runs on port 111 udp and tcp (actually only udp is used). The Client then asks the portmapper on which port the mountd is listening. This port is normally dynamically chosen, but you can force mountd to register always on a specific port and this step is important if you have a (stupid) firewall, because you have to allow this port in the ruleset too. Therefore you have to configure your mountd on the server to always use a specific port (in my case 789). As the next step, the client asks the portmapper for the nfsd. Nfsd's port could be also dynamically chosen, but usually only port 2049 is used (tcp or udp, depends on how you mount!). So for the minimal setup you need at least 111, one port for mountd (789) and one port for nfsd (2049). And if you mount_nfs with tcp you will become less trouble with dropped packets (because of congestion on fast links and/or packet drops on the firewall because of fragmentation). Hope that helps! cheers, honk Last edited by honk; December 18th, 2009 at 03:55. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| enable unicode | estellnb | General | 11 | March 18th, 2010 12:10 |
| [Solved] enable sound | ccc | Multimedia | 6 | August 2nd, 2009 16:20 |
| [Solved] mount iso file | register88 | General | 14 | June 23rd, 2009 14:28 |
| How to enable PF? | Trojan | Firewalls | 19 | May 19th, 2009 23:53 |
| How to enable tar? | ing0dz | General | 7 | January 17th, 2009 18:43 |