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 1728777 - pam_loginuid prevents login in unprivileged containers
Summary: pam_loginuid prevents login in unprivileged containers
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pam
Version: 7.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Dalibor Pospíšil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-10 16:46 UTC by Dzmitry Kazei
Modified: 2020-03-31 19:10 UTC (History)
2 users (show)

Fixed In Version: pam-1.1.8-23.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:10:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1005 0 None None None 2020-03-31 19:10:43 UTC

Description Dzmitry Kazei 2019-07-10 16:46:58 UTC
Description of problem:
pam_loginuid prevents login via ssh in unprivileged containers because it can't write /proc/self/loginuid even as namespaced root. Upstream had been patched (https://github.com/linux-pam/linux-pam/commit/2e62d5aea3f5ac267cfa54f0ea1f8c07ac85a95a#diff-8322fbd4507ee14b865167c196cb78d2) years ago to work around the issue in user namespaces.

Could you please apply the patch?

pam_loginuid can be set as optional instead of required for ssh as workaround, but that's not the way to go.

Thanks

Version-Release number of selected component (if applicable):
pam-1.1.8-22.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. Run sshd in a container with user namespace mapping enabled (example 0 100000 65536)
2. try to connect from another host with ssh

Actual results:
session closed with debug message "debug3: PAM session not opened, exiting"

Expected results:
session opened

Comment 5 Dalibor Pospíšil 2019-07-24 16:22:28 UTC
Dzmitry, can you share with us the steps you've done to run sshd in a container?

Comment 6 Dzmitry Kazei 2019-07-24 16:32:36 UTC
Hello,

I installed required files with "yum -y --installroot=/var/lib/lxc/test/rootfs install openssh-server openssh-clients", the package manager was run with custom python script wrapper in new namespace to set correct ownership for container fs (the script will not affect actual sshd running - that's just system preparation).

Then I configured LXC (installed from EPEL repo):

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.include = /usr/share/lxc/config/centos.userns.conf
lxc.arch = x86_64
lxc.start.auto = 1
lxc.cgroup.cpu.shares = 512
lxc.cgroup.memory.limit_in_bytes = 256M
lxc.cgroup.memory.memsw.limit_in_bytes = 320M
lxc.haltsignal = SIGTERM
lxc.mount.auto = proc:mixed sys:ro cgroup:mixed
lxc.pts = 64
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
lxc.network.ipv4 = IP_HERE
lxc.network.ipv4.gateway = IP_HERE
lxc.rootfs = /var/lib/lxc/test-test/rootfs
lxc.utsname = HOSTNAME


then started it with (tried with different -d / -D options later for verbose debug, etc):
lxc-start -dn test -- /usr/sbin/sshd -D

Comment 12 errata-xmlrpc 2020-03-31 19:10:34 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, 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/RHBA-2020:1005


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