Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid entry added to known hosts #135

Open
ww-daniel-mora opened this issue Aug 30, 2022 · 4 comments
Open

Invalid entry added to known hosts #135

ww-daniel-mora opened this issue Aug 30, 2022 · 4 comments

Comments

@ww-daniel-mora
Copy link

After running upterm an invalid entry is added to the known_hosts file. Attempting to run upterm later results in the following error:

FATA[0000] knownhosts: /Users/daniel/.ssh/known_hosts:4: address [2a09:8280:1::3:4b89]: missing port in address

OS: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64
Upterm: Upterm version v0.9.0
Removing the entry enables you to run upterm again.
Manually adding port 22 to the address resolves the issue.

@owenthereal
Copy link
Owner

owenthereal commented Aug 31, 2022

Would you mind sharing the known host line in /Users/daniel/.ssh/known_hosts:4? It's likely that you have an invalid host line that wasn't added by upterm and upterm complained about it when trying to write a new host line for the uptermd server

@freswa
Copy link

freswa commented Apr 11, 2023

Same issue here, but the reported line is the one created by upterm:
@cert-authority uptermd.upterm.dev,[2a09:8280:1::3:4b89] ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiecex8Dq718eSe1CCLgLvDmI7AagvCtax7brPFWkh4

@pacien
Copy link

pacien commented Aug 20, 2023

IPv6 addresses are added with brackets to avoid ambiguities,
and OpenSSH mandates an explicit port with the bracketed syntax.

The issue is that golang.org/x/crypto/ssh/knownhosts.Normalize
omits the port when it's the default one, even when adding brackets,
which is not valid according to sshd(8) / "SSH_KNOWN_HOSTS FILE FORMAT".

Upstream issue: golang/go#53463

@RocketRene
Copy link

I removed the [ ] brackets in known hosts , that made it work

like this
@cert-authority uptermd.upterm.dev,2a09:8280:1::3:4b89 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiecex8Dq718eSe1CCLgLvDmI7AagvCtax7brPFWkh4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants