Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 871966 - sys-process/audit-3.0.6-r1: On a SELinux+systemd host, audit fails to access the /proc filesystem
Summary: sys-process/audit-3.0.6-r1: On a SELinux+systemd host, audit fails to access ...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: SE Linux Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-19 23:53 UTC by David Sardari
Modified: 2022-10-02 11:27 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Sardari 2022-09-19 23:53:26 UTC
audit fails to access the /proc filesystem, because /proc has SELinux type "unlabeled_t".


Reproducible: Always

Steps to Reproduce:
1. Setup Gentoo with systemd and SELinux
2. Boot

Actual Results:  
You get the following denial:

[   19.902620] audit: type=1400 audit(1663630933.439:3): avc:  denied  { mounton } for  pid=1062 comm="(auditd)" path="/run/systemd/unit-root/proc" dev="dm-3" ino=67581 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=1


Expected Results:  
/proc should have SELinux type "proc_t".


With help of user grift from IRC libera #selinux channel, I relabeled "/proc":

# Credits: grift :)
❯ echo '(filecon "/proc" dir (system_u object_r proc_t ((s0)(s0))))
(allow proc_t fs_t (filesystem (associate)))
(typeattributeset mountpoint proc_t)'> my_proc.cil

❯ semodule -i my_proc.cil

❯ export tmpdir="$(mktemp -d)" && mount --bind / "$tmpdir" && chcon system_u:object_r:proc_t:s0 "$tmpdir"/proc && umount "$tmpdir" && echo -e "\e[1;32mSUCCESS\e[0m"
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-20 05:45:16 UTC
(Aside: we may want to add proc to https://wiki.gentoo.org/wiki/SELinux/Installation#Setting_file_system_contexts)