Full path in the iptables command

When running as root in cron, the iptables command was not found, so a _search_ path command is used instead the single command
This commit is contained in:
Alfonso 2023-02-06 11:45:21 +01:00 committed by GitHub
parent ccf63dec6f
commit a000daa412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,7 @@ echo "Downloading the most recent IP list from $ABUSE and adding them to abuseip
ipset create abuseipdb hash:ip ipset create abuseipdb hash:ip
curl -s -H "key: $abuse_key" https://api.abuseipdb.com/api/v2/blacklist | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 ipset add abuseipdb 2>&1 curl -s -H "key: $abuse_key" https://api.abuseipdb.com/api/v2/blacklist | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 ipset add abuseipdb 2>&1
echo "Adding the iptables rules..." echo "Adding the iptables rules..."
iptables -I INPUT -m set --match-set crawler_bots src -j DROP $(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set crawler_bots src -j DROP
iptables -I INPUT -m set --match-set blocklistde src -j DROP #iptables -I INPUT -m set --match-set crawler_bots src -j DROP
iptables -I INPUT -m set --match-set abuseipdb src -j DROP $(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set blocklistde src -j DROP
$(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set abuseipdb src -j DROP