fix: add ProxyJump key to all cluster nodes automatically

The setup script now adds both the restricted and unrestricted SSH keys
to ALL cluster nodes, not just the first one. This makes temperature
monitoring truly turnkey - you say 'yes' to configure cluster nodes and
it automatically sets up both keys on each node.

This ensures:
- All nodes can act as ProxyJump hosts if needed
- All nodes can provide temperature data via sensors
- No manual SSH key configuration required

Fixes turnkey cluster temperature monitoring setup.
This commit is contained in:
rcourtman 2025-10-19 09:02:28 +00:00
parent bfde490ad4
commit c17059ca8e

View file

@ -4065,13 +4065,20 @@ SSH_RESTRICTED_KEY_ENTRY='$SSH_RESTRICTED_KEY_ENTRY'
mkdir -p /root/.ssh mkdir -p /root/.ssh
chmod 700 /root/.ssh chmod 700 /root/.ssh
AUTH_KEYS=/root/.ssh/authorized_keys AUTH_KEYS=/root/.ssh/authorized_keys
# Remove any old unrestricted keys
if [ -f "\$AUTH_KEYS" ] && grep -qF "\$SSH_PUBLIC_KEY" "\$AUTH_KEYS" 2>/dev/null; then if [ -f "\$AUTH_KEYS" ] && grep -qF "\$SSH_PUBLIC_KEY" "\$AUTH_KEYS" 2>/dev/null; then
grep -vF "\$SSH_PUBLIC_KEY" "\$AUTH_KEYS" > "\$AUTH_KEYS.tmp" grep -vF "\$SSH_PUBLIC_KEY" "\$AUTH_KEYS" > "\$AUTH_KEYS.tmp"
mv "\$AUTH_KEYS.tmp" "\$AUTH_KEYS" mv "\$AUTH_KEYS.tmp" "\$AUTH_KEYS"
fi fi
# Add restricted key for sensors
if [ ! -f "\$AUTH_KEYS" ] || ! grep -qF "\$SSH_RESTRICTED_KEY_ENTRY" "\$AUTH_KEYS" 2>/dev/null; then if [ ! -f "\$AUTH_KEYS" ] || ! grep -qF "\$SSH_RESTRICTED_KEY_ENTRY" "\$AUTH_KEYS" 2>/dev/null; then
echo "\$SSH_RESTRICTED_KEY_ENTRY" >> "\$AUTH_KEYS" echo "\$SSH_RESTRICTED_KEY_ENTRY" >> "\$AUTH_KEYS"
fi fi
# Add unrestricted key for ProxyJump
SSH_PROXYJUMP_ENTRY="\$SSH_PUBLIC_KEY # pulse-proxyjump"
if [ ! -f "\$AUTH_KEYS" ] || ! grep -qF "# pulse-proxyjump" "\$AUTH_KEYS" 2>/dev/null; then
echo "\$SSH_PROXYJUMP_ENTRY" >> "\$AUTH_KEYS"
fi
chmod 600 "\$AUTH_KEYS" chmod 600 "\$AUTH_KEYS"
if ! command -v sensors >/dev/null 2>&1; then if ! command -v sensors >/dev/null 2>&1; then
echo " - Installing lm-sensors..." echo " - Installing lm-sensors..."