It is all too common for people to just turn off IPtables instead of actually figuring out what ports to open. I have to admit I have done it myself. Well we need to stop that. IPtables is ourĀ friend, really. To that end, here is the body of a script you can use to configure IPtables.
# Couchbase DB Server Ports iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 4369 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 8091 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 8092 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 11209 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 11210 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 11211 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 11214 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 11215 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 18091 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 18092 -j ACCEPT iptables -A INPUT -p tcp -m state –state NEW -m tcp –dport 21100:21199 -j ACCEPT Ā # Couchbase sync_gateway ports
# If you want to open the sync_gateway service's admin interface to outside traffic: # When you are done adding those, you want to run the following two commands to make sure the REJECT is iptables -D INPUT -j REJECT –reject-with icmp-host-prohibited |
Check to make sure they are all in correctly by running as root iptables --list
. It should look something like this:
# iptables –list Chain FORWARD (policy ACCEPT) Chain OUTPUT (policy ACCEPT) |
Just remember to save this config once you have it in place (service iptables save
). Also, you needĀ to confirm that the REJECT for the INPUT chain is at the end. Otherwise you will reject any traffic to portsĀ listed below that REJECT.
Just remember that this is local server security only! It does NOT take the place of a network firewall or AWS security groups/networkĀ ACLs. You really should use both.
If you would like more information on network ports, please see theĀ Couchbase Admin documentationĀ or the Couchbase mobile documentation.
There are no warranties, expressly or implied in this blog post, for IPTables or these settings. You have to do your own due dilligence when it comes to your system's security. So use good sense here, please.
What would the scripts be for Windows Server?
Thanks