From: Dan Mick Date: Sat, 18 Oct 2014 05:11:05 +0000 (-0700) Subject: task.ssh_keys(): manage authorized_keys, not keys2 X-Git-Tag: 1.1.0~1118^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a8e00f20964f2823af7c28ac05d51bcaf82de33a;p=teuthology.git task.ssh_keys(): manage authorized_keys, not keys2 See the issue for a description, but authorized_keys2 is dead on RHEL7 and dying elsewhere. Fixes: #9812 Signed-off-by: Dan Mick --- diff --git a/teuthology/task/ssh_keys.py b/teuthology/task/ssh_keys.py index 6f1dbe183..c72fcb1ee 100644 --- a/teuthology/task/ssh_keys.py +++ b/teuthology/task/ssh_keys.py @@ -48,7 +48,7 @@ def ssh_keys_user_line_test(line_to_test, username ): def cleanup_added_key(ctx): """ - Delete the keys and removes ~/.ssh/authorized_keys2 entries we added + Delete the keys and removes ~/.ssh/authorized_keys entries we added """ log.info('cleaning up keys added for testing') @@ -60,7 +60,8 @@ def cleanup_added_key(ctx): log.info(' cleaning up keys for user {user} on {host}'.format(host=hostname, user=username)) misc.delete_file(remote, '/home/{user}/.ssh/id_rsa'.format(user=username)) misc.delete_file(remote, '/home/{user}/.ssh/id_rsa.pub'.format(user=username)) - misc.delete_file(remote, '/home/{user}/.ssh/authorized_keys2'.format(user=username)) + cmd = "sed -i /#TEUTHOLOGY_START/,/#TEUTHOLOGY_END/d /home/{user}/.ssh/authorized_keys".format(user=username).split() + remote.run(args=cmd) @contextlib.contextmanager def tweak_ssh_config(ctx, config): @@ -135,11 +136,10 @@ def push_keys_to_host(ctx, config, public_key, private_key): misc.delete_file(remote, pub_key_file, force=True) misc.create_file(remote, pub_key_file, pub_key_data) - # adding appropriate entries to the authorized_keys2 file for this host - auth_keys_file = '/home/{user}/.ssh/authorized_keys2'.format(user=username) - - # now add the list of keys for hosts in ctx to ~/.ssh/authorized_keys2 - misc.create_file(remote, auth_keys_file, auth_keys_data, str(600)) + # add appropriate entries to the authorized_keys file for this host + auth_keys_file = '/home/{user}/.ssh/authorized_keys'.format(user=username) + lines = '#TEUTHOLOGY_START\n' + auth_keys_data + '\n#TEUTHOLOGY_END\n' + misc.append_lines_to_file(remote, auth_keys_file, lines) try: yield