rigoletto@
Developer
Hello fellows,
I just built a small FreeBSD server a couple of days ago, and I had ZERO experience with it (FreeBSD) before that.
I am willing to have basically these services running on it: ssh, nextcloud/owncloud on nginx, dhcpcd server, ntp server, for personal usage.
This server is more for testing purposes in order to allow me to learn about FreeBSD in general, so I am not willing to deal with (i.e.) jails for now.
Since PF will take some time to learn and I am not a firewall guru, basically I would like to find a good example of PF rules to at least match with what I am using on my Gentoo box (iptables), what is not THAT rules but it is working fine for me.
For now I am using slightly modified rules from here, what is working but I do not know if they are enough to a box that will be on DMZ.
Another question is: if using just one interface, and I am, ext_if/int_if should be set with it for both, or is there another more proper way to do that.
Many thanks!
I just built a small FreeBSD server a couple of days ago, and I had ZERO experience with it (FreeBSD) before that.
I am willing to have basically these services running on it: ssh, nextcloud/owncloud on nginx, dhcpcd server, ntp server, for personal usage.
This server is more for testing purposes in order to allow me to learn about FreeBSD in general, so I am not willing to deal with (i.e.) jails for now.
Since PF will take some time to learn and I am not a firewall guru, basically I would like to find a good example of PF rules to at least match with what I am using on my Gentoo box (iptables), what is not THAT rules but it is working fine for me.
Code:
IPT="/sbin/iptables"
IPTS="/sbin/iptables-save"
IPTR="/sbin/iptables-restore"
$IPT -F
$IPT -X
$IPT -Z
$IPT -N TCP
$IPT -N UDP
$IPT -P INPUT DROP
$IPT -P OUTPUT ACCEPT
$IPT -P FORWARD DROP
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A INPUT -m conntrack --ctstate INVALID -j DROP
$IPT -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
$IPT -A INPUT -p icmp -m icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
$IPT -A INPUT -p udp -m conntrack --ctstate NEW -j UDP
$IPT -A INPUT -p tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
$IPT -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
$IPT -A INPUT -p tcp -j REJECT --reject-with tcp-reset
$IPT -A INPUT -j REJECT --reject-with icmp-proto-unreachable
$IPT -A OUTPUT -p icmp -m conntrack --ctstate INVALID -j DROP
#SSH
$IPT -A TCP -s 192.168.0.0/24 -p tcp --dport 22 -j ACCEPT
For now I am using slightly modified rules from here, what is working but I do not know if they are enough to a box that will be on DMZ.
Another question is: if using just one interface, and I am, ext_if/int_if should be set with it for both, or is there another more proper way to do that.
Many thanks!
