Skip to content

Commit 695144e

Browse files
committed
[Firewall] restore ipset config during startup, before restoring iptables rules
1 parent 4b1efc8 commit 695144e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

bin/v-update-firewall

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ else
179179
IFS='%'
180180
echo '#!/bin/bash' > $preup
181181
echo '' >> $preup
182+
echo "${HESTIA}/bin/v-update-firewall-ipset" >> $preup
183+
echo '' >> $preup
182184
echo 'if [ "$IFACE" == "'$(/bin/ip token | awk -F 'dev ' '{print $2}')'" ]; then' >> $preup
183185
echo ' sleep 3' >> $preup
184186
echo ' /sbin/iptables-restore < /etc/iptables.rules' >> $preup
@@ -190,6 +192,7 @@ else
190192
preup="/etc/network/if-pre-up.d/iptables"
191193
if [ ! -e "$preup" ]; then
192194
echo '#!/bin/sh' > $preup
195+
echo '${HESTIA}/bin/v-update-firewall-ipset' >> $preup
193196
echo "/sbin/iptables-restore < /etc/iptables.rules" >> $preup
194197
echo "exit 0" >> $preup
195198
chmod +x $preup

bin/v-update-firewall-ipset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
force=${1:-no}
1414

1515
# Includes
16+
source /etc/profile.d/hestia.sh
1617
source $HESTIA/func/main.sh
1718
source $HESTIA/conf/hestia.conf
1819

install/upgrade/versions/latest.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,14 @@ if [ -d /usr/share/roundcube ]; then
3838
sed -i 's/implode($fields, \x27,\x27)/implode(\x27,\x27, $fields)/g' /usr/share/roundcube/program/steps/addressbook/search.inc
3939
sed -i 's/implode($bstyle, \x27; \x27)/implode(\x27; \x27, $bstyle)/g' /usr/share/roundcube/program/steps/mail/sendmail.inc
4040
fi
41+
42+
# Remove existing network-up hooks so they get regenerated when updating the firewall
43+
# - network hook will also restore ipset config during start-up
44+
if [ -f "/usr/lib/networkd-dispatcher/routable.d/50-ifup-hooks" ]; then
45+
rm "/usr/lib/networkd-dispatcher/routable.d/50-ifup-hooks"
46+
$BIN/v-update-firewall
47+
fi
48+
if [ -f "/etc/network/if-pre-up.d/iptables" ];then
49+
rm "/etc/network/if-pre-up.d/iptables"
50+
$BIN/v-update-firewall
51+
fi

0 commit comments

Comments
 (0)