Bug 1310649 - cloud-init does not read instance sskKeys in GCE
cloud-init does not read instance sskKeys in GCE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Lars Kellogg-Stedman
Depends On:
  Show dependency treegraph
Reported: 2016-02-22 07:28 EST by Aleksandar Kostadinov
Modified: 2016-12-07 03:20 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-12-06 14:46:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Aleksandar Kostadinov 2016-02-22 07:28:09 EST
Description of problem:
Hello, I see that current version of cloud-init shipped with RHEL7.2 latest image from CSB does ignore instance public keys in google compute engine machines' metadata.

On the other hand  see that cloud-init upstream has already updated to support instance level sshKyes:

I think it is important to support that as putting all keys in project sshKeys is not always an option. For example creating instances from scripts and jenkins is more secure if the key used is not part of project  keys and be inserted into every launched instance. e.g. script may generate ssh key on the fly and this way making impossible a compromised jenkins instance to result in exposing all GCE machines to potentially disclosed ssh key.

It is not a security issue per se but I'd rate it close to that. It's more find googles idea to insert all project keys in instances weak.

That would allow downloading RHEL7.2 guest image straight from CSP, uploading to GCE and using it without any modifications.

A workaround actually exists. That it to put a command in user-data to append any instance level keys to authorized keys. Here's example user-data:

> #cloud-config
> disable_root: false
> preserve_hostname: true
> runcmd:
> - "curl 'http://metadata.google.internal/computeMetadata/v1/instance/attributes/sshKeys' -H 'Metadata-Flavor: Google' | sed -r -e 's/(^|,)[^\\S]*:/\\1/g' -e 's/,/\\n/g' >> /root/.ssh/authorized_keys"
Comment 2 Lars Kellogg-Stedman 2016-12-06 14:46:28 EST
We are only able to resolve cloud-init issues that impact functionality in OpenStack.  We will be releasing an updated cloud-init package shortly, based on 0.7.8, that may address this issue if it has been addressed upstream.
Comment 3 Aleksandar Kostadinov 2016-12-06 15:16:14 EST
I assume that upstream fixed. Code location seems to have changed though:

I would like to understand though, why we "are only able to resolve cloud-init issues that impact functionality in OpenStack"? If we support running RHEL on GCE why wouldn't we be able to resolve issues?

Note You need to log in before you can comment on or make changes to this bug.