unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] Add SELinux policy for guix-daemon.
Date: Thu, 25 Jan 2018 18:14:51 +0100	[thread overview]
Message-ID: <87inbpsvw4.fsf@gnu.org> (raw)
In-Reply-To: <idjefmd6hh1.fsf@bimsb-sys02.mdc-berlin.net> (Ricardo Wurmus's message of "Thu, 25 Jan 2018 17:17:14 +0100")

Hello!

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> attached is a patch that adds an SELinux policy for the guix-daemon.
> The policy defines the guix_daemon_t domain and specifies what labels
> may be accessed and how by processes running in that domain.

Impressive!  I know nothing about SELinux so I can’t comment on the
specifics.

> These file labels are defined:

[...]

> The audit log shouldn’t show you any complaints.  At this point you
> could probably switch to enforcing mode, but I haven’t tested this
> myself for no particular reason.

What about putting this text in a new “SELinux Support” section or
similar, along with the current limitations?

> Open issues:

[...]

> * A possible problem is that I assign all files with a name matching
>   “/gnu/store/.+-(guix-.+|profile)/bin/guix-daemon” the label
>   “guix_daemon_exec_t”; this means that *any* file with that name in any
>   profile would be permitted to run in the guix_daemon_t domain.  This
>   is not ideal.  An attacker could build a package that provides this
>   executable and convince a user to install and run it, which lifts it
>   into the guix_daemon_t domain.  At that point SELinux could not
>   prevent it from accessing files that are allowed for processes in that
>   domain (such as the actual daemon).
>
>   This makes me wonder if we could do better by generating a much more
>   restrictive policy at installation time, so that only the *exact* file
>   name of the currently installed guix-daemon executable would be
>   labelled with guix_daemon_exec_t, instead of using a regular
>   expression like that.  This means that root would have to
>   install/upgrade the policy at installation time whenever the Guix
>   package that provides the effectively running guix-daemon executable
>   is upgraded.  Food for thought.

Yeah, guix-daemon.service currently refers to
/var/guix/profiles/…/guix-daemon for similar reasons.

> From d20bae0953d5d0a6bf1c06ab44505af6dea4df4d Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Thu, 25 Jan 2018 15:21:07 +0100
> Subject: [PATCH] etc: Add SELinux policy for the daemon.
>
> * etc/guix-daemon.cil.in: New file.
> * Makefile.am: Add dist_selinux_policy_DATA.
> * configure.ac: Handle --with-selinux-policy-dir.

[...]

> --- /dev/null
> +++ b/etc/guix-daemon.cil.in
> @@ -0,0 +1,281 @@
> +; -*- lisp -*-

Perhaps add a comment like:

  ;; This is a specification for SELinux X.Y written in the SELinux
  ;; Common Intermediate Language (CIL).

Fun that it uses sexps.  :-)

Thanks!

Ludo’.

  reply	other threads:[~2018-01-25 17:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 16:17 [PATCH] Add SELinux policy for guix-daemon Ricardo Wurmus
2018-01-25 17:14 ` Ludovic Courtès [this message]
2018-01-26 11:18 ` Catonano
2018-01-26 14:47   ` Ricardo Wurmus
2018-02-11 12:39 ` Catonano
2018-02-11 13:40   ` Ricardo Wurmus
2018-02-15 14:00     ` Alex Vong
2018-02-15 15:32       ` Ricardo Wurmus
2018-02-16  6:50         ` Gábor Boskovits
2018-02-16  7:46           ` Alex Vong
2018-02-16  7:49         ` Alex Vong
2018-02-16 12:54           ` Gábor Boskovits
2018-02-16 15:58             ` Ricardo Wurmus
2018-02-16 16:00           ` Ricardo Wurmus
2018-02-13 15:30 ` Catonano
2018-02-13 16:29   ` Ricardo Wurmus
2018-02-13 19:46 ` Efraim Flashner
2018-02-13 19:53   ` Leo Famulari

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87inbpsvw4.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ricardo.wurmus@mdc-berlin.de \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).