Red Hat Bugzilla – Bug 1310649
cloud-init does not read instance sskKeys in GCE
Last modified: 2016-12-07 03:20:02 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:
> disable_root: false
> preserve_hostname: true
> - "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"
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.
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?