LocalAI/scripts/firewall-ufw.sh
2026-10-15 00:01:26 +02:00

13 lines
474 B
Bash
Executable File

#!/usr/bin/env bash
# Einmalig ausführen: sudo ./scripts/firewall-ufw.sh
# Öffnet den Caddy-Port nur für LAN und NetBird (wt0). Caddy filtert zusätzlich selbst.
set -euo pipefail
PORT="${LISTEN_PORT:-8800}"
LAN="${LAN_NET:-192.168.178.0/24}"
VPN_IF="${VPN_IF:-wt0}"
ufw allow from "$LAN" to any port "$PORT" proto tcp comment 'localai LAN'
ufw allow in on "$VPN_IF" to any port "$PORT" proto tcp comment 'localai NetBird'
ufw status numbered | grep -E "$PORT" || true