1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-11-22 18:41:32 -05: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." output "[2] No."
read icmp read icmp
case $icmp in case $icmp in
1 ) /sbin/iptables -t mangle -A PREROUTING -p icmp -j DROP 1 ) if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
(crontab -l ; echo "@reboot /sbin/iptables -t mangle -A PREROUTING -p icmp -j DROP >> /dev/null 2>&1")| crontab - 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..." 2 ) output "Skipping rule..."
;; ;;