# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t raw -F PREROUTING
iptables -t raw -F OUTPUT
# List policies first
iptables -P INPUT DROP; iptables -P FORWARD DROP; iptables -P OUTPUT ACCEPT;
# Disable connection tracking on voice server ports
iptables -A PREROUTING -t raw -p udp --dport 9987 -j NOTRACK
iptables -A OUTPUT -t raw -p udp --sport 9987 -j NOTRACK
# Allow TCP inbound
iptables -A INPUT -p tcp -m state --state NEW -m multiport --dports 21,22 -j ACCEPT
# Drop invalid UDP
iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 0:32 -j DROP
iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 2521:65535 -j DROP
iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 98 -j DROP
# Drop TS3 booter methods
iptables -A PREROUTING -t raw -p udp --dport 9987 -m string --hex-string '|fa163eb402096ac8|' --algo kmp -j DROP
iptables -A PREROUTING -t raw -p udp --dport 9987 -m string --hex-string '|71f63813d5422309|' --algo kmp -j DROP
# Allow incoming packets related to outgoing ones.
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Allow UDP inbound
iptables -A INPUT -p udp --dport 9987 -j ACCEPT
# Allow ICMP
iptables -A INPUT -p icmp -j ACCEPT
# Log all dropped packets to /var/log/messages
iptables -N LOGGING
iptables -A INPUT -j LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4
iptables -A LOGGING -j DROP
I will give you a firewall rules
just you you need to past it on a file as firewall.sh
after you past it just type this on the ssh ( putty)
./firewall.sh
you need to have iptables on your vps
script :
Code:# Flush rules iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -t raw -F PREROUTING iptables -t raw -F OUTPUT # List policies first iptables -P INPUT DROP; iptables -P FORWARD DROP; iptables -P OUTPUT ACCEPT; # Disable connection tracking on voice server ports iptables -A PREROUTING -t raw -p udp --dport 9987 -j NOTRACK iptables -A OUTPUT -t raw -p udp --sport 9987 -j NOTRACK # Allow TCP inbound iptables -A INPUT -p tcp -m state --state NEW -m multiport --dports 21,22 -j ACCEPT # Drop invalid UDP iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 0:32 -j DROP iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 2521:65535 -j DROP iptables -A PREROUTING -t raw -p udp --dport 9987 -m length --length 98 -j DROP # Drop TS3 booter methods iptables -A PREROUTING -t raw -p udp --dport 9987 -m string --hex-string '|fa163eb402096ac8|' --algo kmp -j DROP iptables -A PREROUTING -t raw -p udp --dport 9987 -m string --hex-string '|71f63813d5422309|' --algo kmp -j DROP # Allow incoming packets related to outgoing ones. iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # Allow UDP inbound iptables -A INPUT -p udp --dport 9987 -j ACCEPT # Allow ICMP iptables -A INPUT -p icmp -j ACCEPT # Log all dropped packets to /var/log/messages iptables -N LOGGING iptables -A INPUT -j LOGGING iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4 iptables -A LOGGING -j DROP