Archive for May 22nd, 2018

iptables: a rule with expiration

Tuesday, May 22nd, 2018

If you need an automated way of deleting iptables rules after some time, use this:


iptables -A INPUT -s 9.8.7.6 -j DROP && { echo "iptables -D INPUT -s 9.8.7.6 -j DROP" | at now + 1 min; }

This rule will be deleted in a 1 minute.