Bash cron job for ipfw

With this lines in a cronjob,usually (/etc/cron.d/yourcronjob) in gnu/linux, you can add some rules to your firewall so no one can go out of your lan in the intervals specified, and then back to normal.

In this case, ip 10.0.0.4 would be blocked.

0 21 * * 0-4 /sbin/ipfw add 1 deny all from 10.0.0.4 to any >/dev/null 2>&1
0 21 * * 0-4 /sbin/ipfw add 2 deny all from any to 10.0.0.4 >/dev/null 2>&1
0 5 * * 1-5 /sbin/ipfw del 1 >/dev/null 2>&1
0 5 * * 1-5 /sbin/ipfw del 2 >/dev/null 2>&1


Posted

in

by

Tags:

Comments

Leave a Reply