craig-sanders / fakecloud

meta-data server to enable running pre-built cloud VM images with just libvirt (or kvm or xen, etc)
GNU General Public License v3.0
8 stars 0 forks source link

public-keys support #1

Open vincentbernat opened 7 years ago

vincentbernat commented 7 years ago

Hey!

EC2 provides SSH keys through /public-keys/0/openssh-key. Is that possible to serve something similar with fakecloud?

craig-sanders commented 7 years ago

Certainly, just add a get '/public-keys/0/openssh-key' sub { ... }; subroutine that outputs the key in the right format (text/plain, probably - most of the cloud-init data is). That should be enough for a bare-minimum simple case.

I'd have to read the docs on that to know whether there were more complicated options or other kinds of data available under/public-keys/, but I doubt that it would be difficult to add. No more difficult than providing data for the various /user-data/* requests was, and that wasn't very difficult at all.

It should even be possible to somehow share the keys with the user-data authkeys so that they only have to be added once.

patches and merge requests are welcome.