[Bug 970071] [NEW] sshutil does not correctly interpret relative paths in sshd_config

Andy Grimm 970071 at bugs.launchpad.net
Sat Mar 31 14:08:34 UTC 2012


Public bug reported:

>From the sshd_config manpage:

After expansion, AuthorizedKeysFile is taken to be an absolute path or
one relative to the user's home directory.  The default is
“.ssh/authorized_keys”.

However, cloud-init currently does not interpret relative paths this
way.  A possible fix would be:

--- a/cloudinit/SshUtil.py      2012-03-31 09:28:42.598996936 -0400
+++ b/cloudinit/SshUtil.py      2012-03-31 09:40:47.758829938 -0400
@@ -155,6 +155,8 @@
        akeys = ssh_cfg.get("AuthorizedKeysFile", "%h/.ssh/authorized_keys")
        akeys = akeys.replace("%h", pwent.pw_dir)
        akeys = akeys.replace("%u", user)
+        if not akeys.startswith('/'):
+            akeys = os.path.join(pwent.pw_dir, akeys)
        authorized_keys = akeys
    except Exception:
        authorized_keys = '%s/.ssh/authorized_keys' % pwent.pw_dir

** Affects: cloud-init (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to cloud-init in Ubuntu.
https://bugs.launchpad.net/bugs/970071

Title:
  sshutil does not correctly interpret relative paths in sshd_config

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/970071/+subscriptions



More information about the Ubuntu-server-bugs mailing list