Fix shell formatting

This commit is contained in:
Stanislas Lange
2026-08-02 14:07:28 +02:00
parent 1a0fa9c9b0
commit 3274915ac7
2 changed files with 175 additions and 175 deletions
+4 -4
View File
@@ -636,7 +636,7 @@ is_valid_ipv4_cidr() {
else else
mask=$(((0xFFFFFFFF << (32 - prefix)) & 0xFFFFFFFF)) mask=$(((0xFFFFFFFF << (32 - prefix)) & 0xFFFFFFFF))
fi fi
(( (ip & mask) == ip )) (((ip & mask) == ip))
} }
expand_ipv6_address() { expand_ipv6_address() {
@@ -698,7 +698,7 @@ is_valid_ipv6_cidr() {
((hextets[index] == 0)) || return 1 ((hextets[index] == 0)) || return 1
else else
host_mask=$(((1 << (16 - remaining)) - 1)) host_mask=$(((1 << (16 - remaining)) - 1))
(( (hextets[index] & host_mask) == 0 )) || return 1 (((hextets[index] & host_mask) == 0)) || return 1
remaining=0 remaining=0
fi fi
done done
@@ -772,7 +772,7 @@ ipv4_cidrs_overlap() {
mask=$(((0xFFFFFFFF << (32 - prefix)) & 0xFFFFFFFF)) mask=$(((0xFFFFFFFF << (32 - prefix)) & 0xFFFFFFFF))
local first_ip=$(((10#${first_octets[0]} << 24) | (10#${first_octets[1]} << 16) | (10#${first_octets[2]} << 8) | 10#${first_octets[3]})) local first_ip=$(((10#${first_octets[0]} << 24) | (10#${first_octets[1]} << 16) | (10#${first_octets[2]} << 8) | 10#${first_octets[3]}))
local second_ip=$(((10#${second_octets[0]} << 24) | (10#${second_octets[1]} << 16) | (10#${second_octets[2]} << 8) | 10#${second_octets[3]})) local second_ip=$(((10#${second_octets[0]} << 24) | (10#${second_octets[1]} << 16) | (10#${second_octets[2]} << 8) | 10#${second_octets[3]}))
(( (first_ip & mask) == (second_ip & mask) )) (((first_ip & mask) == (second_ip & mask)))
} }
ipv6_cidrs_overlap() { ipv6_cidrs_overlap() {
@@ -793,7 +793,7 @@ ipv6_cidrs_overlap() {
remaining=$((remaining - 16)) remaining=$((remaining - 16))
else else
mask=$(((0xFFFF << (16 - remaining)) & 0xFFFF)) mask=$(((0xFFFF << (16 - remaining)) & 0xFFFF))
(( (first_hextets[index] & mask) == (second_hextets[index] & mask) )) (((first_hextets[index] & mask) == (second_hextets[index] & mask)))
return return
fi fi
done done
+18 -18
View File
@@ -693,7 +693,7 @@ echo "Post-renewal client tests passed"
if [ "$ROUTE_INTERNET" = "y" ]; then if [ "$ROUTE_INTERNET" = "y" ]; then
echo "=== Verifying Unbound DNS Resolver ===" echo "=== Verifying Unbound DNS Resolver ==="
if [ -f /etc/unbound/unbound.conf ]; then if [ -f /etc/unbound/unbound.conf ]; then
# Verify Unbound is running (started by systemctl in install script) # Verify Unbound is running (started by systemctl in install script)
echo "Checking Unbound service status..." echo "Checking Unbound service status..."
for _ in $(seq 1 30); do for _ in $(seq 1 30); do
@@ -709,43 +709,43 @@ if [ -f /etc/unbound/unbound.conf ]; then
journalctl -u unbound --no-pager -n 50 2>&1 || true journalctl -u unbound --no-pager -n 50 2>&1 || true
exit 1 exit 1
fi fi
else else
echo "FAIL: /etc/unbound/unbound.conf not found" echo "FAIL: /etc/unbound/unbound.conf not found"
exit 1 exit 1
fi fi
echo "" echo ""
echo "=== Verifying Unbound Installation ===" echo "=== Verifying Unbound Installation ==="
# Verify Unbound config exists in conf.d directory # Verify Unbound config exists in conf.d directory
UNBOUND_OPENVPN_CONF="/etc/unbound/unbound.conf.d/openvpn.conf" UNBOUND_OPENVPN_CONF="/etc/unbound/unbound.conf.d/openvpn.conf"
if [ -f "$UNBOUND_OPENVPN_CONF" ]; then if [ -f "$UNBOUND_OPENVPN_CONF" ]; then
echo "PASS: Found Unbound config at $UNBOUND_OPENVPN_CONF" echo "PASS: Found Unbound config at $UNBOUND_OPENVPN_CONF"
else else
echo "FAIL: OpenVPN Unbound config not found at $UNBOUND_OPENVPN_CONF" echo "FAIL: OpenVPN Unbound config not found at $UNBOUND_OPENVPN_CONF"
echo "Contents of /etc/unbound/:" echo "Contents of /etc/unbound/:"
ls -la /etc/unbound/ ls -la /etc/unbound/
ls -la /etc/unbound/unbound.conf.d/ 2>/dev/null || true ls -la /etc/unbound/unbound.conf.d/ 2>/dev/null || true
exit 1 exit 1
fi fi
# Verify Unbound listens on VPN gateway # Verify Unbound listens on VPN gateway
if grep -q "interface: $VPN_GATEWAY" "$UNBOUND_OPENVPN_CONF"; then if grep -q "interface: $VPN_GATEWAY" "$UNBOUND_OPENVPN_CONF"; then
echo "PASS: Unbound configured to listen on $VPN_GATEWAY" echo "PASS: Unbound configured to listen on $VPN_GATEWAY"
else else
echo "FAIL: Unbound not configured for $VPN_GATEWAY" echo "FAIL: Unbound not configured for $VPN_GATEWAY"
cat "$UNBOUND_OPENVPN_CONF" cat "$UNBOUND_OPENVPN_CONF"
exit 1 exit 1
fi fi
# Verify OpenVPN pushes correct DNS # Verify OpenVPN pushes correct DNS
if grep -q "push \"dhcp-option DNS $VPN_GATEWAY\"" /etc/openvpn/server/server.conf; then if grep -q "push \"dhcp-option DNS $VPN_GATEWAY\"" /etc/openvpn/server/server.conf; then
echo "PASS: OpenVPN configured to push Unbound DNS" echo "PASS: OpenVPN configured to push Unbound DNS"
else else
echo "FAIL: OpenVPN not configured to push Unbound DNS" echo "FAIL: OpenVPN not configured to push Unbound DNS"
grep "dhcp-option DNS" /etc/openvpn/server/server.conf || echo "No DNS push found" grep "dhcp-option DNS" /etc/openvpn/server/server.conf || echo "No DNS push found"
exit 1 exit 1
fi fi
echo "=== Unbound Installation Verified ===" echo "=== Unbound Installation Verified ==="
echo "" echo ""