All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Anderson <mra@hp.com>
To: selinux@tycho.nsa.gov
Subject: trouble with a transition to verify access to a printer
Date: Tue, 15 Aug 2006 11:02:45 -0400	[thread overview]
Message-ID: <44E1E215.30602@hp.com> (raw)

I'm having some trouble verifying a user has access to a given printer.
 In the CUPS architecture a user submits their job over a socket
connection to the server which queues it and eventually prints it.  The
server can get the client's context via getpeercon() and that
information is stored as metadata with the job.  Often the context is
user_u:user_r:user_lpr_t:SystemLow  and the context of the running cupsd
is system_u:system_r:cupsd_t:SystemLow-SystemHigh.

In order to keep the security decisions out of cupsd it was suggested
that a helper program be used.  The cupsd server could setexeccon() this
program with the job's stored context and the helper would use access()
to determine if it could write to the printer device (typically
/dev/parport0 with context system_u:object_r:printer_device_t:SystemLow)

When run in enforcing mode however I get the following AVC deny message:

type=AVC msg=audit(1155470231.462:11179): avc:  denied  { transition }
for  pid=3046 comm="cupsd" name="lspp-access" dev=sda4 ino=420583
scontext=system_u:system_r:cupsd_t:s0-s15:c0.c255
tcontext=user_u:user_r:user_lpr_t:s0 tclass=process

I've included the audit2allow output below based on running in
permissive mode.  Even after loading the module it generates I still get
the same AVC deny on the transition.

pebenito suggested on #selinux that since cupsd was switching identities
and roles that was causing the deny.  If thats the case, is there anyway
around that?  Is there a better way to solve this problem?

thanks
-matt

require {
      class chr_file { read write };
      class fd use;
      class file { entrypoint read };
      class process { noatsecure rlimitinh sigchld siginh transition };
      class unix_stream_socket write;
      type cupsd_exec_t;
      type cupsd_t;
      type printer_device_t;
      type setrans_t;
      type user_lpr_t;
      role system_r;
      role user_r;
};

allow cupsd_t user_lpr_t:process { noatsecure rlimitinh };
allow cupsd_t user_lpr_t:process { siginh transition };
allow setrans_t self:unix_stream_socket write;
allow user_lpr_t cupsd_exec_t:file { entrypoint read };
allow user_lpr_t cupsd_t:fd use;
allow user_lpr_t cupsd_t:process sigchld;
allow user_lpr_t printer_device_t:chr_file { read write };

--
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.

             reply	other threads:[~2006-08-15 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15 15:02 Matt Anderson [this message]
2006-08-16 14:48 ` trouble with a transition to verify access to a printer Christopher J. PeBenito

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=44E1E215.30602@hp.com \
    --to=mra@hp.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.