Reengineed the code. Generalized the package. Cloud configurators are modules.

This commit is contained in:
2026-08-10 09:02:45 +02:00
parent be4bb34bb0
commit 083ad9a596
40 changed files with 2367 additions and 650 deletions
+49
View File
@@ -0,0 +1,49 @@
#!/bin/sh
set -e
BEFORE_RULES=/etc/ufw/before.rules
# Remove the rule blocks this package inserted, together with the single blank
# line that precedes each one, so before.rules returns to its original content.
strip_ufw_blocks() {
[ -f "$BEFORE_RULES" ] || return 0
grep -q '^# ROUTER MSS RULES START$\|^# IPSEC RULES START$' "$BEFORE_RULES" || return 0
tmp="$(mktemp)"
awk '
/^# (IPSEC|WIREGUARD|P2S DNS|ROUTER FORWARD|ROUTER NAT|ROUTER MSS) RULES START$/ {
skip = 1; pending = 0; next
}
/^# (IPSEC|WIREGUARD|P2S DNS|ROUTER FORWARD|ROUTER NAT|ROUTER MSS) RULES END$/ {
skip = 0; next
}
skip { next }
/^$/ { pending++; next }
{
while (pending > 0) { print ""; pending-- }
print
}
END { while (pending > 0) { print ""; pending-- } }
' "$BEFORE_RULES" > "$tmp"
cat "$tmp" > "$BEFORE_RULES"
rm -f "$tmp"
}
case "$1" in
purge)
strip_ufw_blocks
rm -f /etc/swanctl/conf.d/remote-site.conf \
/etc/swanctl/conf.d/road-warrior.conf \
/etc/systemd/resolved.conf.d/p2s-forwarder.conf \
/etc/wireguard/wg0.conf \
/etc/vpn-router/vpn-router.conf
# Key material is not package state: /etc/vpn-router/pki, the WireGuard
# key pair and everything under /etc/swanctl are left in place.
rmdir --ignore-fail-on-non-empty /etc/vpn-router 2>/dev/null || true
;;
esac
#DEBHELPER#