|
@ -173,19 +173,17 @@ function build_routes() { |
|
|
for i in "${fqdns[@]}"; do |
|
|
for i in "${fqdns[@]}"; do |
|
|
raw_dnsmasq+="address=/$i/$DMZ_IP\\n" |
|
|
raw_dnsmasq+="address=/$i/$DMZ_IP\\n" |
|
|
# append domains to conf |
|
|
# append domains to conf |
|
|
echo "re-routing any connection from <$i> to internal container <$DMZ_CONTAINER.lxd>" |
|
|
|
|
|
|
|
|
echo "re-routing any connection from https://$i to internal container <$DMZ_CONTAINER.lxd>" |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|
builtin echo -e "$raw_dnsmasq" >"$MIAOU_CONFIGDIR/dnsmasq/raw.new" |
|
|
builtin echo -e "$raw_dnsmasq" >"$MIAOU_CONFIGDIR/dnsmasq/raw.new" |
|
|
lxc network get $BRIDGE raw.dnsmasq | head -n-1 >"$MIAOU_CONFIGDIR/dnsmasq/raw.old" |
|
|
lxc network get $BRIDGE raw.dnsmasq | head -n-1 >"$MIAOU_CONFIGDIR/dnsmasq/raw.old" |
|
|
|
|
|
|
|
|
if ! diff -q "$MIAOU_CONFIGDIR/dnsmasq/raw.old" "$MIAOU_CONFIGDIR/dnsmasq/raw.new"; then |
|
|
|
|
|
echo "reload dnsmasq" |
|
|
|
|
|
|
|
|
if ! diff -q "$MIAOU_CONFIGDIR/dnsmasq/raw.old" "$MIAOU_CONFIGDIR/dnsmasq/raw.new" &>/dev/null; then |
|
|
|
|
|
echo -n "new routes detected, reloading dnsmasq + nftables..." |
|
|
builtin echo -e "$raw_dnsmasq" | lxc network set $BRIDGE raw.dnsmasq - |
|
|
builtin echo -e "$raw_dnsmasq" | lxc network set $BRIDGE raw.dnsmasq - |
|
|
echo "reload nftables" |
|
|
|
|
|
sudo systemctl reload nftables.service |
|
|
sudo systemctl reload nftables.service |
|
|
else |
|
|
|
|
|
echo "no changes" |
|
|
|
|
|
|
|
|
PREFIX="" echoinfo OK |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -322,7 +320,7 @@ function build_monit() { |
|
|
|
|
|
|
|
|
if ! curl_check_unsecure "https://$fqdn"; then |
|
|
if ! curl_check_unsecure "https://$fqdn"; then |
|
|
PREFIX='' echo |
|
|
PREFIX='' echo |
|
|
echoerr "DMZ does not seem to dispatch <https://$fqdn> please review DMZ Nginx proxy" |
|
|
|
|
|
|
|
|
echoerr "DMZ does not seem to dispatch https://$fqdn please review DMZ Nginx proxy" |
|
|
exit 3 |
|
|
exit 3 |
|
|
elif [[ "$target" != 'dev' ]] && ! curl_check "https://$fqdn"; then |
|
|
elif [[ "$target" != 'dev' ]] && ! curl_check "https://$fqdn"; then |
|
|
PREFIX='' echo |
|
|
PREFIX='' echo |
|
@ -532,7 +530,7 @@ readonly CONF="/etc/miaou/miaou.yaml" |
|
|
readonly DEFAULTS="/etc/miaou/defaults.yaml" |
|
|
readonly DEFAULTS="/etc/miaou/defaults.yaml" |
|
|
readonly EXPANDED_CONF="$MIAOU_CONFIGDIR/miaou.expanded.yaml" |
|
|
readonly EXPANDED_CONF="$MIAOU_CONFIGDIR/miaou.expanded.yaml" |
|
|
readonly BRIDGE="lxdbr0" |
|
|
readonly BRIDGE="lxdbr0" |
|
|
readonly MAX_WAIT=3 # timeout in seconds |
|
|
|
|
|
|
|
|
readonly MAX_WAIT=5 # timeout in seconds |
|
|
|
|
|
|
|
|
# shellcheck disable=SC2034 |
|
|
# shellcheck disable=SC2034 |
|
|
declare -a options=("$@") |
|
|
declare -a options=("$@") |
|
|