All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Jason Johnson <jason.johnson.081@gmail.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: Possible bug with fd class?
Date: Thu, 18 Jun 2009 08:48:12 -0400	[thread overview]
Message-ID: <1245329292.3033.89.camel@localhost.localdomain> (raw)
In-Reply-To: <aa22f0200906172153n2c67abcj1309a76208c5b96e@mail.gmail.com>

On Thu, 2009-06-18 at 06:53 +0200, Jason Johnson wrote:
> On Wed, Jun 17, 2009 at 9:13 PM, Stephen Smalley <sds@tycho.nsa.gov>
> wrote:
>         > On Wed, Jun 17, 2009 at 2:26 PM, Stephen
>         Smalley<sds@tycho.nsa.gov> wrote:
>         > >> >
>         
>         
>         This just means that logrotate invoked syslog-ng while holding
>         open a
>         descriptor to /dev/null.  Nothing more.
>         
>         
>         --
>         Stephen Smalley
>         National Security Agency
>         
>         
> 
> Ah!  I checked the logrotate configuration and I do see that daily it
> invokes:
> 
> /usr/sbin/invoke-rc.d syslog-ng reload >/dev/null
> 
> So that makes the /dev/null file descriptor that fd 2 (stdout) is
> opened to be logrotate_t?  Thanks very much for helping me understand
> how this is happening.
> 
> My one concern here is the solution.  What I would want to say from a
> high level is: "logrotate is allowed to run syslog-ng" or even more
> correct "logrotate is allowed to run the init.d syslog-ng script".
> What I actually have to say is: "syslog-ng is allowed to write to
> filedescriptors owned by logrotate".
> 
> I understand now why this situation happens, it just strikes me as an
> extremely low level interface.  What I have to do to allow logrotate
> to run syslog doesn't look very much like "let logrotate run
> syslog-ng's init.d script".  Further, since file descriptors are
> always inherited from the parent, wouldn't any program ran from any
> other program have a similar situation?  For example, if I took out
> the redirect to /dev/null then I would expect to get the same deny on
> whatever tty or file logrotate has connected to stdout.  Thoughts?
> 
> And thanks again everyone for your responses.

(restored cc line)

The policy already has rules to allow the transition from logrotate_t to
initrc_t when executing an init script, and from initrc_t to syslogd_t
when executing syslog-ng.  Further, the policy already has rules to
allow the initrc_t to inherit a descriptor from logrotate_t, and to
allow syslogd_t to inherit a descriptor from initrc_t.  What is missing
is a rule to allow syslogd_t to inherit a descriptor originally opened
by logrotate_t, as that is an indirect relationship.

If you really don't want to use the fd use controls, and only care about
the checks on the actual files, then you can disable the fd use controls
by enabling the allow_domain_fd_use boolean (at least in the Fedora
policy).

-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

      parent reply	other threads:[~2009-06-18 12:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16  4:48 Possible bug with fd class? Jason Johnson
2009-06-16  5:18 ` KaiGai Kohei
2009-06-16 17:31   ` Jason Johnson
2009-06-16 20:01     ` Stephen Smalley
2009-06-16 21:13       ` Jason Johnson
2009-06-17 12:26         ` Stephen Smalley
2009-06-17 18:28           ` Jason Johnson
2009-06-17 19:13             ` Stephen Smalley
2009-06-17 19:17               ` Stephen Smalley
     [not found]               ` <aa22f0200906172153n2c67abcj1309a76208c5b96e@mail.gmail.com>
2009-06-18 12:48                 ` Stephen Smalley [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=1245329292.3033.89.camel@localhost.localdomain \
    --to=sds@tycho.nsa.gov \
    --cc=jason.johnson.081@gmail.com \
    --cc=selinux@tycho.nsa.gov \
    /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.