All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Cengia <mattcen@cyber.com.au>
To: Russell Coker <russell@coker.com.au>
Cc: Stephen Smalley <sds@tycho.nsa.gov>, selinux@tycho.nsa.gov
Subject: Re: overlayfs+selinux error: OPNOTSUPP
Date: Thu, 24 Sep 2015 17:00:23 +1000	[thread overview]
Message-ID: <20150924070022.GA22582@cyber.com.au> (raw)
In-Reply-To: <201509231323.31482.russell@coker.com.au>

[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

On 2015-09-23 13:23, Russell Coker wrote:
[...]
> To load the policy in the initrd you need to copy 
> /etc/selinux/default/policy/policy.* and /usr/sbin/load_policy to the initrd 
> and first mount /proc and the selinuxfs before loading the policy.  It will be 
> a little fiddly to setup (as does anything involving the initrd) but not any 
> great challenge.
> 
> Also it's unlikely that systemd has been tested in a situation where an initrd 
> loads the policy.  In case anyone wonders, I think it should be considered a 
> bug if systemd or SysVInit fails to work when the policy was loaded in the 
> initrd.

Thanks Russell!

Just a quick email to let you all know that with the below code in my
build script, I successfully copied in and loaded the SELinux policy in
the initrd, and my EOPNOTSUPP errors disappeared, allowing me to boot
the system!

That's Good Enough™ for me for the moment, and I can revisit using a
more minimal policy or similar later if necessary. For now, I'm going to
ensure I'm using Russell's latest Debian Jessie-compatible SELinux
policy to see what AVC denials I'm getting, before deciding whether to
just go with that and tweak it to do the few lockdowns I need, or learn
how to write a new one from scratch.

I suspect writing a full policy will be deferred until quite some time
later if I can get something small sorted out in the short-term, as I'm
on a reasonably tight timeline at the moment, having spent a month
fighting this problem and the ones leading up to it.

Thanks again for all your help everyone!

diff --git c/bootstrap w/bootstrap
index c38651e..cb45635 100755
--- c/bootstrap
+++ w/bootstrap
@@ -401,0 +402,16 @@ setfiles -r $t/ $t/etc/selinux/default/contexts/files/file_contexts $t/
+>$t/etc/initramfs-tools/hooks/selinux   cat <<'EOF' && chmod +x $t/etc/initramfs-tools/hooks/selinux
+#!/bin/bash
+[ prereqs = "$1" ] && exit 0
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /usr/sbin/load_policy
+cp -a {,"$DESTDIR"}/etc/selinux/
+EOF
+>$t/etc/initramfs-tools/scripts/init-top/selinux  cat <<'EOF' && chmod +x $t/etc/initramfs-tools/scripts/init-top/selinux
+#!/bin/sh
+[ prereqs = "$1" ] && exit 0
+
+mount -t selinuxfs selinuxfs /sys/fs/selinux
+load_policy
+EOF
+chroot $t update-initramfs -u -k all

-- 
Regards,
Matthew Cengia

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

  parent reply	other threads:[~2015-09-24  7:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21  2:25 overlayfs+selinux error: OPNOTSUPP Matthew Cengia
2015-09-21 20:42 ` Stephen Smalley
2015-09-21 20:47   ` Stephen Smalley
2015-09-22  1:24     ` Matthew Cengia
2015-09-22 13:36       ` Stephen Smalley
2015-09-23  3:23   ` Russell Coker
2015-09-23 16:25     ` Stephen Smalley
2015-09-24  7:00     ` Matthew Cengia [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-09-18  2:07 Matthew Cengia

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=20150924070022.GA22582@cyber.com.au \
    --to=mattcen@cyber.com.au \
    --cc=russell@coker.com.au \
    --cc=sds@tycho.nsa.gov \
    --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.