1
0
forked from finn/tinyboard

onboard-spoke.sh: remove comment syntax from manual key instructions

setup-spoke.sh, setup-network.sh: fix check_permissions false alarm on pubkeys, TUNNEL_UP boolean comparison, DNS_YAML trailing newline, backup file guard
This commit is contained in:
Justin Oros
2026-04-18 14:07:02 -07:00
parent 74e1a9d1a0
commit d925cd944a
3 changed files with 13 additions and 9 deletions

View File

@@ -105,8 +105,8 @@ else
warn "Manually append the hub public key to the spoke's authorized_keys:" warn "Manually append the hub public key to the spoke's authorized_keys:"
echo "" echo ""
echo " cat $KEY_PATH.pub" echo " cat $KEY_PATH.pub"
echo " # Then on the spoke, append the output to:" echo " Then on the spoke, append the output to:"
echo " # /home/$SPOKE_USER/.ssh/authorized_keys" echo " /home/$SPOKE_USER/.ssh/authorized_keys"
echo "" echo ""
read -rp "Press ENTER once the key has been added to the spoke..." read -rp "Press ENTER once the key has been added to the spoke..."
fi fi

View File

@@ -78,7 +78,10 @@ DNS_YAML=""
IFS=',' read -ra DNS_LIST <<< "$DNS_INPUT" IFS=',' read -ra DNS_LIST <<< "$DNS_INPUT"
for DNS in "${DNS_LIST[@]}"; do for DNS in "${DNS_LIST[@]}"; do
DNS=$(echo "$DNS" | tr -d ' ') DNS=$(echo "$DNS" | tr -d ' ')
DNS_YAML="${DNS_YAML} - ${DNS}"$'\n' if [ -n "$DNS_YAML" ]; then
DNS_YAML="${DNS_YAML}"$'\n'
fi
DNS_YAML="${DNS_YAML} - ${DNS}"
done done
info "Current netplan configs:" info "Current netplan configs:"
@@ -140,7 +143,8 @@ network:
via: ${GATEWAY} via: ${GATEWAY}
nameservers: nameservers:
addresses: addresses:
${DNS_YAML} access-points: ${DNS_YAML}
access-points:
"${WIFI_SSID}": "${WIFI_SSID}":
password: "${WIFI_PASS}" password: "${WIFI_PASS}"
NETEOF NETEOF
@@ -182,7 +186,7 @@ if $CONNECTED; then
info "Network connectivity confirmed — config applied permanently." info "Network connectivity confirmed — config applied permanently."
else else
warn "No network connectivity detected after 30 seconds — reverting to backup config." warn "No network connectivity detected after 30 seconds — reverting to backup config."
if [ -f "$BACKUP_FILE" ]; then if [ -n "$BACKUP_FILE" ] && [ -f "$BACKUP_FILE" ]; then
cp "$BACKUP_FILE" "$NETPLAN_FILE" cp "$BACKUP_FILE" "$NETPLAN_FILE"
netplan apply netplan apply
die "Config reverted to backup. Check your settings and try again." die "Config reverted to backup. Check your settings and try again."

View File

@@ -68,7 +68,7 @@ check_permissions() {
fi fi
local world="${perms: -1}" local world="${perms: -1}"
local group="${perms: -2:1}" local group="${perms: -2:1}"
if [ "$world" != "0" ] || [ "$group" != "0" ]; then if [ "$world" != "0" ]; then
warn "UNSAFE PERMISSIONS on $label ($file): $perms — should be 600 or 400" warn "UNSAFE PERMISSIONS on $label ($file): $perms — should be 600 or 400"
warn "Fixing permissions automatically..." warn "Fixing permissions automatically..."
chmod 600 "$file" chmod 600 "$file"
@@ -340,7 +340,7 @@ docker build \
-t spoke-autossh . -t spoke-autossh .
header "Starting Containers" header "Starting Containers"
TUNNEL_UP=false TUNNEL_UP="false"
for ATTEMPT in 1 2 3; do for ATTEMPT in 1 2 3; do
docker compose up -d docker compose up -d
info "Waiting for tunnel to establish..." info "Waiting for tunnel to establish..."
@@ -359,12 +359,12 @@ for ATTEMPT in 1 2 3; do
warn "Next port also in use. Waiting before retry..." warn "Next port also in use. Waiting before retry..."
fi fi
else else
TUNNEL_UP=true TUNNEL_UP="true"
break break
fi fi
done done
if $TUNNEL_UP; then if [ "$TUNNEL_UP" = "true" ]; then
info "Tunnel is up on port $TUNNEL_PORT." info "Tunnel is up on port $TUNNEL_PORT."
else else
die "Tunnel failed after 3 attempts. Run: docker compose down && docker compose up -d" die "Tunnel failed after 3 attempts. Run: docker compose down && docker compose up -d"