Wednesday, January 25, 2012

securing memcache

Simply iptables rules can be added to secure memcached server from the out sources.

/sbin/iptables -A INPUT -m tcp -p tcp -s 127.0.0.1 --dport 11221 -j ACCEPT
/sbin/iptables -A INPUT -m tcp -p tcp -s CLIENT_IP_2 --dport 11221 -j ACCEPT
/sbin/iptables -A INPUT -m tcp -p tcp -s CLIENT_IP_1 --dport 11221 -j ACCEPT
/sbin/iptables -A INPUT -m tcp -p tcp --dport 11221 -j DROP
To make it run when system restarts just add it to the /etc/rc.local file.