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

known_host port format fails for some linux distributions #73

Open
wwoodrow opened this issue Nov 22, 2017 · 0 comments
Open

known_host port format fails for some linux distributions #73

wwoodrow opened this issue Nov 22, 2017 · 0 comments

Comments

@wwoodrow
Copy link

Amazon linux new AMI 2017.09 breaks when using hashed entries with alternate ports, or rather ignores them. As far as I've found the []:port# isn't needed and the known_host file works fine on the few linux distros I've checked without them. The fix that worked for me was to simply strip out the added syntax returned from the call to ssh-keyscan for non-standard ports. This also makes matching easier basically just an added conditional with regex and all was fine:

if new_resource.port == 22
new_resource.key keyscan.stdout.strip
else
new_resource.key keyscan.stdout.strip.sub(/[(.)].+(ssh.)/, '\1 \2')
end

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

1 participant