From 551efa0e13ad7465d58131d684f649908819ad06 Mon Sep 17 00:00:00 2001 From: z0rc Date: Wed, 11 Sep 2024 10:02:32 +0000 Subject: [PATCH] added ufw script for shared connections --- ufw_shared_ipv4.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 ufw_shared_ipv4.sh diff --git a/ufw_shared_ipv4.sh b/ufw_shared_ipv4.sh new file mode 100755 index 0000000..997d296 --- /dev/null +++ b/ufw_shared_ipv4.sh @@ -0,0 +1,19 @@ +#!/bin/bash + + +set -eEuxo pipefail + + +if (( ${#} != 1 )); then + echo "Usage: $(basename "${BASH_SOURCE[0]}") INTERFACE" >&2 + exit 1 +fi + +interface="${1}" +any_ipv4="0.0.0.0/0" +subnet="10.42.0.0/24" +gateway="10.42.0.1" + +ufw allow in on "${interface}" from "${any_ipv4}" port bootpc to "${any_ipv4}" port bootps +ufw allow in on "${interface}" from "${subnet}" to "${gateway}" port domain +ufw route allow in on "${interface}" from "${subnet}" to "${any_ipv4}"