BZ: 1924588 commit cdc5b81f33aee0ed3ef1ae239e5cec1906d0178a Author: Daniel Watkins <oddbloke@ubuntu.com> Date: Tue Jan 19 12:23:23 2021 -0500 Revert "ssh_util: handle non-default AuthorizedKeysFile config (#586)" (#775) This reverts commit b0e73814db4027dba0b7dc0282e295b7f653325c. Signed-off-by: Eduardo Otubo <otubo@redhat.com>
This commit is contained in:
parent
7606c7e70f
commit
18967d314e
@ -0,0 +1,69 @@
|
||||
From 9a4c22ac0b660cd2573b9a88d14a0ef39b61afca Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Otubo <otubo@redhat.com>
|
||||
Date: Wed, 3 Feb 2021 10:28:49 +0100
|
||||
Subject: [PATCH] Revert "ssh_util: handle non-default AuthorizedKeysFile
|
||||
config (#586)" (#775)
|
||||
|
||||
This reverts commit b0e73814db4027dba0b7dc0282e295b7f653325c.
|
||||
|
||||
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
|
||||
---
|
||||
cloudinit/ssh_util.py | 6 +++---
|
||||
tests/unittests/test_sshutil.py | 6 +++---
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
|
||||
index d5113996..c08042d6 100644
|
||||
--- a/cloudinit/ssh_util.py
|
||||
+++ b/cloudinit/ssh_util.py
|
||||
@@ -262,13 +262,13 @@ def extract_authorized_keys(username, sshd_cfg_file=DEF_SSHD_CFG):
|
||||
|
||||
except (IOError, OSError):
|
||||
# Give up and use a default key filename
|
||||
- auth_key_fns.append(default_authorizedkeys_file)
|
||||
+ auth_key_fns[0] = default_authorizedkeys_file
|
||||
util.logexc(LOG, "Failed extracting 'AuthorizedKeysFile' in SSH "
|
||||
"config from %r, using 'AuthorizedKeysFile' file "
|
||||
"%r instead", DEF_SSHD_CFG, auth_key_fns[0])
|
||||
|
||||
- # always store all the keys in the first file configured on sshd_config
|
||||
- return (auth_key_fns[0], parse_authorized_keys(auth_key_fns))
|
||||
+ # always store all the keys in the user's private file
|
||||
+ return (default_authorizedkeys_file, parse_authorized_keys(auth_key_fns))
|
||||
|
||||
|
||||
def setup_user_keys(keys, username, options=None):
|
||||
diff --git a/tests/unittests/test_sshutil.py b/tests/unittests/test_sshutil.py
|
||||
index 88a111e3..fd1d1bac 100644
|
||||
--- a/tests/unittests/test_sshutil.py
|
||||
+++ b/tests/unittests/test_sshutil.py
|
||||
@@ -593,7 +593,7 @@ class TestMultipleSshAuthorizedKeysFile(test_helpers.CiTestCase):
|
||||
fpw.pw_name, sshd_config)
|
||||
content = ssh_util.update_authorized_keys(auth_key_entries, [])
|
||||
|
||||
- self.assertEqual(authorized_keys, auth_key_fn)
|
||||
+ self.assertEqual("%s/.ssh/authorized_keys" % fpw.pw_dir, auth_key_fn)
|
||||
self.assertTrue(VALID_CONTENT['rsa'] in content)
|
||||
self.assertTrue(VALID_CONTENT['dsa'] in content)
|
||||
|
||||
@@ -610,7 +610,7 @@ class TestMultipleSshAuthorizedKeysFile(test_helpers.CiTestCase):
|
||||
sshd_config = self.tmp_path('sshd_config')
|
||||
util.write_file(
|
||||
sshd_config,
|
||||
- "AuthorizedKeysFile %s %s" % (user_keys, authorized_keys)
|
||||
+ "AuthorizedKeysFile %s %s" % (authorized_keys, user_keys)
|
||||
)
|
||||
|
||||
(auth_key_fn, auth_key_entries) = ssh_util.extract_authorized_keys(
|
||||
@@ -618,7 +618,7 @@ class TestMultipleSshAuthorizedKeysFile(test_helpers.CiTestCase):
|
||||
)
|
||||
content = ssh_util.update_authorized_keys(auth_key_entries, [])
|
||||
|
||||
- self.assertEqual(user_keys, auth_key_fn)
|
||||
+ self.assertEqual("%s/.ssh/authorized_keys" % fpw.pw_dir, auth_key_fn)
|
||||
self.assertTrue(VALID_CONTENT['rsa'] in content)
|
||||
self.assertTrue(VALID_CONTENT['dsa'] in content)
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: cloud-init
|
||||
Version: 20.4
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Cloud instance init scripts
|
||||
License: ASL 2.0 or GPLv3
|
||||
URL: http://launchpad.net/cloud-init
|
||||
@ -28,6 +28,9 @@ Patch4: cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch
|
||||
# Adding default RHEL configuration file
|
||||
Patch5: cloud-init-20.4-Adding-RHEL-default-cloud.cfg.patch
|
||||
|
||||
# Reverting commit b0e73814
|
||||
Patch6: cloud-init-20.4-Revert-ssh_util-handle-non-default-AuthorizedKeysFil.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
@ -179,6 +182,9 @@ python3 -m pytest tests/unittests
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Feb 08 2021 Eduardo Otubo <otubo@redhat.com> - 20.4-4
|
||||
- Reverting commit b0e7381 [bz#1924588]
|
||||
|
||||
* Wed Feb 03 2021 Eduardo Otubo <otubo@redhat.com> - 20.4-3
|
||||
- Adding requirement hostname to specfile [bz#1925118]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user