Skip to content

Conversation

scop
Copy link
Contributor

@scop scop commented Mar 9, 2023

Documentation for the known_hosts file format specifies "Hostnames is a comma-separated list of patterns [...]". The regexps we had is unnecessariliy strict, allowing only a subset of valid sequences.

Make it more lenient (and simple) to match more valid ones.

https://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT

Wildcard support is still missing, but I'm scratching another itch I have with this (manually crafted entries with hostname followed by more than one IP address).

Documentation for the known_hosts file format specifies "Hostnames is a
comma-separated list of patterns [...]". The regexps we had is
unnecessarily strict, allowing only a subset of valid sequences.

Make it more lenient (and simple) to match more valid ones.
@scop scop force-pushed the known-hosts-patterns branch from a136272 to 7fd4b00 Compare March 9, 2023 21:29
@peterhoeg
Copy link
Owner

Thanks for this. I would love to get some tests in place as changing regexps is otherwise very painful. Any chance you could be persuaded into adding a test or two for this as part of the PR?

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

Successfully merging this pull request may close these issues.

2 participants