From fe2e986534430ed155c629fa4e0551857d8985bb Mon Sep 17 00:00:00 2001 From: finn Date: Mon, 21 Sep 2026 00:51:03 -0700 Subject: [PATCH] add firewall --- create-linode.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/create-linode.sh b/create-linode.sh index a41f3ca..bc85abc 100755 --- a/create-linode.sh +++ b/create-linode.sh @@ -13,8 +13,6 @@ source .env #ROOT_PASS="StartRootPass5678" SCRIPT_ACTION=$1 LINODE_LABEL=$2 -# oily 2111036 -WHICH_DOMAIN="2111036" LOGFILE="./linodes.log" # Pre-existing Valheim volume, attached to every Linode at creation time. @@ -24,11 +22,15 @@ VOLUME_NAME="ValVol202609" VOLUME_DEVICE="/dev/disk/by-id/scsi-0Linode_Volume_$VOLUME_NAME" VOLUME_MOUNT="/mnt/$VOLUME_NAME" +# Cloud Firewall applied to every Linode at creation time. It must allow the +# Valheim ports (2456-2457/udp) and, if you still need SSH, port 22. +FIREWALL_ID="165767433" + # StackScript that mounts the volume on first boot (see stackscript.md). # Enter the numeric StackScript ID manually after creating it in the Linode UI. #STACKSCRIPT_ID="2225110" # Normal: -STACKSCRIPT_ID="2225140" +#STACKSCRIPT_ID="2225140" # More resources (1.5): STACKSCRIPT_ID="2225166" @@ -65,7 +67,8 @@ if [[ "$SCRIPT_ACTION" == "c" ]]; then "image": "'$INSTANCE_IMAGE'", "root_pass": "'$ROOT_PASS'", "authorized_users": ["ni7ne_midpriv"], - "stackscript_id": '$STACKSCRIPT_ID' + "stackscript_id": '$STACKSCRIPT_ID', + "firewall_id": '$FIREWALL_ID' }' \ https://api.linode.com/v4/linode/instances | jq . @@ -173,8 +176,10 @@ if [[ "$SCRIPT_ACTION" == "a" ]]; then DOMAIN_RECORDS=$(curl -s -H "Authorization: Bearer $LINODE_API_KEY" \ https://api.linode.com/v4/domains/$WHICH_DOMAIN/records) + # Only A records are managed by this action, so filter out the rest + # (CNAME, MX, TXT, ...) when showing the current state. echo "Previous value:" - echo "$DOMAIN_RECORDS" | jq . + echo "$DOMAIN_RECORDS" | jq '.data[] | select(.type == "A")' sleep 3