Skip to content

Commit 6f00ed5

Browse files
committed
Merge pull request #2657 from aledbf/firewall_add_new_node
feat(security): allow access to new nodes using the custom firewall
2 parents 2d02918 + 17f9ee6 commit 6f00ed5

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

contrib/util/custom-firewall.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
echo "Obtaining IP addresses of the nodes in the cluster..."
44
MACHINES_IP=$(fleetctl list-machines --fields=ip --no-legend | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/')
5+
6+
if [ -n "$NEW_NODE" ]; then
7+
MACHINES_IP+=,$NEW_NODE
8+
fi
9+
510
echo "Cluster IPs: $MACHINES_IP"
611

712
echo "Creating firewall Rules..."
@@ -53,6 +58,9 @@ echo "$template" | sudo tee /var/lib/iptables/rules-save > /dev/null
5358
echo "Enabling iptables service"
5459
sudo systemctl enable iptables-restore.service
5560

61+
# Flush custom rules before the restore (so this script is idempotent)
62+
sudo /usr/sbin/iptables -F Firewall-INPUT
63+
5664
echo "Loading custom iptables firewall"
5765
sudo /sbin/iptables-restore --noflush /var/lib/iptables/rules-save
5866

docs/managing_deis/security_considerations.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ be exposed to the public are:
6666
For providers that do not supply a security group feature, please try
6767
`contrib/util/custom-firewall.sh`_.
6868

69+
.. note::
70+
If you need to add a new node to the cluster and you are using the custom firewall
71+
`contrib/util/custom-firewall.sh`_ you must allow the access to the cluster running
72+
the next command in each existing node:
73+
74+
.. code-block:: console
75+
76+
$ NEW_NODE="IP address" contrib/util/custom-firewall.sh
77+
6978
Router firewall
7079
---------------
7180
The :ref:`Router` component includes a firewall to help thwart attacks. It can be enabled by running:

0 commit comments

Comments
 (0)