1a48e76
Index: cloud-init-fedora/cloudinit/CloudConfig/cc_ssh.py
f3b8d56
===================================================================
1a48e76
--- cloud-init-fedora.orig/cloudinit/CloudConfig/cc_ssh.py
1a48e76
+++ cloud-init-fedora/cloudinit/CloudConfig/cc_ssh.py
f354744
@@ -31,7 +31,7 @@ def handle(name,cfg,cloud,log,args):
f354744
     global_log = log
f354744
 
f354744
     # remove the static keys from the pristine image
f354744
-    for f in glob.glob("/etc/ssh/ssh_host_*_key*"):
f354744
+    for f in glob.glob("/etc/ssh/ssh_host_*key*"):
f354744
         try: os.unlink(f)
f354744
         except: pass
f354744
 
f3b8d56
@@ -61,10 +61,10 @@ def handle(name,cfg,cloud,log,args):
f3b8d56
             log.debug("generated %s from %s" % pair)
f3b8d56
     else:
f3b8d56
         # if not, generate them
f3b8d56
-        genkeys ='ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ""; '
f3b8d56
-        genkeys+='ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ""; '
f3b8d56
-        genkeys+='ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -t ecdsa -N ""; '
f3b8d56
-        subprocess.call(('sh', '-c', "{ %s } 
f3b8d56
+        for keytype in util.get_cfg_option_list_or_str(cfg, 'ssh_genkeytypes',
f3b8d56
+                                                       ['rsa', 'dsa', 'ecdsa']):
f3b8d56
+            subprocess.call(['ssh-keygen', '-t', keytype, '-N', '',
f3b8d56
+                             '-f', '/etc/ssh/ssh_host_%s_key' % keytype])
f3b8d56
 
1a48e76
     util.restorecon_if_possible('/etc/ssh', recursive=True)
1a48e76
 
1a48e76
@@ -84,11 +84,6 @@ def handle(name,cfg,cloud,log,args):
f354744
         util.logexc(log)
f354744
         log.warn("applying credentials failed!\n")
f354744
 
f354744
-    send_ssh_keys_to_console()
f354744
-
f354744
-def send_ssh_keys_to_console():
f354744
-    subprocess.call(('/usr/libexec/cloud-init/write-ssh-key-fingerprints',))
f354744
-
f354744
 def apply_credentials(keys, user, disable_root, disable_root_opts=DISABLE_ROOT_OPTS, log=global_log):
f354744
     keys = set(keys)
f354744
     if user:
1a48e76
Index: cloud-init-fedora/cloudinit/util.py
f3b8d56
===================================================================
1a48e76
--- cloud-init-fedora.orig/cloudinit/util.py
1a48e76
+++ cloud-init-fedora/cloudinit/util.py
a2171c6
@@ -84,6 +84,7 @@ def get_cfg_option_str(yobj, key, defaul
f3b8d56
 
f3b8d56
 def get_cfg_option_list_or_str(yobj, key, default=None):
f3b8d56
     if not yobj.has_key(key): return default
f3b8d56
+    if yobj[key] is None: return []
f3b8d56
     if isinstance(yobj[key],list): return yobj[key]
f3b8d56
     return([yobj[key]])
f3b8d56
 
1a48e76
Index: cloud-init-fedora/tools/write-ssh-key-fingerprints
f3b8d56
===================================================================
1a48e76
--- cloud-init-fedora.orig/tools/write-ssh-key-fingerprints
1a48e76
+++ cloud-init-fedora/tools/write-ssh-key-fingerprints
f3b8d56
@@ -3,8 +3,7 @@
f3b8d56
 echo
f3b8d56
 echo "#############################################################"
f3b8d56
 echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----"
f3b8d56
-ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
f3b8d56
-ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub
f3b8d56
+echo /etc/ssh/ssh_host_*key.pub | xargs -n 1 ssh-keygen -l -f
f3b8d56
 echo "-----END SSH HOST KEY FINGERPRINTS-----"
f3b8d56
 echo "#############################################################"
f3b8d56
 } | logger -p user.info -s -t "ec2"