Merge "Force the format of ssh key to PEM, at least for now"

This commit is contained in:
Zuul 2018-09-28 06:02:38 +00:00 committed by Gerrit Code Review
commit d89edfc7db
1 changed files with 4 additions and 0 deletions

View File

@ -36,10 +36,14 @@ def generate_key_pair(key_length=2048):
"""
with tempfiles.tempdir() as tmpdir:
keyfile = os.path.join(tmpdir, 'tempkey')
# The key is generated in the old PEM format, instead of the native
# format of OpenSSH >=6.5, because paramiko does not support it:
# https://github.com/paramiko/paramiko/issues/602
args = [
'ssh-keygen',
'-q', # quiet
'-N', '', # w/o passphrase
'-m', 'PEM', # old PEM format
'-t', 'rsa', # create key of rsa type
'-f', keyfile, # filename of the key file
'-C', 'Generated-by-Sahara' # key comment