fix set raw.dnsmasq breaks nftables
This commit is contained in:
+2
-29
@@ -64,7 +64,7 @@ function install() {
|
||||
lxc exec "$CONTAINER" -- bash <<EOF
|
||||
set -Eeuo pipefail
|
||||
apt-get update && apt-get dist-upgrade -y
|
||||
apt-get install -y nftables nginx ssl-cert libnginx-mod-http-subs-filter certbot python3-certbot-nginx
|
||||
apt-get install -y nginx ssl-cert libnginx-mod-http-subs-filter certbot python3-certbot-nginx
|
||||
|
||||
echo "registering with your default credential email <$credential_email>"
|
||||
certbot register --agree-tos --email $credential_email --no-eff-email || echo "already resgistered!"
|
||||
@@ -80,37 +80,10 @@ EOF
|
||||
echo "copying Nginx banner to container <$CONTAINER> ... "
|
||||
lxc file push --uid 0 --gid 0 "$MIAOU_BASEDIR/templates/nginx/snippets/banner_$TARGET.conf" "$CONTAINER/etc/nginx/snippets/banner_$TARGET.conf"
|
||||
lxc file push --uid 0 --gid 0 "$MIAOU_BASEDIR/templates/nginx/snippets/banner_exp.conf" "$CONTAINER/etc/nginx/snippets/banner_exp.conf"
|
||||
echo "copying files over container <$CONTAINER> ... OK"
|
||||
echo "copying files to container <$CONTAINER> ... OK"
|
||||
else
|
||||
echo "no Nginx banner on PROD!"
|
||||
fi
|
||||
|
||||
echo "populate nftables entries into yaml"
|
||||
local wan_interface dmz_ip
|
||||
wan_interface=$(ip route show default | cut -d ' ' -f5)
|
||||
dmz_ip=$(host "$CONTAINER.lxd" | cut -d ' ' -f4)
|
||||
yq ".nftables.wan_interface=\"$wan_interface\"" "$EXPANDED_CONF" -i
|
||||
yq ".nftables.dmz_ip=\"$dmz_ip\"" "$EXPANDED_CONF" -i
|
||||
|
||||
local nftables_reloading=false
|
||||
if [[ "$TARGET" != "dev" ]]; then
|
||||
mkdir -p "$MIAOU_CONFIGDIR/nftables.rules.d"
|
||||
echo "nat http/s port to dmz"
|
||||
tera -t "$MIAOU_BASEDIR/templates/nftables/nat.table.j2" "$EXPANDED_CONF" -o "$MIAOU_CONFIGDIR/nftables.rules.d/nat.table" &>/dev/null
|
||||
sudo cp "$MIAOU_CONFIGDIR/nftables.rules.d/nat.table" /etc/nftables.rules.d/nat.table
|
||||
nftables_reloading=true
|
||||
else
|
||||
if [[ -f /etc/nftables.rules.d/nat.table ]]; then
|
||||
sudo_required "remove previous nat.table"
|
||||
sudo rm -f /etc/nftables.rules.d/nat.table
|
||||
nftables_reloading=true
|
||||
fi
|
||||
fi
|
||||
if [[ "$nftables_reloading" == true ]]; then
|
||||
sudo_required "reload nftables"
|
||||
sudo systemctl reload nftables.service
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# MAIN
|
||||
|
||||
Reference in New Issue
Block a user