Bug 14516 - ttyname incorrectly fails if procfs is not available
Summary: ttyname incorrectly fails if procfs is not available
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Siddhesh Poyarekar
URL:
Keywords:
: 3353 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-24 08:51 UTC by Siddhesh Poyarekar
Modified: 2014-06-17 13:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Siddhesh Poyarekar 2012-08-24 08:51:03 UTC
Description of problem:
SSH chroot using pam_chroot.so does not work when there is no mounted /proc inside the chroot. The ssh server throws the following error in /var/log/secure:

Aug 24 13:26:06 rawhide sshd[11735]: fatal: openpty returns device for which ttyname fails.

while the client shows the following error and disconnects:

Connection to localhost closed by remote host.
Connection to localhost closed.

This failure occurs because sshd calls ttyname() and fails due to /proc not being present inside the chroot.

How reproducible:
Always.

Steps to Reproduce:
1. Set up a chroot:
   - Create the root folder structure (bin, lib, etc, var, dev, dev/pts) with essential binaries
   - Mount /dev/pts over /chroot/dev/pts
2. Set the password for user view
3. Add the following to /etc/pam.d/sshd:

session    required    pam_chroot.so onerr=fail debug

4. ssh -1 view localhost

Actual results:

Connection to localhost closed by remote host.
Connection to localhost closed.

Expected results:

User logs in.
Comment 1 Siddhesh Poyarekar 2012-08-24 08:54:22 UTC
Step 2. should read "Set the password for a newly created user 'view'"
Comment 2 Siddhesh Poyarekar 2012-08-30 12:05:41 UTC
Fixed in master.
Comment 4 Florian Weimer 2014-06-17 13:39:21 UTC
*** Bug 3353 has been marked as a duplicate of this bug. ***