scripts/refresh-*: StrictHostKeyChecking=accept-new on first connect
BatchMode=yes (which the scripts set) implies strict host key checking and refuses to prompt — so first-time SSH to a host that isn't in known_hosts fails with "Host key verification failed". Every new host we register needs a manual `ssh <host>` round-trip first to store the key before the refresh scripts can reach it. accept-new fixes that: unknown hosts are auto-accepted into known_hosts on first connect; subsequent key CHANGES still fail loudly (as they should — that'd be a MITM signal). Matches the pattern already used by deploy-stack.sh. Affects only refresh-server-info.sh and refresh-proxmox-info.sh; deploy-stack.sh + sync-stacks.sh use their own targets that may or may not want the same treatment (leaving alone for now).
This commit is contained in:
@@ -233,7 +233,7 @@ for host in "${HOSTS[@]}"; do
|
||||
|
||||
mkdir -p "$SERVERS_DIR/$host"
|
||||
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=10 "$target" 'bash -s' < "$INSPECT" > "$tmp" 2> "$tmp.err"; then
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "$target" 'bash -s' < "$INSPECT" > "$tmp" 2> "$tmp.err"; then
|
||||
mv "$tmp" "$out"
|
||||
rm -f "$tmp.err"
|
||||
bytes=$(wc -c < "$out")
|
||||
|
||||
@@ -240,7 +240,7 @@ for host in "${HOSTS[@]}"; do
|
||||
|
||||
mkdir -p "$SERVERS_DIR/$host"
|
||||
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=10 "$target" 'bash -s' < "$INSPECT" > "$tmp" 2> "$tmp.err"; then
|
||||
if ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "$target" 'bash -s' < "$INSPECT" > "$tmp" 2> "$tmp.err"; then
|
||||
mv "$tmp" "$out"
|
||||
rm -f "$tmp.err"
|
||||
bytes=$(wc -c < "$out")
|
||||
|
||||
Reference in New Issue
Block a user