Commit Graph

4617 Commits

Author SHA1 Message Date
David Sugar via refpolicy f3e0a751db label /etc/mcelog/mcelog.setup correctly (for RHEL)
I am seeing the following denials when mcelog.service is attempting to execute /etc/mcelog/mcelog.setup (on RHEL 7).  It should be labeled bin_t.

Sep 21 02:45:50 localhost audit: type=AVC msg=audit(1505961383.859:28): avc:  denied  { execute } for  pid=626 comm="(og.setup)" name="mcelog.setup" dev="dm-0" ino=718731 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mcelog_etc_t:s0 tclass=file
Sep 21 02:45:50 localhost audit: type=AVC msg=audit(1505961383.859:28): avc:  denied  { read open } for  pid=626 comm="(og.setup)" path="/etc/mcelog/mcelog.setup" dev="dm-0" ino=718731 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mcelog_etc_t:s0 tclass=file
Sep 21 02:45:50 localhost audit: type=AVC msg=audit(1505961383.859:28): avc:  denied  { execute_no_trans } for  pid=626 comm="(og.setup)" path="/etc/mcelog/mcelog.setup" dev="dm-0" ino=718731 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mcelog_etc_t:s0 tclass=file
Sep 21 02:45:50 localhost audit: type=SYSCALL msg=audit(1505961383.859:28): arch=c000003e syscall=59 success=yes exit=0 a0=55a0ddd00260 a1=55a0ddcd1be0 a2=55a0ddd02e90 a3=3 items=3 ppid=1 pid=626 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="mcelog.setup" exe="/usr/bin/bash" subj=system_u:system_r:init_t:s0 key=(null)
Sep 21 02:45:50 localhost audit: type=EXECVE msg=audit(1505961383.859:28): argc=2 a0="/bin/sh" a1="/etc/mcelog/mcelog.setup"
Sep 21 02:45:50 localhost audit: type=PATH msg=audit(1505961383.859:28): item=0 name="/etc/mcelog/mcelog.setup" inode=718731 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:mcelog_etc_t:s0 objtype=NORMAL
Sep 21 02:45:50 localhost audit: type=AVC msg=audit(1505961383.862:29): avc:  denied  { ioctl } for  pid=626 comm="mcelog.setup" path="/etc/mcelog/mcelog.setup" dev="dm-0" ino=718731 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mcelog_etc_t:s0 tclass=file
Sep 21 02:45:50 localhost audit: type=SYSCALL msg=audit(1505961383.862:29): arch=c000003e syscall=16 success=no exit=-25 a0=3 a1=5401 a2=7ffec57f28f0 a3=7ffec57f2690 items=0 ppid=1 pid=626 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="mcelog.setup" exe="/usr/bin/bash" subj=system_u:system_r:init_t:s0 key=(null)
Sep 21 02:45:50 localhost audit: type=AVC msg=audit(1505961383.867:30): avc:  denied  { getattr } for  pid=626 comm="mcelog.setup" path="/etc/mcelog/mcelog.setup" dev="dm-0" ino=718731 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mcelog_etc_t:s0 tclass=file
Sep 21 02:45:50 localhost audit: type=SYSCALL msg=audit(1505961383.867:30): arch=c000003e syscall=5 success=yes exit=0 a0=ff a1=7ffec57f2890 a2=7ffec57f2890 a3=7ffec57f25a0 items=0 ppid=1 pid=626 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="mcelog.setup" exe="/usr/bin/bash" subj=system_u:system_r:init_t:s0 key=(null)

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-23 14:30:35 -04:00
Chris PeBenito 5cb00e5167 Update contrib. 2017-09-19 18:43:55 -04:00
Chris PeBenito c7c53a91af Update contrib. 2017-09-17 21:14:24 -04:00
Chris PeBenito 6abb3eb5fc corecommands, xserver, systemd, userdomain: Version bumps. 2017-09-17 11:11:18 -04:00
Russell Coker 25a9bcb405 minor nspawn, dnsmasq, and mon patches
Label some shell scripts from bridge-utils correctly.  Maybe have ifdef
distro_debian around this, not sure what upstream is doing.

systemd_nspawn_t needs to manage the /etc/localtime symlink if you have a
labeled chroot.

Another dontaudit for mon_local_test_t to stop it spamming the logs.

Support a .d directory for dnsmasq config files.
2017-09-17 11:08:06 -04:00
Guido Trentalancia 4afbc35e79 xserver: do not audit ioctl operations on log files
Do not audit ioctl operation attempts whenever write
operations on the xserver log should not be audited.

