andybeak
11/6/2015 - 12:42 PM

Block connections to MySQL

Block connections to MySQL

# allow the one IP address and localhost connections, disallow all else

iptables -A INPUT -i lo -p tcp --dport mysql -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport mysql -s 123.123.123.123 -j ACCEPT
iptables -A INPUT -p tcp --dport mysql -j DROP

# Use this on Debian to help persist over boot
# apt-get install iptables-persistent