All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Higgs, Stephen" <Stephen.Higgs@icfi.com>
To: Stephen Smalley <sds@tycho.nsa.gov>,
	"selinux@tycho.nsa.gov" <selinux@tycho.nsa.gov>
Subject: RE: selinux category relabel (puppet)
Date: Fri, 13 Mar 2015 21:17:36 +0000	[thread overview]
Message-ID: <6d80ec39a885492792f446972fb5facc@VNUCITEX02.ICFI.icfconsulting.com> (raw)
In-Reply-To: <550326BD.10207@tycho.nsa.gov>

> >>> Hello all,
> >>>
> >>>
> >>>
> >>> If there is a more appropriate forum for this question please let me know:
> >>>
> >>>
> >>>
> >>> I have a system that uses confined users by default and some files
> >>> are managed by a puppet server.  When I run (via run_init) the
> >>> puppet startup script, I get the following avc log:
> >>>
> >>>
> >>>
> >>> avc: denied { relabelto } for pid=30707 comm="puppet" name="crl.pem"
> >>> dev=dm-1 ino=527257 scontext=system_u:system_r:puppet_t:s0
> >>> tcontext=system_u:object_r:puppet_var_lib_t:s0:c0.c1023 tclass=file
> >>>
> >>> I added "typeattribute puppet_t can_change_object_identity" and
> >>> appropriate "allow" statements to the puppet_t type after reading
> >>> the constraints in the targeted policy. However, it was the category
> >>> "s0:c0.c1023" that was also preventing puppet from relabeling the
> >>> crl.pem file.
> >>>
> >>> I was able to fix this by manually relabeling the file to "s0"
> >>> instead of "s0:c0.c1023". My question is, how *should* I handle this
> >>> so puppet can handle the relabel of the category?
> >>
> >> It requires an appropriate attribute for the mcs or mls constraint
> >> that is blocking access.  Which attribute depends on your policy; MCS
> >> in particular has changed a lot over time in Fedora and RHEL.  What distro &
> version?
> >>
> >
> > I'm using CentOS / RedHat 6.6, targeted reference policy 24.
> 
> Hmmm...looking at selinux-policy-3.7.19-260.el6.src.rpm,
> serefpolicy-3.719/policy/mcs has this:
> 
> # New filesystem object labels must be dominated by the relabeling subject #
> clearance, also the objects are single-level.
> mlsconstrain file { create relabelto }
>         (( h1 dom h2 ) and ( l2 eq h2 ));
> 
> So no attributes are exempted from that constraint; your only option is to run
> puppet ranged (i.e. as system_u:system_r:puppet_t:s0-s0:c0.c1023)
> so that its high level dominates any potential file level.
> 
> You should be able to do that with a range_transition rule, e.g.
> range_transition initrc_t puppet_exec_t:process s0 - s0:c0.c0123; (assuming
> that the puppet entrypoint is labeled with puppet_exec_t).

Thanks Stephen, this makes sense to me, but I can't get that statement to compile in my policy module:

   Compiling targeted puppet module
   /usr/bin/checkmodule:  loading policy configuration from tmp/puppet.tmp
   puppet.te":14:ERROR 'unknown level s0-s0 used in range_transition definition' at token ';' on line 1041:
   range_transition initrc_t puppet_exec_t:process s0-s0:c0.c1023;
   #init_ranged_daemon_domain(puppet_t,puppet_exec_t,s0-s0:c0.c1023);
   /usr/bin/checkmodule:  error(s) encountered while parsing configuration
   make: *** [tmp/puppet.mod] Error 1

I did try checkmodule as well, and I tried using the init_ranged_daemon_domain macro.  Here is the policy module that I am trying to compile:

   module puppet 1.2;
   require {
           type puppet_t;
           type puppet_exec_t;
           type initrc_t;
           attribute can_change_object_identity;
           class process { transition }; 
   }
   typeattribute puppet_t can_change_object_identity;
   #init_ranged_daemon_domain(puppet_t,puppet_exec_t,s0-s0:c0.c1023); 
   range_transition initrc_t puppet_exec_t:process s0-s0:c0.c1023;

I feel like I'm close, but perhaps I'm missing how to import  the level definitions?

  reply	other threads:[~2015-03-13 21:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 13:52 selinux category relabel (puppet) Higgs, Stephen
2015-03-13 17:40 ` Stephen Smalley
2015-03-13 17:52   ` Higgs, Stephen
2015-03-13 17:54     ` Stephen Smalley
2015-03-13 17:58       ` Higgs, Stephen
2015-03-13 18:02     ` Dominick Grift
2015-03-13 18:04     ` Stephen Smalley
2015-03-13 21:17       ` Higgs, Stephen [this message]
2015-03-13 21:31         ` Dominick Grift
2015-03-16 12:43           ` Miroslav Grepl
2015-03-16 12:55         ` Stephen Smalley
2015-03-16 15:20           ` Higgs, Stephen
2015-03-16 15:55             ` Stephen Smalley
2015-03-16 16:17               ` Higgs, Stephen
2015-03-16 17:09                 ` Dominick Grift
2015-03-17 15:00                   ` Higgs, Stephen

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=6d80ec39a885492792f446972fb5facc@VNUCITEX02.ICFI.icfconsulting.com \
    --to=stephen.higgs@icfi.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.