Skip to content

Commit 55dca6c

Browse files
committedDec 11, 2015
Adds MAAS ufw config script
1 parent c0fb7ef commit 55dca6c

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
 

‎set_maas_ufw.sh

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
set -e
3+
4+
MAAS_ADMIN_IFACE=eth0
5+
MAAS_NODES_IFACE=eth1
6+
7+
sudo apt-get install ufw -y
8+
9+
# optionally, if you want to start with a clean config:
10+
# sudo ufw --force reset
11+
12+
sudo ufw --force enable
13+
14+
# At the end of /etc/ufw/before.rules
15+
16+
# Replace the last COMMIT line with the following content,
17+
# matching your IP range and interfaces:
18+
19+
#-A ufw-before-forward -i eth1 -o eth0 -j ACCEPT
20+
#
21+
#COMMIT
22+
#
23+
## nat Table rules
24+
#*nat
25+
#:POSTROUTING ACCEPT [0:0]
26+
#
27+
#-A POSTROUTING -s 10.41.41.0/24 -o eth0 -j MASQUERADE
28+
#
29+
# don't delete the 'COMMIT' line or these rules won't be processed
30+
#COMMIT
31+
32+
# Edit /etc/ufw/sysctl.conf and set:
33+
#net/ipv4/ip_forward=1
34+
#net/ipv6/conf/default/forwarding=1
35+
#net/ipv6/conf/all/forwarding=1
36+
37+
sudo ufw default deny incoming
38+
sudo ufw default allow outgoing
39+
40+
# SSH
41+
sudo ufw allow in on $MAAS_ADMIN_IFACE proto tcp from any to any port 22
42+
43+
44+
# DHCP
45+
sudo ufw allow in on $MAAS_NODES_IFACE proto udp from any to any port 67
46+
47+
# DNS
48+
sudo ufw allow in on $MAAS_NODES_IFACE proto udp from any to any port 53
49+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 53
50+
51+
# TFTP
52+
sudo ufw allow in on $MAAS_NODES_IFACE proto udp from any to any port 69
53+
54+
# iSCSI target
55+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 3260
56+
57+
# Squid
58+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 3128
59+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 8000
60+
61+
# MaaS UI
62+
sudo ufw allow in on $MAAS_ADMIN_IFACE proto tcp from any to any port 80
63+
64+
# From region controller to cluster controllers
65+
sudo ufw allow in on $MAAS_ADMIN_IFACE proto tcp from any to any port 7911
66+
67+
# PostgreSQL, enable for replication
68+
sudo ufw allow in on $MAAS_ADMIN_IFACE proto tcp from any to any port 5432
69+
70+
# MaaS Twister
71+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5240
72+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5248
73+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5250
74+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5251
75+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5252
76+
sudo ufw allow in on $MAAS_NODES_IFACE proto tcp from any to any port 5253
77+
78+
# Restart firewall
79+
sudo service ufw restart
80+

0 commit comments

Comments
 (0)