mirror of
https://github.com/hassio-addons/addon-wireguard.git
synced 2025-05-04 19:01:31 +00:00
🔨 Improve post up/down disabling behavior for consistency
This commit is contained in:
parent
a349b8da3f
commit
eb8f4f15b1
2 changed files with 18 additions and 4 deletions
|
@ -198,8 +198,8 @@ Allows you to run commands after WireGuard has been started. This is useful
|
||||||
for modifying things like routing. If not provided, the add-on will by default
|
for modifying things like routing. If not provided, the add-on will by default
|
||||||
route all traffic coming in from the VPN through your home network.
|
route all traffic coming in from the VPN through your home network.
|
||||||
|
|
||||||
If you like to disable that, setting this option to `true` (yes, true), will
|
If you like to disable that, setting this option to `"off"`,
|
||||||
disable that behavior.
|
will disable that behavior.
|
||||||
|
|
||||||
By default it executes the following:
|
By default it executes the following:
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ Allows you to run commands after WireGuard has been stopped. This is useful
|
||||||
for modifying things like routing. If not provided, the add-on will by default
|
for modifying things like routing. If not provided, the add-on will by default
|
||||||
remove the default rules created by the `post_up` defaults.
|
remove the default rules created by the `post_up` defaults.
|
||||||
|
|
||||||
If you like to disable that, setting this option to `true` (yes, true), will
|
If you like to disable that, setting this option to `"off"`,
|
||||||
disable that behavior.
|
will disable that behavior.
|
||||||
|
|
||||||
By default it executes the following:
|
By default it executes the following:
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,14 @@ pre_down=$(bashio::config "server.pre_down")
|
||||||
pre_up=$(bashio::config "server.pre_up")
|
pre_up=$(bashio::config "server.pre_up")
|
||||||
table=$(bashio::config "server.table")
|
table=$(bashio::config "server.table")
|
||||||
|
|
||||||
|
# Pre Up & Down handling
|
||||||
|
if [[ "${pre_up}" = "off" ]]; then
|
||||||
|
pre_up=""
|
||||||
|
fi
|
||||||
|
if [[ "${pre_down}" = "off" ]]; then
|
||||||
|
pre_down=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Post Up & Down defaults
|
# Post Up & Down defaults
|
||||||
post_up="iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE"
|
post_up="iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE"
|
||||||
post_down="iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE"
|
post_down="iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE"
|
||||||
|
@ -112,11 +120,17 @@ fi
|
||||||
# Load custom PostUp setting if provided
|
# Load custom PostUp setting if provided
|
||||||
if bashio::config.has_value 'server.post_up'; then
|
if bashio::config.has_value 'server.post_up'; then
|
||||||
post_up=$(bashio::config 'server.post_up')
|
post_up=$(bashio::config 'server.post_up')
|
||||||
|
if [[ "${post_up}" = "off" ]]; then
|
||||||
|
post_up=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load custom PostDown setting if provided
|
# Load custom PostDown setting if provided
|
||||||
if bashio::config.has_value 'server.post_down'; then
|
if bashio::config.has_value 'server.post_down'; then
|
||||||
post_down=$(bashio::config 'server.post_down')
|
post_down=$(bashio::config 'server.post_down')
|
||||||
|
if [[ "${post_down}" = "off" ]]; then
|
||||||
|
post_down=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Finish up the main server configuration
|
# Finish up the main server configuration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue