summaryrefslogtreecommitdiffstats
path: root/nova/crypto.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-23 01:39:23 +0000
committerGerrit Code Review <review@openstack.org>2013-01-23 01:39:23 +0000
commit6ba587b3216b26e1eeb359482518bb11b5d0f6ba (patch)
tree0225dd6ca67a2d98d69e57b4145dbeffad1c3719 /nova/crypto.py
parent1ab992d2aaa7efc9b1a6af9bf2aad42e6265a040 (diff)
parentaa3686a86f903c3b87ea73f1784117c36b2ed6fa (diff)
downloadnova-6ba587b3216b26e1eeb359482518bb11b5d0f6ba.tar.gz
nova-6ba587b3216b26e1eeb359482518bb11b5d0f6ba.tar.xz
nova-6ba587b3216b26e1eeb359482518bb11b5d0f6ba.zip
Merge "Don't limit SSH keys generation to 1024 bits"
Diffstat (limited to 'nova/crypto.py')
-rw-r--r--nova/crypto.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/nova/crypto.py b/nova/crypto.py
index 68d25e650..5c48c60b6 100644
--- a/nova/crypto.py
+++ b/nova/crypto.py
@@ -135,13 +135,14 @@ def generate_fingerprint(public_key):
raise exception.InvalidKeypair()
-def generate_key_pair(bits=1024):
- # what is the magic 65537?
-
+def generate_key_pair(bits=None):
with utils.tempdir() as tmpdir:
keyfile = os.path.join(tmpdir, 'temp')
- utils.execute('ssh-keygen', '-q', '-b', bits, '-N', '',
- '-t', 'rsa', '-f', keyfile, '-C', 'Generated by Nova')
+ args = ['ssh-keygen', '-q', '-N', '', '-t', 'rsa',
+ '-f', keyfile, '-C', 'Generated by Nova']
+ if bits is not None:
+ args.extend(['-b', bits])
+ utils.execute(*args)
fingerprint = _generate_fingerprint('%s.pub' % (keyfile))
if not os.path.exists(keyfile):
raise exception.FileNotFound(keyfile)