Signed-off-by: Guido Trentalancia <guido@trentalancia.com>
2017-09-17 10:44:57 -04:00
Chris PeBenito eea649c0f4 init: Remove sm-notify.pid fc entry which collides with the rpc module. 2017-09-16 13:31:12 -04:00
Chris PeBenito d2c047bfd4 authlogin, logging, udev: Module version bump. 2017-09-16 13:30:33 -04:00
Jason Zaman via refpolicy e2db03bb8f sudo: add fcontext for /run/sudo/ts/USERNAME
This lets restorecon -F set the context properly
2017-09-16 13:05:53 -04:00
Jason Zaman via refpolicy 18778fcb49 syslog: allow map persist file 2017-09-16 13:05:53 -04:00
Jason Zaman via refpolicy ae482db492 udev: map module objects to load kernel modules
denied  { map } for  pid=7850 comm="systemd-udevd" path="/lib64/modules/4.13.0-gentoo/kernel/drivers/hid/hid-logitech-hidpp.ko" dev="zfs" ino=709934 scontext=system_u:system_r:udev_t:s0-s0:c0.c1023 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=0
2017-09-16 13:05:53 -04:00
Chris PeBenito f74a91a1a6 sysadm,fstools: Module version bump. 2017-09-14 17:21:56 -04:00
Christian Göttsche e1d795de3b dphysswapfile: add interfaces and sysadm access
v2:

add swapfile file context
2017-09-14 17:19:55 -04:00
Chris PeBenito 09006ca15e spamassassin: Add missing requirement in spamassassin_admin(). 2017-09-13 20:00:45 -04:00
Chris PeBenito 1fa134f2f2 init: Fix XML error. 2017-09-13 19:38:40 -04:00
Chris PeBenito b22bd52d16 spamassassin: Fix build error. 2017-09-13 19:38:30 -04:00
Chris PeBenito 2ce0d06bbc Module version bumps. 2017-09-13 18:58:07 -04:00
Chris PeBenito c983318db8 init: Whitespace fix. 2017-09-13 18:56:25 -04:00
Chris PeBenito 132fefea5b init: Rename init_rlimit_inherit to init_inherit_rlimit. 2017-09-13 18:56:14 -04:00
David Sugar aad06a40fe Add int_rlimit_inherit interface
Create new interface init_rlimit_inherit to allow a process started by init to inherit resource limits.  systemd allows for setting of resource limits [1] but the default from SELinux is to not allow the inheritance of those limits as a service is started.  This interface allows that resource limit inheritance.

The systemd .service options are LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME=

