Add trailing newline to key data for OpenSSH formatted keys.

This commit is contained in:
Chris Church
2016-03-28 18:33:46 -04:00
parent d51f56af9c
commit 3660b04d62
2 changed files with 6 additions and 4 deletions

View File

@@ -389,6 +389,10 @@ class BaseTask(Task):
if 'OPENSSH PRIVATE KEY' in data and not openssh_keys_supported:
raise RuntimeError(OPENSSH_KEY_ERROR)
for name, data in private_data.iteritems():
# OpenSSH formatted keys must have a trailing newline to be
# accepted by ssh-add.
if 'OPENSSH PRIVATE KEY' in data and not data.endswith('\n'):
data += '\n'
# For credentials used with ssh-add, write to a named pipe which
# will be read then closed, instead of leaving the SSH key on disk.
if name in ('credential', 'scm_credential', 'ad_hoc_credential') and not ssh_too_old: