From a2aa4805f018a9d8ff8baff7c2f6cb91e532c4d2 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Sun, 30 Oct 2011 18:00:41 -0400 Subject: Make the types of SSH keys to generate configurable Notes: * This also makes cc_ssh.py *not* write ssh keys to the console. That means that if keys-to-console is configured off, nothing will write the keys to the console. * I removed Garret's use of xargs, replacing with a shell for loop in write-ssh-key-fingerprints. taken from git://pkgs.fedoraproject.org/cloud-init.git commit 87f33190f43d2b26cced4597e7298835024466c2 Author: Garrett Holmstrom Patch8: cloud-init-0.6.2-sshkeytypes.patch --- cloudinit/CloudConfig/cc_ssh.py | 15 +++++---------- cloudinit/util.py | 1 + tools/write-ssh-key-fingerprints | 6 ++++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cloudinit/CloudConfig/cc_ssh.py b/cloudinit/CloudConfig/cc_ssh.py index 727fd398..296b18f2 100644 --- a/cloudinit/CloudConfig/cc_ssh.py +++ b/cloudinit/CloudConfig/cc_ssh.py @@ -31,7 +31,7 @@ def handle(name,cfg,cloud,log,args): global_log = log # remove the static keys from the pristine image - for f in glob.glob("/etc/ssh/ssh_host_*_key*"): + for f in glob.glob("/etc/ssh/ssh_host_*key*"): try: os.unlink(f) except: pass @@ -61,10 +61,10 @@ def handle(name,cfg,cloud,log,args): log.debug("generated %s from %s" % pair) else: # if not, generate them - genkeys ='ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ""; ' - genkeys+='ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ""; ' - genkeys+='ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -t ecdsa -N ""; ' - subprocess.call(('sh', '-c', "{ %s }