All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: Ian Pilcher <arequipeno@gmail.com>,
	SElinux list <selinux@vger.kernel.org>
Subject: Re: File context rule for file in /run not working
Date: Tue, 01 Aug 2023 09:40:16 +0200	[thread overview]
Message-ID: <87il9zxlb3.fsf@redhat.com> (raw)
In-Reply-To: <e957f5f5-fc75-ed17-7f6d-9db44d3287a5@gmail.com>

Ian Pilcher <arequipeno@gmail.com> writes:

> # semanage fcontext -l | grep /run/acg
> /run/acg-httpd-reload    all files    system_u:object_r:acg_var_run_t:s0
>
> # ls -Z /run/acg-httpd-reload
> system_u:object_r:var_run_t:s0 /run/acg-httpd-reload
>
> # restorecon /run/acg-httpd-reload
>
> # ls -Z /run/acg-httpd-reload
> system_u:object_r:var_run_t:s0 /run/acg-httpd-reload
>
> What in the world am I doing wrong?
>
> (This rule is part of a policy module, and all of the other rules in the
> module work just fine.)
>

In Fedora there's an equal rule which substitutes /run to /var/run
before a label is generated:

   # semanage fcontext -l
   ...
   SELinux Distribution fcontext Equivalence 

   /run = /var/run

.i.e you need to specify fc rule using /var/run/... SPEC as /run/...
SPEC is overridden by the equal rule:

    # echo '(filecon "/run/myrpmvarrunt" file (system_u object_r rpm_var_run_t ((s0) (s0))))' > myrpmvarrunt.cil
    # semodule -i myrpmvarrunt.cil 
    # selabel_lookup -b file -k /run/myrpmvarrunt
    Default context: system_u:object_r:var_run_t:s0

    # echo '(filecon "/var/run/myrpmvarrunt" file (system_u object_r rpm_var_run_t ((s0) (s0))))' > myrpmvarrunt.cil
    # semodule -i myrpmvarrunt.cil 
    # selabel_lookup -b file -k /run/myrpmvarrunt
    Default context: system_u:object_r:rpm_var_run_t:s0


      reply	other threads:[~2023-08-01  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  2:03 File context rule for file in /run not working Ian Pilcher
2023-08-01  7:40 ` Petr Lautrbach [this message]

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=87il9zxlb3.fsf@redhat.com \
    --to=lautrbach@redhat.com \
    --cc=arequipeno@gmail.com \
    --cc=selinux@vger.kernel.org \
    /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.