Bug 644086
| Summary: | [ec2]: key.pem returns a "corrupted" private key | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] CloudForms Cloud Engine | Reporter: | Chris Lalancette <clalance> | ||||
| Component: | aeolus-conductor | Assignee: | Angus Thomas <athomas> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | wes hayutin <whayutin> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 0.3.1 | CC: | akarol, dajohnso, deltacloud-maint, dgao, ssachdev, sseago, whayutin | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2011-12-08 13:50:17 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 642820 | ||||||
| Attachments: |
|
||||||
Fixed in: [PATCH core] Fixed PEM key format in Keys Patch sent to -incubator mailing list. This has been committed upstream, and is now in the packages for QE to test. Flipping over to ON_QA. Chris Lalancette Created attachment 458198 [details]
full irb text
I need some help verifying this. I tried to recreate the issue but the key is not generating and being new to the project, I am unsure as to why that is.
irb(main):023:0> client.create_key(:name => "dave_#{Time.now.to_i}_key")
=> nil
irb(main):024:0>
Shveta, see if you can verify this bug. Your focus is deltacloud so this would be interesting to you. <clalance> shveta: Or you can just try to download the key and try to ssh into an instance with it. I am able to download the key of an instance and ssh to it. I can confirm this also I can provide a simple Ruby script to test it. release pending... release pending... perm close closing out old bugs |
Description of problem: When you use the deltacloud-core client to create a key, you do something like: client = Deltacloud.new(username, password, provider.url) key = client.create_key(:name => "#{self.name}_#{Time.now.to_i}_key") puts key.pem However, the value returned in key.pem is actually not directly useful as a private key. The problem is that the way the pem is encoded, every line begins with 4 spaces. If you take that pem as-is, write it to a file, and try to use it as a private key, ssh complains that the key isn't useful. Sure, we could workaround the problem by doing something like: key.pem.each do |line| puts line.strip end However, it seems like *every* client that wants to use the key would have to do this, so it would seem better to fix it in the core. I think the reason this is happening is that the core uses a cdata helper function to return this data: def cdata(&block) text = capture_haml(&block) text.gsub!("\n", "x\n ") "<![CDATA[\n #{text}\n]]>" end And you can see there that every newline is suffixed with a newline-space, so we get the extra spaces at the beginning of every line.