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

only compare the relevant bits of the ssh key fingerprint #22

Merged
merged 1 commit into from
Jun 5, 2014

Conversation

thommay
Copy link

@thommay thommay commented Jun 5, 2014

When comparing fingerprints, the last section is host specific - but
it's irrelevant. So we chop that bit off, and ensure that the actual
algorithm and public key still match.

When comparing fingerprints, the last section is host specific - but
it's irrelevant. So we chop that bit off, and ensure that the actual
algorithm and public key still match.
@jkeiser
Copy link
Contributor

jkeiser commented Jun 5, 2014

Is this the case for PKCS8 keys as well?

@thommay
Copy link
Author

thommay commented Jun 5, 2014

yeah, both fingerprint and pkcs8sha1fingerprint are fine because they have no spaces:

irb(main):005:0> f.class
=> OpenSSL::PKey::RSA
irb(main):008:0> k = Cheffish::KeyFormatter.encode(f, format: :pkcs8sha1fingerprint)
=> "c5:49:5b:f3:aa:2c:b6:99:93:b5:3f:c5:83:ec:e6:1b:6b:59:5f:84"
irb(main):009:0> z = Cheffish::KeyFormatter.encode(f, format: :pkcs8sha1fingerprint).split[0,2].join(' ')
=> "c5:49:5b:f3:aa:2c:b6:99:93:b5:3f:c5:83:ec:e6:1b:6b:59:5f:84"
irb(main):010:0> k == z
=> true

jkeiser added a commit that referenced this pull request Jun 5, 2014
only compare the relevant bits of the ssh key fingerprint
@jkeiser jkeiser merged commit 0231f3e into chef-boneyard:master Jun 5, 2014
@jkeiser
Copy link
Contributor

jkeiser commented Jun 5, 2014

Cool. I'm curious what problems this causes from a practical point of view?

@thommay
Copy link
Author

thommay commented Jun 5, 2014

Let's say I do my initial spin up on my workstation, but then decide I want an orchestrator node.
So I copy my generated ssh key on to the orchestrator, then run chef. Chef explodes because the comparison fails, because the hostname has changed. So I swear, set allow_overwrite and re-run chef. Then I swear louder because Rackspace treats ssh keys as immutable and so my only option is to delete the key from Rackspace and let chef re-upload it, which seems like a bit of a waste of time :)

@jkeiser
Copy link
Contributor

jkeiser commented Jun 5, 2014

Ouch! Point taken :) One sort of wonders why hosts are part of key fingerprints at all.

@jkeiser
Copy link
Contributor

jkeiser commented Jun 5, 2014

0.5.3 released with this in it.

@thommay
Copy link
Author

thommay commented Jun 5, 2014

thanks man 👍

@thommay thommay deleted the compare_less_greedily branch June 5, 2014 14:50
viglesiasce pushed a commit to viglesiasce/chef-metal-fog that referenced this pull request Aug 19, 2014
…_detection

double double escape escape to fix RHEL/CentOS platform_version detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants