This is either a bug in FreeBSD 10 with the pf firewall, or things have changed so drastically that I cannot figure out how to make it work correctly.
After a fresh, clean install of FreeBSD 10, I would set up my SSH to listen on a high port (say, 30000) and activate it by
In addition, I also tried a variation of settings for sshd to listen on the standard port 22, but redirect it from the firewall:
I would first activate the pf firewall by issuing the command
The problem happens when I enable it within /etc/rc.conf by inserting
and a reboot. After the reboot, the machine simply refuses to accept the SSH connection (which it did by the
The only way to disable the firewall is to log in by console and mark out
in rc.conf file, and then reboot.
NOTE: it is a fresh, clean install of FreeBSD 10. I have not done anything else including changing the security level, or that sort of things. Further, I have re-installed the OS again and repeated all the same steps with the same result.
After a fresh, clean install of FreeBSD 10, I would set up my SSH to listen on a high port (say, 30000) and activate it by
service sshd onestart. Then, I would set the pf firewall to block out all traffic, except for sshd. The pf settings would look something like this:
Code:
set skip on lo
pass in quick on [INTERFACE] inet proto tcp from any to <LISTENING SERVER IP ADDRESS> port 30000
block drop log all
In addition, I also tried a variation of settings for sshd to listen on the standard port 22, but redirect it from the firewall:
Code:
set skip on lo
rdr on [INTERFACE] proto tcp from any to <LISTENING SERVER IP ADDRESS> port 30000 -> 127.0.0.1 port 22
block drop log all
pass in inet proto tcp to 127.0.0.1 port 22
I would first activate the pf firewall by issuing the command
service pf onestart. At this point, everything worked correctly. I could ssh into the machine remotely and it also stops responding to ICMP pings (since it is not allowed in the firewall rules). By disabling it by service pf stop, everything reverted just as expected (i.e. including ICMP pings responded). I even tried a few times and things worked as expected.The problem happens when I enable it within /etc/rc.conf by inserting
Code:
sshd_enable="YES"
pf_enable="YES"
service pf onestart testing with exactly the same unchanged firewall rules). I even tried to disable the firewall by service pf stop and pfctl -d. Nothing worked. It still continues to refuse the SSH connections and pings won't respond. It is like a complete firewall permanently glued to it and there's no way to disable it. I tried the command pfctl -sr and saw the rules are no longer there BUT connections still won't work and pings won't respond. It is just like superficially it shows disabled but the firewall blockage is still active.The only way to disable the firewall is to log in by console and mark out
Code:
#enable_pf="YES"
NOTE: it is a fresh, clean install of FreeBSD 10. I have not done anything else including changing the security level, or that sort of things. Further, I have re-installed the OS again and repeated all the same steps with the same result.