All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Grubb <sgrubb@redhat.com>
To: Eric Paris <eparis@redhat.com>
Cc: KaiGai Kohei <kaigai@ak.jp.nec.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	James Morris <jmorris@namei.org>,
	Eric Paris <eparis@parisplace.org>,
	selinux@tycho.nsa.gov
Subject: Re: type bounds audit messages
Date: Mon, 15 Jun 2009 10:08:18 -0400	[thread overview]
Message-ID: <200906151008.19343.sgrubb@redhat.com> (raw)
In-Reply-To: <1245071835.3247.57.camel@dhcp231-142.rdu.redhat.com>

On Monday 15 June 2009 09:17:15 am Eric Paris wrote:
> On Mon, 2009-06-15 at 15:56 +0900, KaiGai Kohei wrote:
> > The attached patch allows to generate audit messages on access violations
> > related to bounds types.
> >
> > 1. When a multithread process gives an unbounded domain to setcon(3)
> >    to change its domain dynamically, the current kernel denies it
> >    without any notification or audit messages.

Oops. This should be fixed. Eventually this will go through a CC evaluation and 
it will require access violations to be audited.


> >    This patch adds an audit_log() in the security_bounded_transition()
> >    to generate an audit message, when the dynamic type transition is
> >    failed due to the bounds violation.
> >
> >    Example:
> >    type=SELINUX_ERR msg=audit(1245046106.725:65): SELinux: bounds
> > violation: \ domain transition from httpd_t to guest_webapp_t

SELINUX_ERR audit type is for SE Linux error conditions and nothing else. This 
is an access violation so it should probably be an avc or a new type.

> Everything that includes audit_log_* from now on better be of the type
> key=value.

Agreed.


> How would people on list feel about?
>
> type=SELINUX_ERR msg=audit(1245046106.725:65): lsm="SELinux" \

The type should be changed. Also, the lsm field is not required because the 
audit type is in the SE Linux block.

>     op="bounds violation on domain transition" type1="httpd_t" \
>     type2="guest_webapp_t"
>
> This would be the only place I can remember that we only output the type
> instead of the complete context.  Why not ocontext= and ncontext=?  I
> don't care what we call it, but I want it all to be key=value pairs and
> I prefer that we (the audit system) starts making much heavier use of
> audit_log_string() which includes the ""

This is required if a non-admin can influence the field contents in any way. But 
we have to have information on the subject, object, what kind of access, and 
what the decision was. We also need to identify who did it and what session 
its related to. This can be done with a syscall audit record.


> > 2. When a set of permissions are masked due to the bounds violations,
> >    it shall be reported on the type_attribute_bounds_av() invoked from
> >    context_struct_context_av(), but it keeps silent on any AVC denials.
> >    It may make unclear what permissions were in violation of the
> > boundary. This patch adds the "masked" field on av_decision, and it
> > reports violated permissions on AVC denials.
> >
> >    Example:
> >    type=AVC msg=audit(1245046439.315:72): avc:  denied  { create }     \
> >      for pid=3080 comm="httpd" name="hoge"                             \
> >      scontext=unconfined_u:system_r:user_webapp_t:s0                   \
> >      tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=file \
> >      bounds: { create }
> >      ^^^^^^^^^^^^^^^^^^
>
> This one I'm still unhappy about but since it is continuing the
> tradition of hard to parse audit rules I'm ok if it stays (assuming
> tools like audit2allow don't get confused)

That last field should be something like bounds=create. There is an audit 
parsing library that makes parsing audit events very easy. It has python 
bindings, too.


> Now might be a perfect time to start emitting permissions in a better
> format though, maybe someday the rest of selinux could convert to an
> easier to parse format (ha ha, ok, I know it's funny)
>
> bounds="create"
>
> someday we might have perms="read write create open ioctl" instead of
> { ... } ???

Make that comma separated instead of space separated and I'm happy.

Thanks,
-Steve

--
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-15 14:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1244730288.10762.120.camel@localhost.localdomain>
     [not found] ` <4A31A33F.2040504@ak.jp.nec.com>
     [not found]   ` <1244807594.18947.62.camel@localhost.localdomain>
2009-06-15  6:56     ` type bounds audit messages KaiGai Kohei
2009-06-15 13:17       ` Eric Paris
2009-06-15 14:01         ` Stephen Smalley
2009-06-15 14:14           ` Eric Paris
2009-06-16  0:43           ` KaiGai Kohei
2009-06-16 14:26             ` Eric Paris
2009-06-16 14:40               ` Steve Grubb
2009-06-16 14:55                 ` Eric Paris
2009-06-16 15:19                   ` Daniel J Walsh
2009-06-16 17:18                     ` Stephen Smalley
2009-06-17 13:10                       ` Daniel J Walsh
2009-06-16 15:23                   ` Steve Grubb
2009-06-16 15:30                     ` Daniel J Walsh
2009-06-16 15:41                     ` Eric Paris
2009-06-17  4:35                       ` KaiGai Kohei
2009-06-17 12:53                         ` Stephen Smalley
2009-06-18  8:26                           ` KaiGai Kohei
2009-06-18 12:50                             ` Stephen Smalley
2009-06-18 14:18                             ` James Morris
2009-06-18  8:35                           ` KaiGai Kohei
2009-06-18 12:54                             ` Stephen Smalley
2009-06-15 14:08         ` Steve Grubb [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=200906151008.19343.sgrubb@redhat.com \
    --to=sgrubb@redhat.com \
    --cc=eparis@parisplace.org \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=kaigai@ak.jp.nec.com \
    --cc=sds@tycho.nsa.gov \
    --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.