From 043d5232dec35ca71728fea7fdb2e116c2de90cb Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Mon, 6 Nov 2017 11:13:05 +0100 Subject: [PATCH] ssh: always expand the path for the generated authorized_keys file. Without it we can lead to path problems on reading the ~. --- rhodecode/apps/ssh_support/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rhodecode/apps/ssh_support/utils.py b/rhodecode/apps/ssh_support/utils.py index efe8a20d..038c3eee 100644 --- a/rhodecode/apps/ssh_support/utils.py +++ b/rhodecode/apps/ssh_support/utils.py @@ -50,6 +50,9 @@ def get_all_active_keys(): def _generate_ssh_authorized_keys_file( authorized_keys_file_path, ssh_wrapper_cmd, allow_shell, ssh_opts, debug): + authorized_keys_file_path = os.path.abspath( + os.path.expanduser(authorized_keys_file_path)) + import rhodecode all_active_keys = get_all_active_keys() @@ -59,6 +62,7 @@ def _generate_ssh_authorized_keys_file( ssh_wrapper_cmd = ssh_wrapper_cmd + ' --debug' if not os.path.isfile(authorized_keys_file_path): + log.debug('Creating file at %s', authorized_keys_file_path) with open(authorized_keys_file_path, 'w'): pass