Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 6612 - pam_console not working?
Summary: pam_console not working?
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-16 17:53 UTC by Toby Dickenson
Modified: 2002-10-24 14:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/devfsd.conf (devfsd.conf,4.65 KB, text/plain)
2002-08-20 13:46 UTC, Martin Schlemmer (RETIRED)
Details
pam-0.75-pam_console-fix-fullpath-in-file-classes.patch (pam-0.75-pam_console-fix-fullpath-in-file-classes.patch,1.39 KB, patch)
2002-10-13 03:48 UTC, Martin Schlemmer (RETIRED)
Details | Diff
pam-0.75-pam_console-fix-fullpath-in-file-classes.patch (pam-0.75-pam_console-fix-fullpath-in-file-classes.patch,1.39 KB, patch)
2002-10-13 08:06 UTC, Martin Schlemmer (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toby Dickenson 2002-08-16 17:53:04 UTC
Ive been trying to get pam_console to work for a while, but it always ignored   
my /etc/security/console.perms file.   
   
I have isolated the problem down to the function check_console_name in   
/var/tmp/portage/pam-0.75-r7/work/Linux-PAM-0.75/modules/pam_console/config.y.   
   
This function is calling check_one_console_name with 'consolename', the name 
of the current login tty, as the first parameter. This is a string that starts   
/dev/. The second parameter is a range of console regular expressions loaded   
from the console.perms file. None of them start /dev/, so   
check_one_console_name never returns true.   
   
As a workaround I can add /dev/vc/[0-9][0-9]* to the end of the <console>=   
line in console.perms.  My whole console.perms line looks like: 
 
<console>=tty[0-9][0-9]* vc/[0-9][0-9]* :[0-9]\.[0-9] :[0-9] 
/dev/vc/[0-9][0-9]* 
 
   
I have not checked the RedHat sources to see what they do different.   
    
this is all with ebuild version 0.75-r7
Comment 1 Donny Davies (RETIRED) gentoo-dev 2002-08-17 14:49:25 UTC
Hmm, thanks for this info...

Azarah, should we tack on the additional /dev/vc/[0-9][0-9]* snip to
the console= line in console.perms?  I guess it sounds like a proper
fix.

/etc/security/console.perms looks to be exactly as distributed in
the $WORKDIR, so it doesnt look like a build problem per se.

But who knows :)  Whaddaya think?
Comment 2 Toby Dickenson 2002-08-18 05:50:10 UTC
Ive never seen the /dev/ prefix in console.perms before. Checking though the 
redhat documentation I see they use it for serial consoles. 
 
 
Im not sure what magic means they can omit the /dev/ prefix from /dev/tty0, 
but not /dev/ttyS0 
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2002-08-18 17:52:18 UTC
Using KDE ? if so, the KDE /etc/pam.d/ files do not use system-auth. Did
you try it yet at a console ?  Also update pam, as there went some needed
fixes in (or just remerge for fun =) ).
Comment 4 Toby Dickenson 2002-08-19 17:39:09 UTC
yes, I am using kde. I am aware that there is a different reason why 
pam_console doesnt work if you log in using kdm 
 
yes, this issue is definitely just relating to text console logins 
 
yes, my pam is current 
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2002-08-20 13:39:18 UTC
Hi, and sorry.  I must confess that I did not read this properly :-)

As for the real fix, this keeps coming up from time to time, but I keep
on forgetting to fix it.  Problem comes into using devfsd ...

For this to work, you need to add to /etc/devfsd.conf, and then restart
devfsd (killall -HUP devfsd):

# Uncomment this to let PAM manage devfs
REGISTER        .*           CFUNCTION /lib/security/pam_console_apply_devfsd.so
pam_console_apply_single $devpath

Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2002-08-20 13:46:28 UTC
Created attachment 3236 [details]
/etc/devfsd.conf

Just to clarify that the section that should be added consists only of
two lines (the comment, and the devfsd.conf entry), I added my devfsd.conf.
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2002-08-20 13:51:00 UTC
Erm, to maybe expand a bit ...

console.perms needs to be applied ... this is where pam_console_apply_devfsd.so
comes into play.  I cannot remember the full issue behind this, but if need
be ill look it up again.
Comment 8 Toby Dickenson 2002-08-20 22:20:53 UTC
> For this to work, you need to add to /etc/devfsd.conf, and then  
> restart devfsd (killall -HUP devfsd):  
  
> # Uncomment this to let PAM manage devfs  
> REGISTER        .*           CFUNCTION  
> /lib/security/pam_console_apply_devfsd.so  
> pam_console_apply_single $devpath  
  
No, thats a different issue. 
  
 
When a user logs in on a local console, pam_console tweaks some permissions on  
some files and records that user name in a lock file.  
  
pam_console_apply_devfsd is needed so that the permissions can be correctly  
tweaked when devfs dynamically creates a device when a user is already logged  
in on a local console. pam_console_apply_devfsd is implemented by checking  
that lock file (the one created by pam_console at login) and is completely  
independant of this problem.  
 
This issue is about which tty names pam_console  
considers to be 'local consoles' at the point when a user logs in. Currently 
pam does not consider the /dev/vc/0  ttys to be local consoles. Therefore it 
doesnt invoke the permissions tweaks, and doesnt create the lock file used by 
pam_console_apply_devfsd. 
  
  
  
Comment 9 Donny Davies (RETIRED) gentoo-dev 2002-08-24 11:52:28 UTC
So do we want to add the proposed config clause that's being suggested here?
Comment 10 Toby Dickenson 2002-08-25 02:49:03 UTC
I would like to know why the workaround is needed before recommending adding  
it to the standard config file.  
 
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-13 03:46:34 UTC
Ok, got the problem.  Seems like pam-login sets PAM_TTY to the fully
qualified filename of the tty, which then borks check_console_name().
I hacked pam-0.75-pam_console-fix-fullpath-in-file-classes.patch, which
should hopefully resolve this.  Tests ok this side.

This should be fixed in pam-0.75-r8.
Comment 12 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-13 03:48:04 UTC
Created attachment 4654 [details, diff]
pam-0.75-pam_console-fix-fullpath-in-file-classes.patch

Patch that "fixes" this problem.
Comment 13 Toby Dickenson 2002-10-13 07:26:26 UTC
That patch looks basically sound.  I think the last  
if (check_one_console_name(consolename, c->name)) { 
should be 
if (check_one_console_name(consolename, full_path)) { 
  
> pam-login sets PAM_TTY to the fully qualified filename of the tty  
  
Note that the pam documentation  
(/usr/share/doc/pam-0.75-r7/txt/pam_appl.txt.gz) requires this.  
Comment 14 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-13 07:44:05 UTC
Hmm, you are correct .. only slept 4 hours in the last 24 .. what can I say =).
Will fix the patch asap.

As for the PAM_TTY .. not sure if the propragated from login shadow side,
or util-linux side, but I am guessing if Redhat/Mandrake use it without problems,
then their login do not follow PAM spec.
Comment 15 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-13 08:06:26 UTC
Created attachment 4662 [details, diff]
pam-0.75-pam_console-fix-fullpath-in-file-classes.patch

Should be the proper one.