Hi everyone,
I'm new to this forum and I got into FreeBSD only a few weeks ago (I used Linux before that).
I'm trying to set up a minimal firewall configuration for a remote computer.
Here is the script in my /etc/ipfw.rules file.
Everything seems to be working as I expected, except for ftp.
On Linux, with iptables, allowing port 20 and 21 outbound traffic is enough to make ftp work (as long as you enable the "related,established" traffic).
Is there something similar I can do with ipfw to allow outbound ftp traffic without adding a rule that would allow traffic to the whole ephemeral port range?
Thanks for your help.
I'm new to this forum and I got into FreeBSD only a few weeks ago (I used Linux before that).
I'm trying to set up a minimal firewall configuration for a remote computer.
Here is the script in my /etc/ipfw.rules file.
Code:
#!/usr/bin/env bash
nic=`netstat -r | awk '/^default/ {print $4}'`
cmd="ipfw -q add"
ipfw -q -f flush
$cmd 000100 check-state
$cmd 000110 allow all from any to any via lo0
$cmd 000120 allow tcp from any to any 22 in via "$nic" setup keep-state
$cmd 000130 allow tcp from any to any 53 out via "$nic" setup keep-state
$cmd 000140 allow udp from any to any 53 out via "$nic" keep-state
$cmd 000150 allow tcp from any to any 20 out via "$nic" setup keep-state
$cmd 000160 allow tcp from any to any 21 out via "$nic" setup keep-state
$cmd 000170 allow tcp from any to any 80 out via "$nic" setup keep-state
$cmd 000180 allow tcp from any to any 443 out via "$nic" setup keep-state
$cmd 000190 allow tcp from any to any 37 out via "$nic" setup keep-state # ntp
$cmd 000200 allow icmp from any to any icmptypes 8 in
$cmd 000210 allow icmp from any to any icmptypes 0 out
Everything seems to be working as I expected, except for ftp.
On Linux, with iptables, allowing port 20 and 21 outbound traffic is enough to make ftp work (as long as you enable the "related,established" traffic).
Is there something similar I can do with ipfw to allow outbound ftp traffic without adding a rule that would allow traffic to the whole ephemeral port range?
Thanks for your help.