##// END OF EJS Templates
Merge branch 'vknecht-master'
Merge branch 'vknecht-master'

Fichier de la dernière révision:

r67:4aa8ac698568
r69:da643e7838f2 Fusion
Show More
21-firewall.sh
44 lines | 1.4 KiB | application/x-sh | BashLexer
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 #
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 # Setup Firewall
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 #
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 # Load utility functions
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 . ./functions.sh
if [ "$ENABLE_IPTABLES" = true ] ; then
# Create iptables configuration directory
mkdir -p "$R/etc/iptables"
# Create iptables systemd service
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_readonly files/iptables/iptables.service $R/etc/systemd/system/iptables.service
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
# Create flush-table script called by iptables service
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_exec files/iptables/flush-iptables.sh $R/etc/iptables/flush-iptables.sh
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
# Create iptables rule file
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_readonly files/iptables/iptables.rules $R/etc/iptables/iptables.rules
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
# Reload systemd configuration and enable iptables service
chroot_exec systemctl daemon-reload
chroot_exec systemctl enable iptables.service
if [ "$ENABLE_IPV6" = true ] ; then
# Create ip6tables systemd service
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_readonly files/iptables/ip6tables.service $R/etc/systemd/system/ip6tables.service
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
# Create ip6tables file
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_exec files/iptables/flush-ip6tables.sh $R/etc/iptables/flush-ip6tables.sh
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 install_readonly files/iptables/ip6tables.rules $R/etc/iptables/ip6tables.rules
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
# Reload systemd configuration and enable iptables service
chroot_exec systemctl daemon-reload
chroot_exec systemctl enable ip6tables.service
fi
fi
# Remove SSHD related iptables rules
if [ "$ENABLE_SSHD" = false ] ; then
sed -e '/^#/! {/SSH/ s/^/# /}' -i $R/etc/iptables/iptables.rules 2> /dev/null
sed -e '/^#/! {/SSH/ s/^/# /}' -i $R/etc/iptables/ip6tables.rules 2> /dev/null
fi