From: Valdis.Kletnieks@vt.edu
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, mtk.manpages@googlemail.com
Subject: Re: MAC and pam_nologin (was Re: man-pages-3.15 is released)
Date: Sat, 06 Dec 2008 01:26:35 -0500 [thread overview]
Message-ID: <12563.1228544795@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Sat, 06 Dec 2008 14:04:07 +0900." <200812061404.EJG35994.MOJOFQFOLFHtVS@I-love.SAKURA.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]
On Sat, 06 Dec 2008 14:04:07 +0900, Tetsuo Handa said:
(Not really a LSM or kernel issue, and I think mtk.man does kernel
manpages only. At least on my Fedora and RedHat systems, the 'login' manpage
comes from util-linux, so any manpage fixes would go via that route).
> But this description becomes inaccurate when MAC (e.g. SELinux) is enabled.
>
> MAC can deny open("/etc/nologin", O_RDONLY) by root user. Thus,
>
> # ln /etc/shadow /etc/nologin
>
> will create /etc/nologin which is *not readable* by login(1).
> As a result, non-root user's logins are permitted while /etc/nologin *exists*
>
> I guess pam_nologin is using a code like
>
> fp = fopen("/etc/nologin", "r");
> if (fp)
> /* print the contents of /etc/nologin and reject login request. */
Rather than guessing, maybe a check of what the source code actually *does*
would be better?
> So, I think either one of below modifications is needed.
>
> (1) Change the description of manpage like
>
> If the file /etc/nologin *is readable*, login (1) will allow access only to
> root. Other users will be shown the contents of this file and their logins
> will be refused.
>
> (2) Change the code of pam_nologin like
>
> fd = open("/etc/nologin", O_RDONLY);
> if (fd != EOF || errno != ENOENT)
> /* print the contents of /etc/nologin and reject login request. */
(3) Recognize that a sysadmin who intentionally goes and creates a
/etc/nologin via insane means deserves the insane results. You have to
go out of your way to actually create a case where the distinction between
"exists" and "is readable" matters.
Having said that, we probably *should* fix 'man login' to say 'is readable'.
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
next prev parent reply other threads:[~2008-12-06 6:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-06 4:38 man-pages-3.15 is released Michael Kerrisk
2008-12-06 5:04 ` MAC and pam_nologin (was Re: man-pages-3.15 is released) Tetsuo Handa
2008-12-06 6:26 ` Valdis.Kletnieks [this message]
2012-04-15 20:47 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12563.1228544795@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mtk.manpages@googlemail.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®