From: Thierry Parmentelat Date: Mon, 9 Nov 2015 10:40:06 +0000 (+0100) Subject: when generating keys inside the bootcd environment, ignore errors about the rsa1... X-Git-Tag: bootmanager-5.3-2~3 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=715575ebf8293ca92b3950ff19e70ea565628ab3 when generating keys inside the bootcd environment, ignore errors about the rsa1 key type, as support for this has been dropped apparently in f23 --- diff --git a/source/steps/InstallWriteConfig.py b/source/steps/InstallWriteConfig.py index ba8f49f..381e9b1 100644 --- a/source/steps/InstallWriteConfig.py +++ b/source/steps/InstallWriteConfig.py @@ -133,19 +133,29 @@ def Run(vars, log): log.write("Creating ssh host keys\n") key_gen_prog = "/usr/bin/ssh-keygen" + # fedora23 seems to come with a release of openssh that lacks suppport + # for ssh1, and thus rsa1 keys; so we consider that failing to produce + # the rsa1 key is not a showstopper key_specs = [ - ("/etc/ssh/ssh_host_key", 'rsa1', "SSH1 RSA"), - ("/etc/ssh/ssh_host_rsa_key", 'rsa', "SSH2 RSA"), - ("/etc/ssh/ssh_host_dsa_key", 'dsa', "SSH2 DSA"), + ("/etc/ssh/ssh_host_key", 'rsa1', "SSH1 RSA", False), + ("/etc/ssh/ssh_host_rsa_key", 'rsa', "SSH2 RSA", True), + ("/etc/ssh/ssh_host_dsa_key", 'dsa', "SSH2 DSA", True), ] - for key_file, key_type, label in key_specs: + for key_file, key_type, label, mandatory in key_specs: abs_file = "{}/{}".format(SYSIMG_PATH, key_file) if not os.path.exists(abs_file): - log.write("Generating {} host key {}\n".format(label, key_file)) - utils.sysexec_chroot(SYSIMG_PATH, "{} -q -t {} -f {} -C '' -N ''"\ - .format(key_gen_prog, key_type, key_file), log) - utils.sysexec("chmod 600 {}/{}".format(SYSIMG_PATH, key_file), log) - utils.sysexec("chmod 644 {}/{}.pub".format(SYSIMG_PATH, key_file), log) - + log.write("Generating {} host key {} (mandatory success={})\n" + .format(label, key_file, mandatory)) + if mandatory: + run = utils.sysexec + run_chroot = utils.sysexec_chroot + else: + run = utils.sysexec_noerr + run_chroot = utils.sysexec_chroot_noerr + run_chroot(SYSIMG_PATH, "{} -q -t {} -f {} -C '' -N ''"\ + .format(key_gen_prog, key_type, key_file), log) + run("chmod 600 {}/{}".format(SYSIMG_PATH, key_file), log) + run("chmod 644 {}/{}.pub".format(SYSIMG_PATH, key_file), log) + return 1