From 04e3dd1a0d59bc1588c271dc5aad32ef30057a5ac0ce452e0fceed3b96dca861 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 7 May 2013 13:10:36 +0000 Subject: [PATCH] Accepting request 174647 from Base:System support relative path for authorized_keys file, backport fix from upstream version 0.7.1 (bnc#818306) OBS-URL: https://build.opensuse.org/request/show/174647 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=2 --- cloud-init.changes | 6 ++++++ cloud-init.init | 4 ++-- cloud-init.spec | 16 +++++++++++----- relative-authorized-keys-file.diff | 13 +++++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 relative-authorized-keys-file.diff diff --git a/cloud-init.changes b/cloud-init.changes index f7bd962..05eff99 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 6 14:50:17 UTC 2013 - jdsn@suse.de + +- support relative path for authorized_keys file + backport fix from upstream version 0.7.1 (bnc#818306) + ------------------------------------------------------------------- Wed Sep 19 12:42:07 UTC 2012 - jdsn@suse.de diff --git a/cloud-init.init b/cloud-init.init index aab8473..0b2f456 100644 --- a/cloud-init.init +++ b/cloud-init.init @@ -51,7 +51,7 @@ case "$1" in stop) echo -n "Shutting down cloud-init " - killproc $CLOUDINIT_BIN + killall `basename $CLOUDINIT_BIN` rc_status -v ;; @@ -63,7 +63,7 @@ case "$1" in status) echo -n "Checking for service cloud-init" - [ -e /root/.ssh/authorized_keys ] + [ -e /root/.ssh/authorized_keys ] rc_status -v ;; *) diff --git a/cloud-init.spec b/cloud-init.spec index af296c0..b4c811e 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,7 +1,7 @@ # # spec file for package cloud-init # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,20 +21,25 @@ Name: %{component} Version: 0.6.3 Release: 0 -License: GPL-3.0 Summary: Cloud node initialization tool -Url: http://launchpad.net/cloud-init/ +License: GPL-3.0 Group: System/Management +Url: http://launchpad.net/cloud-init/ Source0: %{component}-%{version}.tar.bz2 Source1: cloud.cfg.suse Source2: cloud-init.init Patch0: drop-MAAS-datasource.diff Patch1: drop-python27-only-code.diff Patch2: drop-ubuntu-default-username.diff -Requires: python-yaml python-cheetah python-boto python-xml +# backport fix from upstream version 0.7.1 for bug bnc#818306 +Patch3: relative-authorized-keys-file.diff +Requires: python-boto +Requires: python-cheetah +Requires: python-xml +Requires: python-yaml +BuildRequires: filesystem BuildRequires: python-devel BuildRequires: python-setuptools -BuildRequires: filesystem #BuildRequires: python-distribute BuildRequires: fdupes BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -67,6 +72,7 @@ Authors: echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{S:1} %endif %patch2 -p1 +%patch3 -p1 %build python setup.py build diff --git a/relative-authorized-keys-file.diff b/relative-authorized-keys-file.diff new file mode 100644 index 0000000..de31bd5 --- /dev/null +++ b/relative-authorized-keys-file.diff @@ -0,0 +1,13 @@ +Index: cloud-init-0.6.3/cloudinit/SshUtil.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/SshUtil.py ++++ cloud-init-0.6.3/cloudinit/SshUtil.py +@@ -155,6 +155,8 @@ def setup_user_keys(keys, user, key_pref + 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