Last active
November 19, 2018 11:01
-
-
Save p-rintz/61ef9ed8e30da79d2166c5c8f28b3f90 to your computer and use it in GitHub Desktop.
Update/Install Hetrixtools iptables ping rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo | |
echo "Please pass either 'install' or 'update' as parameter" | |
echo | |
elif [ $1 = "update" ]; then | |
echo "---------------------" | |
echo "Updating hetrix rules" | |
echo "---------------------" | |
wget https://hetrixtools.com/resources/uptime-monitor-ips.txt | |
iptables -F hetrix | |
cat uptime-monitor-ips.txt | sed 's/\s.*$//' | sed 's/com/com -j ACCEPT/g' | xargs -t -l1 iptables -A hetrix -s | |
rm uptime-monitor-ips.txt | |
echo | |
echo "All done" | |
elif [ $1 = "install" ]; then | |
echo "--------------------------------------------" | |
echo "Installing a new Hetrix chain and filling it" | |
echo "--------------------------------------------" | |
iptables -N hetrix | |
wget https://hetrixtools.com/resources/uptime-monitor-ips.txt | |
cat uptime-monitor-ips.txt | sed 's/\s.*$//' | sed 's/com/com -j ACCEPT/g' | xargs -t -l1 iptables -A hetrix -s | |
rm uptime-monitor-ips.txt | |
iptables -I INPUT -p icmp -m icmp --icmp-type any -m state --state NEW -j hetrix | |
echo | |
echo "All done" | |
else | |
echo "Wrong parameter set" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment