Hello,
Do you know hashlimit module of iptables ? It's a very cool tool. But i don't find an equivalent on *BSD.
Block an IP who request x times on TCP/UDP.
Then, with PF, I try to make similar thing. I've an Open DNS resolver (for lab test only), and I flood it with hping3 on TCP (53) and UDP (53) and tcpdump on it to see packets. I've create lot of /etc/pf.conf to make that but NOTHING works. All packets sends continue to pass out (tcpdump() view).
Or a little rule :
I don't understand why the rules don't work.
Anyone have a pf.conf who works on UDP 53 ?
Thanks all and sorry for my English.
Do you know hashlimit module of iptables ? It's a very cool tool. But i don't find an equivalent on *BSD.
Block an IP who request x times on TCP/UDP.
Then, with PF, I try to make similar thing. I've an Open DNS resolver (for lab test only), and I flood it with hping3 on TCP (53) and UDP (53) and tcpdump on it to see packets. I've create lot of /etc/pf.conf to make that but NOTHING works. All packets sends continue to pass out (tcpdump() view).
Code:
ext_if = "vtnet0"
set loginterface $ext_if
# TCP timout settings
#set timeout tcp.first 60
#set timeout tcp.established 86400
set optimization aggressive
set timeout { adaptive.start 20000, adaptive.end 220000 }
#set limit states 200000
set limit states 200000
set skip on lo
set debug urgent
set block-policy drop
set loginterface $ext_if
set state-policy if-bound
set fingerprints "/etc/pf.os"
set ruleset-optimization none
### Timeout Options
set optimization normal
set timeout { tcp.closing 60, tcp.established 7200}
#------ Normalization --------#
scrub in all
scrub out all
#------ Anti-spoofing --------#
#antispoof for $ext_if inet
antispoof for lo0
#------ Loopback -------------#
pass in quick on lo0 all
pass out quick on lo0 all
dns_ip="x.x.x.x"
table <abusive_ips> persist
block in quick from <abusive_ips>
pass in on $ext_if proto tcp to $dns_ip port 53 flags S/SA keep state (max-src-conn 100, max-src-conn-rate 15/5, overload <abusive_ips> flush)
#pass in on $ext_if proto udp to $dns_ip port 53 flags S/SA keep state (max-src-conn 100, max-src-conn-rate 15/5, overload <abusive_ips> flush)
pass in on $ext_if proto tcp to $dns_ip port 53 synproxy state
pass in on $ext_if proto udp to $dns_ip port 53 synproxy state
Or a little rule :
Code:
ext_if = "vtnet0"
table <flood> persist
block quick from <flood>
pass inet proto tcp from any to $ext_if port 53 \
flags S/SA keep state \
(max-src-conn 100, max-src-conn-rate 15/5, \
overload <flood> flush global)
I don't understand why the rules don't work.
Anyone have a pf.conf who works on UDP 53 ?
Thanks all and sorry for my English.