[1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-13 18:54:42 -04:00
David Sugar 153fb2f591 Add status into init_startstop_service interface
Alter interface init_startstop_service to also allow for the status permission.  systemctl start <foo> and systemctl stop <foo> work correctly.  But systemctl restart <foo> will fail as restart uses status to determine the action to take.

This interface is used by many other modules (like iptables, logging, apache, cron, etc...  - see 'admin' interface).  This allows restart to work for all these services.

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-13 18:51:45 -04:00
Jason Zaman c149cf9fc3 Allow sysadm to map all non auth files
The idea and code are from perfinion. I support it, but we should
probably discuss it.
2017-09-13 18:40:24 -04:00
Luis Ressel 65bfd23fbb Grant all permissions neccessary for Xorg and basic X clients
Note that dev_rw_dri already has the permission, it was just forgotten
to add it to dev_manage_dri, too.
2017-09-13 18:40:24 -04:00
Chris PeBenito 3548e3b3fe Module version bumps. 2017-09-12 20:16:35 -04:00
Chris PeBenito 469766dde6 init: Move init_spec_daemon_domain implementation. 2017-09-12 19:35:31 -04:00
David Sugar bc94acf133 Add init_spec_daemon_domain interface
We have a use case on a system where we have a systemd .service unit file that is using the SELinuxContext= [1] option  to specify a context for the service being started.  The same .service file (/lib/systemd/system/foo@.service) is used to start multiple instances of the same executable that are customized with a different drop-in .conf file for each.  The context is customized in /lib/systemd/system/foo@.service file (based on using SELinuxContext=system_u:system_r:foo_%i_t:s0)  [2]

We then create /etc/systemd/system/foo@bar.service.d/bar.conf so the final running process is in the domain foo_bar_t

We have created the following interface (in init.if) to meet our needs.  The interface is very much like init_daemon_domain except for the use of spec_domtrans_pattern rather than domtrans_pattern because the automatic transition doesn't work in this case.

[1] The SELinuxContext option for systemd is explained https://www.freedesktop.org/software/systemd/man/systemd.exec.html
[2] The systemd %i (and other specifiers) along with drop-in files are explained https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-12 19:34:26 -04:00
Luis Ressel 487de20913 logging: Various audit tools (auditctl, ausearch, etc) map their config and logs
Those mmap() calls are non-essential, though. They're issued by
fdopen(), which can also fall back to read().

Since there are few reasons to grant read access to audit logs other
than for using ausearch, I've added the dontaudits directly to the
relevant read interfaces.
2017-09-12 19:29:34 -04:00
Luis Ressel ec27acdf1f userdomain: man-db needs to map its 'index.db' cache 2017-09-12 19:29:34 -04:00
Luis Ressel 870bb5c789 miscfiles: Allow libfontconfig consumers to map the fonts cache 2017-09-12 19:29:34 -04:00
Luis Ressel dfcdb40e6e kernel: Add map permission to the dev_{read, write}_sound* interfaces
sds already added it to dev_read_sound_mixer, but it's also needed in
the other interfaces.
2017-09-12 19:29:34 -04:00
Chris PeBenito 095ad7923a Several module version bumps. 2017-09-11 20:34:13 -04:00
Luis Ressel bbab9e970d selinuxutil: Add map permissions neccessary for semanage 2017-09-11 20:31:23 -04:00
Luis Ressel c695860748 files: Create files_map_usr_files interface 2017-09-11 20:31:23 -04:00
Luis Ressel c772611817 userdomain: Add various interfaces granting the map permission 2017-09-11 20:31:23 -04:00
Luis Ressel fa14c7d141 libraries: ldconfig maps its "aux-cache" during cache updates 2017-09-11 20:31:23 -04:00
Luis Ressel 14107ce1c0 modutils: libkmod mmap()s modules.dep and *.ko's
Note that not only kmod needs this permission, other libkmod consumers
like udev require it, too. Hence I'm adding the permission to the
relevant interfaces.
2017-09-11 20:31:23 -04:00
Chris PeBenito 7025086a9c terminal: Rename term_create_devpts. 2017-09-11 20:03:58 -04:00
Nicolas Iooss 60382e9e53 init: allow systemd to relabel /dev and /run
systemd relabels everything in /dev and /run after loading the policy.
In these directories there is a socket file for udev, /run/udev/control,
which is not allowed to be relabelled from tmpfs_t:

    avc:  denied  { relabelfrom } for  pid=1 comm="systemd"
    name="control" dev="tmpfs" ino=7027
    scontext=system_u:system_r:init_t tcontext=system_u:object_r:tmpfs_t
    tclass=sock_file permissive=1

    avc:  denied  { relabelto } for  pid=1 comm="systemd" name="control"
    dev="tmpfs" ino=7027 scontext=system_u:system_r:init_t
    tcontext=system_u:object_r:udev_var_run_t tclass=sock_file
    permissive=1

/run/tmpfiles.d directory (used by systemd-tmpfiles service) is also
relabelled.
2017-09-11 20:03:31 -04:00
Nicolas Iooss ae40418b24 init: allow systemd to create /dev/pts as devpts_t
This is currently denied:

     avc:  denied  { create } for  pid=1 comm="systemd" name="pts"
     scontext=system_u:system_r:init_t
     tcontext=system_u:object_r:devpts_t tclass=dir permissive=1
2017-09-11 20:03:31 -04:00
Chris PeBenito cc6cb6c344 files: Move files_check_write_pid_dirs interface. 2017-09-11 19:35:54 -04:00
Christian Göttsche ff0937af03 rkhunter: add interfaces for var_run and lock dir access check 2017-09-11 19:33:26 -04:00
David Sugar c974aa56b1 Label /etc/rsyslog.d as syslog_conf_t
This is a minor update of the last attempt at this patch.

Changes in .fc to label /etc/rsyslog.d(/.*)? as syslog_conf_t so all rsyslog config files are labeled syslog_conf_t (not just /etc/r?syslog.conf).  Update .te file to allow rsyslog to read the directory now labeled syslog_conf_t (files of this type were already readable).  Final (and new) change is in logging_admin_syslog interface so files_etc_filetrans now includes the optional filename so /etc/r?syslog.conf would be labeled correctly when created in etc_t.

The overall goal of this patch is that a domain using the logging_admin_syslog is able to create/edit files in /etc/rsyslog.d and they get created as syslog_conf_t AND other files created in /etc (or other etc_t labeled directory) don't get created with the syslog_conf_t type as they are not necessarily syslog configuration files.

Dave Sugar
dsugar@tresys.com

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-11 18:57:29 -04:00
Chris PeBenito fc044b53fd init: Module version bump for patch from Dave Sugar. 2017-09-08 19:33:43 -04:00
Chris PeBenito 46bf71752a init: Move fc lines. 2017-09-08 19:30:34 -04:00
David Sugar bd515fd951 Label RHEL specific systemd binaries
Label RHEL specific systemd binaries /usr/lib/systemd/rhel* as initrc_exec_t.
Now in the proper location.

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-09-08 19:28:31 -04:00
Chris PeBenito bf9da2ba78 Module version bump for patches from Nicolas Iooss. 2017-09-08 11:52:12 -04:00
Nicolas Iooss via refpolicy 69d400af3b terminal: /dev/pts exists in /dev filesystem
systemd tries to create /dev/pts directly with its context type
"devpts_t", but this is not allowed:

    avc:  denied  { associate } for  pid=1 comm="systemd" name="pts"
    scontext=system_u:object_r:devpts_t
    tcontext=system_u:object_r:device_t
    tclass=filesystem permissive=1
2017-09-08 11:43:48 -04:00
Nicolas Iooss f23e6ee79c corecommands: label Arch Linux pacman's scripts as bin_t
On Arch Linux, the package manager uses hooks which execute scripts in
/usr/share/libalpm/scripts.
2017-09-08 11:42:08 -04:00
Chris PeBenito a46fbbc2fb systemd: Whitespace fix. 2017-09-08 11:41:56 -04:00
Chris PeBenito 1fdac56605 systemd, udev: Module version bump. 2017-09-06 11:04:11 -04:00