All of lore.kernel.org
 help / color / mirror / Atom feed
From: guido@trentalancia.com (Guido Trentalancia)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] restorecon needs to read bin_t symlinks
Date: Sat, 19 Mar 2011 20:54:46 +0100	[thread overview]
Message-ID: <1300564486.3101.14.camel@tesla.lan> (raw)
In-Reply-To: <1300554772.3034.28.camel@tesla.lan>

On Sat, 19/03/2011 at 18.12 +0100, Guido Trentalancia wrote:
> On Sat, 19/03/2011 at 16.51 +0100, Dominick Grift wrote:
> > On 03/19/2011 04:45 PM, Guido Trentalancia wrote:
> > > Hello !
> > > 
> > > I have recently started to experience AVC denials due to restorecon
> > > trying to read bin_t symbolic links. It is not entirely clear to me what
> > > is triggering this, since everything has been working fine for a long
> > > time.
> > > 
> > > In any case, I had to apply the following patch on my system (and I am
> > > still asking myself why not files_read_all_symlinks then ?):
> > > 
> > > diff -pruN refpolicy-git-17032011/policy/modules/kernel/files.if refpolicy-git-17032011-restorecon/policy/modules/kernel/files.if
> > > --- refpolicy-git-17032011/policy/modules/kernel/files.if	2011-02-22 18:50:44.460551925 +0100
> > > +++ refpolicy-git-17032011-restorecon/policy/modules/kernel/files.if	2011-03-19 16:21:01.701636861 +0100
> > > @@ -4425,7 +4425,28 @@ interface(`files_relabelfrom_usr_files',
> > >  
> > >  ########################################
> > >  ## <summary>
> > > -##	Read symbolic links in /usr.
> > > +##	Read symbolic links with type
> > > +##	bin_t (usually located in /bin,
> > > +##	/sbin, /usr/bin and /usr/sbin).
> > > +## </summary>
> > > +## <param name="domain">
> > > +##	<summary>
> > > +##	Domain allowed access.
> > > +##	</summary>
> > > +## </param>
> > > +#
> > > +interface(`files_read_bin_symlinks',`
> > 
> > This interface is already available in corecommands module:
> > 
> > corecmd_read_bin_symlinks()
> > 
> > can you enclose the AVC denial that you were seeing?
> > 
> > It is probably this:
> > 
> > ls -alZ /sbin/restorecon
> > lrwxrwxrwx. root root system_u:object_r:bin_t:s0       /sbin/restorecon
> > - -> setfiles
> 
> Yes, apart from the duplicate interface, the restorecon symbolic link is
> created by the original Makefile from policycoreutils. It's fine to me
> if setfiles is just copied off instead of linked.

Actually it has nothing to do with restorecon being a symbolic link to
the setfiles binary.

Without the "read" capability restorecon is not able to relabel the
target file. This is quite bad as we could have non-standard things such
as:

ls -al /bin/example_executable
lrwxrwxrwx. root root /bin/example_executable
-> /opt/example/example_application

and example_application never getting relabelled as bin_t (but instead
falling back to usr_t).

If "file_type:lnk_file read" does not imply the ability to read the
actual content of the target file then perhaps we could even use
files_read_all_symlinks().

And by the way setfiles/restorecon might also need
logging_send_audit_msgs(setfiles_t).

Regards,

Guido

  reply	other threads:[~2011-03-19 19:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19 15:45 [refpolicy] restorecon needs to read bin_t symlinks Guido Trentalancia
2011-03-19 15:51 ` Dominick Grift
2011-03-19 17:12   ` Guido Trentalancia
2011-03-19 19:54     ` Guido Trentalancia [this message]
2011-03-19 20:05       ` Sven Vermeulen
2011-03-19 20:25         ` Guido Trentalancia
2011-03-19 20:38         ` Guido Trentalancia
2011-03-21 13:29           ` Christopher J. PeBenito
     [not found]   ` <1300555758.3034.35.camel@tesla.lan>
     [not found]     ` <4D84E955.8030304@gmail.com>
     [not found]       ` <1300556614.3034.47.camel@tesla.lan>
     [not found]         ` <4D84EBC4.2050504@gmail.com>
     [not found]           ` <1300557149.3034.52.camel@tesla.lan>
     [not found]             ` <4D84EE9B.20604@gmail.com>
     [not found]               ` <1300558205.18208.2.camel@tesla.lan>
2011-03-19 18:15                 ` Dominick Grift
2011-03-22 12:12                   ` Daniel J Walsh

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=1300564486.3101.14.camel@tesla.lan \
    --to=guido@trentalancia.com \
    --cc=refpolicy@oss.tresys.com \
    /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.