PDA

View Full Version : [Solved] Cronjob: remove ban of a certain hostname in case it appears in iptables firewall



Fli
10-09-2024, 09:20 AM
This cronjob should run each 5 minutes and remove ban of a certain hostname in case it appears in iptables firewall:

*/5 * * * * root if [[ "$(iptables -L INPUT --line-numbers|head -n3|grep "hostname.not-unban.tld"|grep DROP|awk '{print $1}')" == "1" ]];then iptables -D INPUT 1;fi