From: Dan Pou <danielp@sgi.com>
To: SELinux-NSA <SELinux@tycho.nsa.gov>
Subject: Re: Programmatic domain change to unprivileged role
Date: Tue, 6 Aug 2013 15:37:51 -0500 [thread overview]
Message-ID: <20130806203751.GA14875@localhost> (raw)
In-Reply-To: <52015950.9010906@tycho.nsa.gov>
On Tue, Aug 06, 2013 at 04:15:12PM -0400, Stephen Smalley wrote:
> On 08/05/2013 03:07 PM, Dan Pou wrote:
> > I have an existing daemon that I am working to enable in an MLS setting,
> > but I am running into difficulties with calls to get a context of an
> > unprivileged user from the daemon context
> > (system_u:system_r:<name-of-service>_t:s0-s15:c0.c1023).
> > The deamon will run an executable with ID of an authenticated user, so I
> > looked at trying to replicate the method used by sshd.
> > When sshd calls get_default_context, there is a transition defined to go
> > to the user_u:user_r:user_t domain, but there is not one available from
> > the daemon context I have developed.
> > Is there a simpler example than ssh that I could look at to understand
> > how to specify transitions?
> > The daemon uses the fork+execve method, so I don't think that I need the
> > dyntransition method, but it is not clear to me how to specify all the
> > required transitions for executing any file available to an unprivileged
> > user.
>
> Are you looking for how to write the code to perform the context change,
> or how to write the policy to permit it to happen? Or both?
I am looking at both.
>
> If your question has to do with policy, then the refpolicy list or
> fedora selinux list may be better resources, as it will depend on the
> specific policy interfaces provided by refpolicy and/or your distribution.
I will give those a try as well.
>
> The result of get_default_context() is of course driven by the policy,
> so your ability to use it effectively depends on having the right policy
> in place first. Your daemon's domain will presumably need several of
> the interfaces defined in system/userdomain.if to permit the domain
> transition, along with interfaces from kernel/domain.if to permit
> switching user and role. Possibly something like:
> userdom_spec_domtrans_unpriv_users(X_t)
> userdom_bin_spec_domtrans_unpriv_users(X_t)
> userdom_entry_spec_domtrans_unpriv_users(X_t)
> domain_subj_id_change_exemption(X_t)
> domain_role_change_exemption(X_t)
I tried a number of these, but without success. I always get invalid
context when I use the get_default_context_with_level() or
get_ordered_context_list_with_level() functions with the fromcon set to
my daemon context.
Should these macros add the transitions? If it were a matter of denials
I would be OK, but my confusion arises from how to add all the necessary
transitions.
I assume I am missing something else that prevents my domain from being
a valid "from" context. The service successfully runs from run_init
(through the _exec_ transition).
Thank you,
Dan
--
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.
next prev parent reply other threads:[~2013-08-06 20:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 19:07 Programmatic domain change to unprivileged role Dan Pou
2013-08-06 20:15 ` Stephen Smalley
2013-08-06 20:37 ` Dan Pou [this message]
2013-08-07 12:28 ` Stephen Smalley
2013-08-07 12:41 ` Stephen Smalley
2013-08-08 19:58 ` Dan Pou
2013-08-09 9:59 ` Daniel J Walsh
2013-08-09 12:51 ` Stephen Smalley
2013-08-20 20:05 ` Dan Pou
2013-08-21 7:54 ` Dominick Grift
2013-08-21 14:05 ` Dan Pou
2013-08-21 15:58 ` Dominick Grift
2013-08-21 14:22 ` Stephen Smalley
2013-08-21 14:27 ` Stephen Smalley
2013-08-22 22:50 ` Dan Pou
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=20130806203751.GA14875@localhost \
--to=danielp@sgi.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.