Bug 1310649 - cloud-init does not read instance sskKeys in GCE
Summary: cloud-init does not read instance sskKeys in GCE
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Lars Kellogg-Stedman
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-22 12:28 UTC by Aleksandar Kostadinov
Modified: 2016-12-07 08:20 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-06 19:46:28 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Aleksandar Kostadinov 2016-02-22 12:28:09 UTC
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:
http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/DataSourceGCE.py

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 19:46:28 UTC
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 20:16:14 UTC
I assume that upstream fixed. Code location seems to have changed though:
https://git.launchpad.net/cloud-init/tree/cloudinit/sources/DataSourceGCE.py

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.