all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Laura Lazzati <laura.lazzati.15@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: SELinux log
Date: Tue, 11 Jun 2019 14:23:37 +0200	[thread overview]
Message-ID: <87tvcw9upi.fsf@elephly.net> (raw)
In-Reply-To: <CAPNLzUN6WD+Y8uKkNGbLDffeZmiaemB9DRDwqRfXaD5zS5VKUA@mail.gmail.com>


Hi Laura,

> So we need to figure out what file that “guix” command corresponds to,
>> so that we can add a rule to the policy to apply the correct label.
>>
> I see. But how can we do this?

We then need to think about the kinds of file operations that the “guix”
command should be permitted to perform.  We know already that it should
be allowed to access files of type “guix_daemon_conf_t”.

What do you think: should we define a new type for the Guix command?  If
so, we need to declare it near the top:

  ;; Declare own types
  (type guix_daemon_t)
  …

We would add two new types: one is a file type “guix_client_exec_t”,
which will be given to the “guix” executables.  The file type should
allow the *process* spawned by the executable to operate in the
“guix_client_t” domain.

So, we’ll do this:

  (type guix_client_exec_t)
  (roletype object_r guix_client_exec_t)
  (type guix_client_t)
  (roletype object_r guix_client_t)

Since this type should not just be a file type but a *process* domain (=
a type for processes), we need to declare it as such, so this line

  (typeattributeset domain (guix_daemon_t guix_daemon_exec_t))

would become that line:

  (typeattributeset domain (guix_daemon_t guix_daemon_exec_t guix_client_t))

Now we need to permit a domain transition: a file with type
guix_client_exec_t (when executed) should cause the resulting process to
transition to the guix_client_t domain.  I’m not sure about this, but I
think we want this transition declaration:

  (typetransition guix_store_content_t guix_client_exec_t
                  process guix_client_t)

This means: when a process in guix_store_content_t spawns a
guix_client_exec_t process, let it run in the guix_client_t context.

And *now* we can add rules of access for processes running in the
guix_client_t domain, such as these read-only directory access
permissions:

  (allow guix_client_t
         guix_daemon_conf_t
         (dir (search
               getattr
               open read)))

and perhaps these read-only file access permissions:

  (allow guix_client_t
         guix_daemon_conf_t
         (file (map
                getattr
                open read)))

Lastly, we need to add a file rule, so that the guix executables all get
the right type.  The first step is to see what “guix” is:

    readlink -f $(which guix)

It’s probably a store item with a particular name that isn’t captured by
an explicit rule in etc/guix-daemon.cil yet.  We then add a rule to give
the “guix” file the proper label, something like the following, but with
a glob pattern matching the actual “guix” file:

  (filecon "@storedir@/…/bin/guix"
           file (system_u object_r guix_client_exec_t (low low)))

Every time we change the policy we need to run semanage to unload the
loaded policy and load the new one from file, then run restorecon to
relabel (a subset of the) files in /gnu.

A little tedious, but it should be manageable.  Would you like to give
it a try?

--
Ricardo

  reply	other threads:[~2019-06-11 12:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 21:28 SELinux log Laura Lazzati
2019-06-05  9:39 ` Ricardo Wurmus
2019-06-06 14:24   ` Laura Lazzati
2019-06-06 17:58     ` Ricardo Wurmus
2019-06-07  1:46       ` Laura Lazzati
2019-06-07 20:46         ` Ricardo Wurmus
2019-06-07 23:08           ` Laura Lazzati
2019-06-07 23:10             ` Laura Lazzati
2019-06-07 23:12               ` Laura Lazzati
2019-06-08  7:03                 ` Ricardo Wurmus
2019-06-08 14:36                   ` Laura Lazzati
2019-06-08 14:50                     ` Ricardo Wurmus
2019-06-08 14:57                       ` Laura Lazzati
2019-06-08 16:56                         ` Ricardo Wurmus
2019-06-09 16:29                           ` Laura Lazzati
2019-06-10  2:08                             ` Laura Lazzati
2019-06-10  8:12                               ` Ricardo Wurmus
2019-06-11 10:48                                 ` Laura Lazzati
2019-06-11 12:23                                   ` Ricardo Wurmus [this message]
2019-06-12  1:58                                     ` Laura Lazzati
2019-06-12  6:42                                       ` Ricardo Wurmus
2019-06-12 13:27                                         ` Laura Lazzati
2019-06-12 13:34                                           ` Ricardo Wurmus
2019-06-12 14:25                                             ` Laura Lazzati
2019-06-12 20:12                                               ` Ricardo Wurmus
2019-06-12 21:01                                                 ` Laura Lazzati
2019-06-13  6:49                                                   ` Ricardo Wurmus
2019-06-13 17:53                                                     ` Laura Lazzati
2019-06-13 18:52                                                       ` Ricardo Wurmus
2019-06-14 17:24                                                         ` Laura Lazzati
2019-06-16 22:15                                                           ` Laura Lazzati
2019-06-17  1:44                                                             ` Ricardo Wurmus
2019-06-17  3:32                                                               ` Laura Lazzati

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=87tvcw9upi.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=laura.lazzati.15@gmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

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.