##// END OF EJS Templates
a
Unknown -
r484:31ba8b1e2e39
parent child
Show More
@@ -1,48 +1,51
1 1 #
2 2 # Setup Firewall
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 if [ "$ENABLE_IPTABLES" = true ] ; then
9 9 # Create iptables configuration directory
10 10 mkdir -p "${ETC_DIR}/iptables"
11 11
12 12 # make sure iptables-legacy is the used alternatives
13 13 #iptables-save and -restore are slaves of iptables and thus are set accordingly
14 14 chroot_exec update-alternatives --verbose --set iptables /usr/sbin/iptables-legacy
15 15
16 16 # Install iptables systemd service
17 17 install_readonly files/iptables/iptables.service "${ETC_DIR}/systemd/system/iptables.service"
18 18
19 19 # Install flush-table script called by iptables service
20 20 install_exec files/iptables/flush-iptables.sh "${ETC_DIR}/iptables/flush-iptables.sh"
21 21
22 22 # Install iptables rule file
23 23 install_readonly files/iptables/iptables.rules "${ETC_DIR}/iptables/iptables.rules"
24 24
25 25 # Reload systemd configuration and enable iptables service
26 26 chroot_exec systemctl daemon-reload
27 27 chroot_exec systemctl enable iptables.service
28 28
29 29 if [ "$ENABLE_IPV6" = true ] ; then
30 # make sure ip6tables-legacy is the used alternatives
31 chroot_exec update-alternatives --verbose --set ip6tables /usr/sbin/ip6tables-legacy
32
30 33 # Install ip6tables systemd service
31 34 install_readonly files/iptables/ip6tables.service "${ETC_DIR}/systemd/system/ip6tables.service"
32 35
33 36 # Install ip6tables file
34 37 install_exec files/iptables/flush-ip6tables.sh "${ETC_DIR}/iptables/flush-ip6tables.sh"
35 38
36 39 install_readonly files/iptables/ip6tables.rules "${ETC_DIR}/iptables/ip6tables.rules"
37 40
38 41 # Reload systemd configuration and enable iptables service
39 42 chroot_exec systemctl daemon-reload
40 43 chroot_exec systemctl enable ip6tables.service
41 44 fi
42 45
43 46 if [ "$ENABLE_SSHD" = false ] ; then
44 47 # Remove SSHD related iptables rules
45 48 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETC_DIR}/iptables/iptables.rules" 2> /dev/null
46 49 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETC_DIR}/iptables/ip6tables.rules" 2> /dev/null
47 50 fi
48 51 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant