Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save djaiss/ec8cab133fdf03a03f86 to your computer and use it in GitHub Desktop.
Save djaiss/ec8cab133fdf03a03f86 to your computer and use it in GitHub Desktop.
# Manually secure port 6379
sudo iptables -A INPUT -p tcp --dport 6379 -s xxx.xxx.xxx.xxx -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 6379 -j DROP
sudo iptables -L
# Save current firewall config
sudo iptables-save > /etc/iptables.conf
# Load iptables.conf on startup
sudo nano /etc/rc.local
# Add the following:
# Load iptables rules from this file
iptables-restore < /etc/iptables.conf
# EXAMPLE:
# Generated by iptables-save v1.4.12 on Thu Oct 17 19:46:50 2013
*filter
:INPUT ACCEPT [4316:515188]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [15307:1118735]
-A INPUT -s xxx.xxx.xxx.xxx/32 -p tcp -m tcp --dport 6379 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 6379 -j DROP
COMMIT
# Completed on Thu Oct 17 19:46:50 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment