All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ole Kliemann <ole@plastictree.net>
To: selinux@tycho.nsa.gov
Subject: Writing policy: default_contexts etc.
Date: Mon, 23 Jul 2012 14:49:11 +0200	[thread overview]
Message-ID: <20120723124911.GA6980@telvanni> (raw)

[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]

I'm in the process of writing a simple policy from scratch.  
Everything works as expected, except for logins.

I have a user named tfm on my system.
/etc/selinux/mypolicy/seusers looks like:
    
    tfm:tfm_u
    root:system_u

In my policy I have a user tfm_u with roles tfm_r. tfm_r has 
several types, for example xserver_tfm_t. I also have a user 
system_u with role unconfined_r and type unconfined_t.

Using runcon I can transition from 
system_u:unconfined_r:unconfined_t to tfm_u:tfm_r:xserver_tfm_t. 

I figured I have to tell the login programs which context to 
choose per default. My login programs run as 
system_u:unconfined_r:unconfined_t, so I added to 
/etc/selinux/mypolicy/contexts/default_contexts the line

    unconfined_r:unconfined_t   tfm_r:xserver_tfm_t

I also have in /etc/selinux/mypolicy/contexts/default_type

    unconfined_r:unconfined_t
    tfm_r:xserver_tfm_t

I can login as root and have context 
system_u:unconfined_r:unconfined_t.

I cannot login as tfm, because:

pam_selinux(login:session): Unable to get valid context for tfm


Apparently I am missing something, just can't find what.

In general I find it difficult to find comprehensive 
documentation about the userland tools' interaction with the 
policy conifguration. On top of that error messages are often 
uninformative. (Random example: when the file 
/etc/selinux/mypolicy/contexts/files/file_contexts is missing, 
useradd without any output exits with return code 12. Which says 
'cannot create homedir' but contains no clue about the reason for 
the failure.)

So any hint on the above problem or hints on good places I could 
read up on the topic would be highly appreciated!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

                 reply	other threads:[~2012-07-23 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120723124911.GA6980@telvanni \
    --to=ole@plastictree.net \
    --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.