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 1388359 - root is not root when logged in via sshd using chroot
Summary: root is not root when logged in via sshd using chroot
Keywords:
Status: CLOSED DUPLICATE of bug 1398569
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openssh
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Jakub Jelen
QA Contact: Stanislav Zidek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-25 07:43 UTC by Jakub Jelen
Modified: 2016-11-28 15:55 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1386755
Environment:
Last Closed: 2016-11-28 15:55:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jakub Jelen 2016-10-25 07:43:54 UTC
Applicable also for RHEL7.3 without reasonable workaround (ChrootDirectory none  will not work in openssh-6.6). This setup will be broken with last openssh update.

The same patch as in the original bug applies also for RHEL7.3 and fixes the issue. I would like to see this fixed as soon as possible or at least document as a known bug (unfortunately we get to know this bug quite late).

+++ This bug was initially created as a clone of Bug #1386755 +++

Description of problem:

If logged in via sshd, root can not access some files, that do not have o+r or belong too root:

[root@c1 ~]# cat /etc/shadow
cat: /etc/shadow: Keine Berechtigung
[root@c1 ~]# ls -la /var/log/exim/
ls: Öffnen von Verzeichnis /var/log/exim/ nicht möglich: Keine Berechtigung
[root@c1 ~]# id
uid=0(root) gid=0(root) Gruppen=0(root)
[root@c1 ~]#

BUT, if logged in via a Konsole, root is root and can access those files.

Actual results:

no root functionality. Root is threated as any other normal user account.

Expected results:

beeing root again.

--- Additional comment from  on 2016-10-21 10:48:08 CEST ---

Sources: 

http://marius.bloggt-in-braunschweig.de/2016/10/20/update-fedora-openssh-alarm-nicht-updaten-auf-7-2p2-6/
https://marius.bloggt-in-braunschweig.de/2016/10/19/fedora-openssh-alarm-nicht-updaten-auf-7-2p2-6/


Working Downgrade methodes :

1. Download the previouse version of the three updates packages from : 

http://koji.fedoraproject.org/koji/buildinfo?buildID=756836

best to /tmp/ on the server you need to regain controll over. I suggest version 7.2p2-3 .

2. as defective root user do : 

-- CHANGE THE TIME before your execute it --

echo "41 10 * * * root /usr/bin/rpm -U --force /tmp/openssh*rpm > /tmp/log; rm -f /etc/cron.d/onetime" > /etc/cron.d/onetime

3. logoff and wait for it to happen
4. login again.. done

--- Additional comment from  on 2016-10-21 11:35:34 CEST ---


Yes, chroot is enabled, but not for root.

--------------------------------
[...]
ChrootDirectory /opt/root/
Match user root
 	ChrootDirectory /

--- Additional comment from  on 2016-10-21 11:37:41 CEST ---

Capabilities and Groupinfos are gone ( as expected :) )


NONE WORKING:

[root@XXX ~]# capsh --print
Current: =
Bounding set =
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
uid=0(root)
gid=0(root)
groups=


WORKING: 

[root@XXXX ~]# capsh --print
Current: = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,37+ep
Bounding set =cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,37
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
uid=0(root)
gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

--- Additional comment from Jakub Jelen on 2016-10-21 11:47:14 CEST ---

Thank you for the additional information.

> Match user root
>  	ChrootDirectory /

This is wrong. You should use "ChrootDirectory none" to avoid chroot. Because otherwise the chroot operation is executed on the / . This should be noop, but evidently is not.
I will investigate why does it behave this way. It never came to my mind to do chroot on / (and not sure if we want to support it).

--- Additional comment from  on 2016-10-21 12:00:09 CEST ---

with "none" as chrootdirectory 

- capabilities and groups are back
- access is back

Seems to work.

Comment 1 Jakub Jelen 2016-11-28 15:55:15 UTC

*** This bug has been marked as a duplicate of bug 1398569 ***


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