LoxiLB: enable firewall SNAT for green network

when loxilb is enabled and started, enable the
firewall SNAT for green network so green network
could have initiate outgoing traffic like internet
access.

we can achieve this by restoring firewall SNAT setting
from default /var/ipfire/loxilb/FWconfig.txt when loxilb
start up with --config-path=/var/ipfire/loxilb thanks
to the enhancement addressed in issue:

https://github.com/loxilb-io/loxilb/issues/706

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
Vincent Li
2024-07-06 23:27:54 +00:00
parent 9f7cd8358f
commit 02724e7427
3 changed files with 9 additions and 1 deletions

View File

@@ -37,13 +37,19 @@ case "$1" in
mkdir -p /opt/loxilb/dp/
mount -t bpf bpf /opt/loxilb/dp/
loadproc -b loxilb --blacklist="eth[0-9]"
#enable egress firewall SNAT for green network
redip=$(< /var/ipfire/red/local-ipaddress)
sed -i "s/\"REDIP\"/\"$redip\"/" /var/ipfire/loxilb/FWconfig.txt
loadproc -b loxilb --config-path="/var/ipfire/loxilb/" --blacklist="eth[0-9]"
fi
;;
stop)
boot_mesg "Stopping loxilb..."
if [ "$ENABLE_LOXILB" == "off" ]; then
#remove egress firewall SNAT for green network
loxicmd delete firewall --firewallRule="portName:green0"
killproc loxilb
fi
;;