install.sh: ufw låst til NetBird (wt0) når det finnes
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
ad1715838e
commit
775ab6d075
2 changed files with 15 additions and 2 deletions
13
install.sh
13
install.sh
|
|
@ -81,7 +81,18 @@ systemctl --user enable --now sg-announcer
|
|||
systemctl --user restart sg-announcer
|
||||
|
||||
step "Brannmur"
|
||||
if sudo ufw status 2>/dev/null | grep -q "Status: active"; then
|
||||
if ip link show wt0 >/dev/null 2>&1; then
|
||||
# NetBird er installert: slipp inn kun via VPN-grensesnittet, blokker alt annet.
|
||||
sudo ufw default deny incoming
|
||||
sudo ufw default allow outgoing
|
||||
sudo ufw allow in on wt0 to any port 22 proto tcp comment "ssh via netbird"
|
||||
sudo ufw allow in on wt0 to any port "$PORT" proto tcp comment "sg-announcer via netbird"
|
||||
sudo ufw delete allow "$PORT/tcp" >/dev/null 2>&1 || true
|
||||
sudo ufw --force enable
|
||||
echo "ufw aktiv: port $PORT og 22 er åpne kun på wt0 (NetBird)."
|
||||
echo "Vil du også nå sida fra lokalt LAN uten VPN:"
|
||||
echo " sudo ufw allow from <lan-subnett> to any port $PORT proto tcp"
|
||||
elif sudo ufw status 2>/dev/null | grep -q "Status: active"; then
|
||||
sudo ufw allow "$PORT/tcp" comment "sg-announcer"
|
||||
else
|
||||
echo "ufw er ikke aktiv, ingen regel nødvendig."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue