All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Valdis.Kletnieks@vt.edu
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	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: Mon, 16 Apr 2012 08:47:42 +1200	[thread overview]
Message-ID: <CAKgNAkh+mnOW8ko7NRHeRJqLdX0_HT-Uzm2jnMeVzSe=E2a0JQ@mail.gmail.com> (raw)
In-Reply-To: <12563.1228544795@turing-police.cc.vt.edu>

Hello Tetsuo Handa,

On Sat, Dec 6, 2008 at 7:26 PM,  <Valdis.Kletnieks@vt.edu> wrote:
> 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'.

I added the words "and is readable" to nologin.5.

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

      reply	other threads:[~2012-04-15 20:48 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
2012-04-15 20:47     ` Michael Kerrisk (man-pages) [this message]

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='CAKgNAkh+mnOW8ko7NRHeRJqLdX0_HT-Uzm2jnMeVzSe=E2a0JQ@mail.gmail.com' \
    --to=mtk.manpages@gmail.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.