How to Secure Memcached server From UDP Attacks
In this tutorial we’ll secure Memcached server from UDP attacks which are common now a days, if you’re not using firewall and the memcached port is closed for the world you’re safe from this attacks.
If your Memcached server is only used by your local server then add the below line which will disable UDP and only listen to localhost IP, which will prevent your server from being exposed on the internet by disabling the UDP protocol. UDP Protocol is now old technology which is not required anymore. TCP is more secure and today all are using it with Memcached.
Edit memcached config file :
nano /etc/sysconfig/memcached
Add this line -l 127.0.0.1 -U 0
under OPTIONS=”” quotes like :
OPTIONS="-l 127.0.0.1 -U 0"
** at the end it will look like this :
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="-l 127.0.0.1 -U 0"
If your Memcached server is binding with ip, add the following OPTIONS
line, which will only disable the UDP protocol:
OPTIONS="-U 0"
After that you need to restart the memcached server and done.
service memcached restart