RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1995840 - [cloudinit] Fix home permissions modified by ssh module
Summary: [cloudinit] Fix home permissions modified by ssh module
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: cloud-init
Version: 8.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: beta
: ---
Assignee: Emanuele Giuseppe Esposito
QA Contact: xiachen
URL:
Whiteboard:
: 2000664 (view as bug list)
Depends On:
Blocks: 1995843
TreeView+ depends on / blocked
 
Reported: 2021-08-19 21:59 UTC by Emanuele Giuseppe Esposito
Modified: 2021-11-12 03:05 UTC (History)
10 users (show)

Fixed In Version: cloud-init-21.1-7.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1995843 (view as bug list)
Environment:
Last Closed: 2021-11-09 18:48:55 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/rhel/src cloud-init merge_requests 29 0 None None None 2021-08-23 08:02:27 UTC
Red Hat Issue Tracker RHELPLAN-94161 0 None None None 2021-08-19 22:02:05 UTC
Red Hat Product Errata RHEA-2021:4294 0 None None None 2021-11-09 18:49:54 UTC

Description Emanuele Giuseppe Esposito 2021-08-19 21:59:12 UTC
Description of problem:

In upstream PR #956 and BZ 1862967, we updated the file and directory permissions for keys not in
the user's home directory. We also unintentionally modified the
owner within the home directory as well to root, but only when the file/folders specified in AuthorizedKeysFile don't exist. This is okay and still allows ssh login, but not ideal for other ssh components. For example, if cloud-init creates the .ssh folder in /home/user/, the owner of .ssh will be root and ssh-keygen won't allow to create ssh keys in that folder.

LP: #1940233

Version-Release number of selected component (if applicable):
cloud-init-21.1-6.el8

How reproducible:
always

Steps to Reproduce:

1. Use standard AuthorizedKeysFile: 
# cat /etc/ssh/sshd_config | grep AuthorizedKeysFile
AuthorizedKeysFile .ssh/authorized_keys
2. Remove ~/.ssh
3. Remove /var/lib/cloud/instance/sem/config_ssh
4. systemctl restart cloud-init ; systemctl restart sshd
5. Try to ssh login through the cloud-init created user, login is fine
6. run ssh-keygen and save the key in /home/<user>/.ssh

Actual results:
ssh-keygen gives Permission denied on the .ssh folder
This is because the owner of .ssh is root.

Expected results:
ssh-keygen creates the keys, and .ssh is owned by the user

Comment 23 xiachen 2021-09-09 03:47:21 UTC
*** Bug 2000664 has been marked as a duplicate of this bug. ***

Comment 25 errata-xmlrpc 2021-11-09 18:48:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (cloud-init bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:4294


Note You need to log in before you can comment on or make changes to this bug.