1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-09-16 14:14:42 -04:00

Blocking ICMP the better way

This commit is contained in:
TommyTran732 2021-09-26 00:39:35 -04:00
parent 4ee2dc607d
commit e2f5fbb115
No known key found for this signature in database
GPG Key ID: 8825C3851DC29C20

View File

@ -895,8 +895,13 @@ block_icmp(){
output "[2] No."
read icmp
case $icmp in
1 ) /sbin/iptables -t mangle -A PREROUTING -p icmp -j DROP
(crontab -l ; echo "@reboot /sbin/iptables -t mangle -A PREROUTING -p icmp -j DROP >> /dev/null 2>&1")| crontab -
1 ) if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
sed -i '/ufw-before-input.*icmp/s/ACCEPT/DROP/g' /etc/ufw/before.rules
sudo ufw reload
elif [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ]; then
firewall-cmd --permanent --add-icmp-block-inversion
firewall-cmd --reload
fi
;;
2 ) output "Skipping rule..."
;;