No, that's not possible. You would have to script something yourself.pralive said:If i am migrating all servers to a single firewall like pf,ipf or ipfw, is there any way to fetch rules directly from database?
table <me> { self }
# the files on /etc/pf/global table will be synchronized by rsync
table <system_admins> file "/etc/pf/global/system_admins" persist
table <squid_clients> file "/etc/pf/local/squid_clients" persist
table <blacklist> file "/etc/pf/global/blacklist" persist
...
block in log all
block in quick inet from <blacklist> to any
block out quick inet from any to <blacklist>
pass in inet proto tcp from <system_admins> to <me>
pass in on $int_if inet proto tcp from <squid_clients> to <me> port = 3128 keep state
10.0.0.1
10.0.0.2
192.0.2.1
192.0.2.2
post-xfer exec = /path/to/some/script/which/reloads/firewall
.... some lines trimmed
[firewall_cfg]
path = /etc/pf
comment = PF Configuration
auth users = pfsync
secrets file = /usr/local/etc/etc/rsyncd.secrets
read only = false
write only = false
list = false
transfer logging = true
uid = 0
gid = 0
post-xfer exec = /etc/rc.d/pf reload
global/system_admins
global/blacklist
global/some_other_file
#!/bin/sh
TARGET_IP="10.x.x.1"
TARGET_NAME="target_name"
export RSYNC_PASSWORD=some_rsync_password
LOG_FILE="/var/log/pf/sync_${TARGET_NAME}_${TARGET_IP}.log"
SRC_DIR="/pf_master"
#set -x
# Replica ACL out
/usr/local/bin/rsync -rtz --no-owner --chmod=Fug+rw,Fo-rx,Dug+rwx,Do-rx \
--files-from=${SRC_DIR}/file_list.txt \
--log-file ${LOG_FILE} --log-file-format="%o %f %l" \
-4 ${SRC_DIR} rsync://pfsync@${TARGET_IP}/firewall_cfg
...
# IPs i want to block
exec < /path/rc.ipfw_blocked_ip.txt
while read ip
do
$ipfw -q table 2 add $ip
done
...