add firewall

This commit is contained in:
2026-09-21 00:51:03 -07:00
parent 16c122c84b
commit fe2e986534
+10 -5
View File
@@ -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