From 5c42f3583928f4d609c4e2e6bbafee398745c332 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 16 Jul 2025 16:46:35 -0700 Subject: [PATCH] Install and enable ufw firewall by default Gotta be safe out there! --- install/firewall.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 install/firewall.sh diff --git a/install/firewall.sh b/install/firewall.sh new file mode 100644 index 0000000..d8a92ab --- /dev/null +++ b/install/firewall.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if ! command -v ufw &>/dev/null; then + yay -Sy --noconfirm --needed ufw ufw-docker + + # Allow nothing in, everything out + sudo ufw default deny incoming + sudo ufw default allow outgoing + + # Allow ports for LocalSend + sudo ufw allow 53317/udp + sudo ufw allow 53317/tcp + + # Allow SSH in + sudo ufw allow 22/tcp + + # Allow Docker containers to use DNS on host + sudo ufw allow in on docker0 to any port 53 + + # Turn on the firewall + sudo ufw enable + sudo ufw reload +fi