Derive SSH host alias from DNSName instead of raw HostName
Tailscale's raw HostName field is whatever the OS reports (e.g. "Pixel 9" with a literal space for an Android device), which breaks when written unquoted into an SSH config Host line - ssh_config treats space-separated words as multiple patterns, not one literal name. DNSName is already sanitized (hyphens, no spaces) for exactly this purpose, so derive the alias from its first label instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
0c742e6a2f
commit
20af6b67a8
1 changed files with 1 additions and 1 deletions
|
|
@ -261,7 +261,7 @@ Host $name
|
|||
IdentityFile ~/.ssh/id_ed25519_${KEY_NAME}
|
||||
EOF
|
||||
)
|
||||
done < <(echo "$status_json" | jq -r '.Peer[] | "\(.HostName) \(.DNSName | rtrimstr("."))"')
|
||||
done < <(echo "$status_json" | jq -r '.Peer[] | (.DNSName | rtrimstr(".")) as $d | "\($d | split(".")[0]) \($d)"')
|
||||
new_block+=$'\n'"$end"
|
||||
|
||||
local old_block
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue