Hello,
I have been trying to resolve ipfw problem with blocking DNS. I even remove almast all rules and have added only ports 22 and 53. I can't still connect with port 53. I tried with PF and works like a charm. When i turn off firewall work like a charms. There is something fucked with IPFW.
And complicated ipfw rules !
Telnet for port 22 works great. For other services either (i didn't mention here because don't matter). The problem start with port 53 i can't assigne domain from panel on that ip (get message: A hostname is given that is not resolved). As i said for PF and without firewall everything works great ! Bind99 is locked in jail and has a public ip so nat isn't needed. The funny thing is that telnet on port 53 is working.
Someone can tell me what kind of magic is here ?????
I have been trying to resolve ipfw problem with blocking DNS. I even remove almast all rules and have added only ports 22 and 53. I can't still connect with port 53. I tried with PF and works like a charm. When i turn off firewall work like a charms. There is something fucked with IPFW.
Code:
/etc/rc.conf
firewall_enable="YES"
firewall_script="/etc/ipfw.rules"
firewall_logging="YES"
Code:
/etc/ipfw.rules
#!/usr/local/bin/bash
# ipfw config/rules
ipfw -q -f flush
# Set rules command prefix
cmd="ipfw -q add "
vif="em0"
# allow all for localhost
$cmd 00010 allow ip from any to any via lo0
# StateFull
$cmd 00101 check-state
### SSH:
$cmd allow tcp from any to me dst-port 22 in via $vif setup keep-state
$cmd allow tcp from me to any dst-port 22 out via $vif setup keep-state
### DNS:
$cmd allow tcp from any to me dst-port 53 in via $vif setup keep-state
$cmd allow tcp from any to me dst-port 53 in via $vif setup
$cmd allow tcp from me to any dst-port 53 out via $vif setup keep-state
$cmd allow udp from me to any dst-port 53 out via $vif keep-state
### Deny Everything else:
# deny everything else, and log it
# inbound catchall
$cmd 56599 deny log ip from any to any in via $vif
Telnet for port 22 works great. For other services either (i didn't mention here because don't matter). The problem start with port 53 i can't assigne domain from panel on that ip (get message: A hostname is given that is not resolved). As i said for PF and without firewall everything works great ! Bind99 is locked in jail and has a public ip so nat isn't needed. The funny thing is that telnet on port 53 is working.
Someone can tell me what kind of magic is here ?????