Hi
I am implementing a program to detect bad IPs and block them in real-time via PF. I have a blocklist table persisted. The table starts with empty. Then my program will add bad IPs into this table.
My expectation is that PF will start blocking the connections from those IPs once they are added into the table. But I can still see the existing udp connections not destroyed/blocked by PF and there is traffic going between them.
/etc/rc.conf
I am using this to add bad IPs to PF table
I verify the IPs are in the PF table. But their existing udp connections are still up. Those connections are established before I add them into the PF table.
Any thoughts? Thanks.
I am implementing a program to detect bad IPs and block them in real-time via PF. I have a blocklist table persisted. The table starts with empty. Then my program will add bad IPs into this table.
My expectation is that PF will start blocking the connections from those IPs once they are added into the table. But I can still see the existing udp connections not destroyed/blocked by PF and there is traffic going between them.
/etc/rc.conf
Code:
table <blocklist> persist file '/usr/local/etc/pf_blocklist'
set skip on lo0
block all
pass out keep state
block on epair100b from <blocklist> to any
block on epair100b from any to <blocklist>
I am using this to add bad IPs to PF table
Code:
pfctl -t blocklist -Tadd 123.123.321.321
I verify the IPs are in the PF table. But their existing udp connections are still up. Those connections are established before I add them into the PF table.
Any thoughts? Thanks.