Commit Graph

5367 Commits

Author SHA1 Message Date
Nicolas Iooss d386950b0d
Fix use of buggy pattern (.*)?
The pattern "(.*)?" means "match anything including the nothing, or
nothing": the question mark is redundant. This is likely to be a
mispelling for "(/.*)?", which means "match a slash and anthing, or
nothing", or for ".*", or for other patterns.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-29 19:57:05 +02:00
Chris PeBenito 0b2ab72127 files: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-08-28 19:22:27 -04:00
Chris PeBenito 72693a37fc Merge pull request #72 from fishilico/files-usr-include-reduce-scope 2019-08-28 19:18:13 -04:00
Nicolas Iooss f0cade07b2
Remove unescaped single dot from the policy
In a pattern, a dot can match any character, including slash. It makes
sense when it is combined with ?, + or *, but makes little sense when
left alone.

Most of the time, the label was for file containing dots, where the dot
was not escaped. A few times, the dot was really intended to match any
character. In such case, [^/] better suits the intent.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-27 23:38:09 +02:00
Nicolas Iooss c9602a0cac
files: reduce the scope of the pattern matching /usr/include
The pattern that matches /usr/include uses a dot, in order probably to
avoid calling m4's function include(). This also matches other paths
such as /usr/inclu/e. Such a side-effect can be avoided by inserting an
empty string which is removed by m4's preprocessing.

Mailing-list discussion: https://lore.kernel.org/selinux-refpolicy/CAJfZ7=krh_TaCBQzFxLM394Sc5-82ZO0DdcfvWON-RXu-wqBVw@mail.gmail.com/t/#u

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-27 22:39:37 +02:00
Chris PeBenito b0fb76565b rpcbind: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-08-27 00:36:40 -04:00
Chris PeBenito 373a1c090a Merge pull request #73 from fishilico/rpcbind-redundant-pid-fc 2019-08-27 00:36:18 -04:00
Chris PeBenito 68b74385a4 various: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-08-27 00:28:34 -04:00
Chris PeBenito 95c4192509 Merge pull request #64 from fishilico/haveged-unit 2019-08-27 00:20:24 -04:00
Chris PeBenito 7e5503155c Merge pull request #65 from fishilico/haveged-cmd-socket 2019-08-27 00:19:57 -04:00
Chris PeBenito 20f1151192 Merge pull request #66 from fishilico/ulogd-fix-context 2019-08-27 00:19:10 -04:00
Chris PeBenito 1106d0b692 Merge pull request #67 from fishilico/typo-monit-s9 2019-08-27 00:18:47 -04:00
Chris PeBenito 5c9d60245b Merge pull request #68 from fishilico/typo-java-fc 2019-08-27 00:18:24 -04:00
Chris PeBenito de3e9befcc Merge pull request #69 from fishilico/typo-lib-adobe-fc 2019-08-27 00:17:46 -04:00
Chris PeBenito f3b7aeb872 Merge pull request #71 from fishilico/typo-drbd-fc 2019-08-27 00:09:47 -04:00
Nicolas Iooss 6875a1b0a5
rpcbind: remove redundant file context for /run/rpc.statd.pid
There are two patterns that define file contexts for /run/rpc.statd.pid:

* in policy/modules/services/rpcbind.fc:

    /run/rpc.statd\.pid	--	gen_context(system_u:object_r:rpcbind_var_run_t,s0)

* in policy/modules/services/rpc.dc:

    /run/rpc\.statd\.pid	--	gen_context(system_u:object_r:rpcd_var_run_t,s0)

They coexist even though their labels differ because the first one uses
a unescaped dot. As it does not seem to exist other files matching the
first pattern, remove it in order to only keep the second one.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-22 21:49:28 +02:00
Nicolas Iooss d938683bf4
drbd: fix pattern for /usr/lib/ocf/resource.d/linbit/drbd
In order to match /usr/lib/ocf/resource.d/linbit/drbd, the dot needs to
be escaped, not the d.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-21 23:03:01 +02:00
Nicolas Iooss 1b44cb6c2e
libraries: match a digit in Adobe Reader directories
Patterns using this have a small issue:

    /opt/Adobe/Reader.?/Reader/intellinux

The issue is that the dot can also match a slash. A bettern pattern
would be:

    /opt/Adobe/Reader[^/]?/Reader/intellinux

In this specific case, the intent is to match digits (like
/opt/Adobe/Reader9). Use [0-9] for this.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-21 21:43:56 +02:00
Nicolas Iooss 3d97e06a8d
java: reduce the scope of the pattern in for java entry points
The following pattern seems to match much more than intended:

    /usr/(.*/)?bin/java[^-]*

According to the commit which introduced it
(0190325c18),
the aim was to match java1.4, java5, java6, and not java-config nor
java-check-environment. The issue is that the pattern also matches
sub-directories such as:

    /usr/share/my-application/bin/java/myfile

Prevent this by adding / in the character blacklist of the pattern.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-21 21:41:11 +02:00
Nicolas Iooss 271352c1c2
monit: use s0 instead of s9
This seems to be a misspelling, and there is no reason which would
explain why monit's init script would be labeled with a different
sensitivity while the main binary uses s0.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-21 21:39:26 +02:00
Nicolas Iooss 2bfb67d339
ulogd: fix pattern for /run/ulog directory
The pattern only matched /run/ulog, not its content.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-18 21:38:00 +02:00
Nicolas Iooss d7f66dce04
entropyd: allow haveged to create a Unix socket to received commands
haveged listens to commands using a Unix socket
(at path "\0/sys/entropy/haveged" according to
https://github.com/jirka-h/haveged/blob/1.9.4/src/havegecmd.h#L34).
The implementation of this server is available on
https://github.com/jirka-h/haveged/blob/1.9.4/src/havegecmd.c .

This fixes the following denial:

    type=AVC msg=audit(1551002989.396:27): avc:  denied  { listen } for
    pid=262 comm="haveged"
    path=002F7379732F656E74726F70792F68617665676564
    scontext=system_u:system_r:entropyd_t
    tcontext=system_u:system_r:entropyd_t tclass=unix_stream_socket
    permissive=1

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-18 21:34:52 +02:00
Nicolas Iooss 1ab82b1150
entropyd: label the unit file of haveged
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-18 21:20:27 +02:00
Chris PeBenito 230262368b ulogd: Rename ulogd_var_run_t to ulogd_runtime_t.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-08-17 15:17:51 -04:00
Chris PeBenito ac1659e79f ulogd: Module version bump. 2019-08-17 15:11:32 -04:00
Chris PeBenito fdf44e17bc Merge pull request #62 from fishilico/ulogd-debian 2019-08-17 15:09:03 -04:00
Nicolas Iooss 9686bf05a7
ulogd: allow starting on a Debian system
When ulogd is run by systemd on Debian, it logs messages to the journal,
it used a PID file in /run/ulog/ulogd.pid, and logs packets to
/var/log/ulog/syslogemu.log. This last ones triggers a dac_read_search
capability check because the directory is configured as:

    drwxrwx---. ulog adm /var/log/ulog

(root does not have an access to the directory without bypassing the DAC.)

Add a comment describing how to avoid allowing dac_read_search to ulogd_t.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-17 16:03:39 +02:00
Nicolas Iooss d91d41b53a
ulogd: allow creating a netlink-netfilter socket
This is used to get the packets logged by the firewall.

I experienced this on a Debian system which uses nftables rules with the
"log" keyword:

    type=AVC msg=audit(1565901600.257:348): avc:  denied  { create } for
    pid=8586 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tcla
    ss=netlink_netfilter_socket permissive=1

    type=AVC msg=audit(1565901103.154:327): avc:  denied  { read } for
    pid=436 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tclass=netlink_netfilter_socket
    permissive=1

    type=SYSCALL msg=audit(1565901103.154:327): arch=c000003e syscall=45
    success=yes exit=148 a0=8 a1=7f651d19d010 a2=249f0 a3=0 items=0 ppid=1
    pid=436 auid=4294967295 uid=111 gid=118 euid=111 suid=111 fsuid=111
    egid=118 sgid=118 fsgid=118 tty=(none) ses=4294967295 comm="ulogd"
    exe="/usr/sbin/ulogd" subj=system_u:system_r:ulogd_t key=(null)

    type=PROCTITLE msg=audit(1565901103.154:327):
    proctitle=2F7573722F7362696E2F756C6F6764002D2D6461656D6F6E002D2D75696400756C6F67002D2D70696466696C65002F72756E2F756C6F672F756C6F67642E706964

    [ ... ]

    type=AVC msg=audit(1565901600.241:338): avc:  denied  { write } for
    pid=436 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tclass=netlink_netfilter_socket
    permissive=1

    type=AVC msg=audit(1565901600.257:348): avc:  denied  { create } for
    pid=8586 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tclass=netlink_netfilter_socket
    permissive=1

    type=AVC msg=audit(1565901600.257:349): avc:  denied  { getattr } for
    pid=8586 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tclass=netlink_netfilter_socket
    permissive=1

    type=AVC msg=audit(1565901600.257:350): avc:  denied  { bind } for
    pid=8586 comm="ulogd" scontext=system_u:system_r:ulogd_t
    tcontext=system_u:system_r:ulogd_t tclass=netlink_netfilter_socket
    permissive=1

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-17 15:53:32 +02:00
Nicolas Iooss f37b4b5ddd
ulogd: add Debian's log directory
Debian uses /var/log/ulog/syslogemu.log by default to log network
packets sent through a netlink multicast group by the firewall.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-08-17 15:52:58 +02:00
Sugar, David 566fd554a6 Module for tpm2
Module for tpm2

v2 - updated to rename module and interface names, different dbus
interface

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-08-11 15:02:20 -04:00
Chris PeBenito fb04518b9d devices, storage: Module version bump
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-29 20:50:45 -04:00
Chris PeBenito 4ef04d8adb Merge pull request #58 from pebenito/more-device-updates 2019-07-29 20:50:23 -04:00
Chris PeBenito f191b07166 systemd: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-21 14:34:09 -04:00
Chris PeBenito e22ba9c3aa Merge pull request #59 from bigon/systemd_modules_load_t 2019-07-21 14:33:34 -04:00
Laurent Bigonville 6b12bd3aca Allow systemd_modules_load_t to module_request and map modules_object_t files
[   10.685610] audit: type=1400 audit(1563706740.429:3): avc:  denied  { map } for  pid=394 comm="systemd-modules" path="/usr/lib/modules/4.19.0-5-amd64/kernel/drivers/parport/parport.ko" dev="dm-0" ino=795927 scontext=system_u:system_r:systemd_modules_load_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1
[   10.695021] audit: type=1400 audit(1563706740.437:5): avc:  denied  { module_request } for  pid=394 comm="systemd-modules" kmod="parport_lowlevel" scontext=system_u:system_r:systemd_modules_load_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system permissive=1

Signed-off-by: Laurent Bigonville <bigon@bigon.be>
2019-07-21 19:46:47 +02:00
Chris PeBenito 367fee0c01
Merge pull request #60 from bigon/iftemplates
Makefile: Avoid regenerating the iftemplates at everyrun
2019-07-21 11:50:09 -04:00
Laurent Bigonville d90860861f Makefile: Avoid regenerating the iftemplates at everyrun
Fixes: #26
2019-07-21 16:02:21 +02:00
Chris PeBenito a5db4b262d devices: Add types for trusted execution environment interfaces.
These are interfaces for trusted OSes such as ARM TrustZone.

Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
2019-07-16 16:38:50 -04:00
Chris PeBenito a159153d82 devices, storage: Add fc entries for mtd char devices and ndctl devices.
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
2019-07-16 16:38:43 -04:00
Chris PeBenito 921eb37a97 rpm, selinux, sysadm, init: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-13 14:07:11 -04:00
Chris PeBenito de8cf73de0 knot: Move lines.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-13 14:06:44 -04:00
Chris PeBenito 7a1260ffe3 knot: Whitespace changes.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-13 14:06:02 -04:00
Alexander Miroshnichenko 491ae9991a Add knot module
Add a SELinux Reference Policy module for the
Knot authoritative-only DNS server.

Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
2019-07-13 14:00:31 -04:00
Sugar, David 2831598bb5 grant rpm_t permission to map security_t
type=AVC msg=audit(1560944462.698:217): avc:  denied  { map } for pid=1265 comm="rpm" path="/sys/fs/selinux/status" dev="selinuxfs" ino=19 scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=file permissive=1

v2 - Create new interface to allow mapping security_t and use this interface by rpm_t

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-13 14:00:23 -04:00
Chris PeBenito b85c93b582 rpm: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-08 20:49:31 -04:00
Sugar, David 72cc3e9136 Allow rpm scripts to alter systemd services
In RPM scripts it is common to enable/start services that are being
installed.  This allows rpm_script_t to manage sysemd units

type=USER_AVC msg=audit(1561033935.758:283): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { enable } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/ntpdate.service" cmdline="systemctl preset ntpdate.service" scontext=system_u:system_r:rpm_script_t:s0 tcontext=system_u:object_r:ntpd_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
type=USER_AVC msg=audit(1561033935.837:286): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { enable } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/ntpd.service" cmdline="systemctl preset ntpd.service" scontext=system_u:system_r:rpm_script_t:s0 tcontext=system_u:object_r:ntpd_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

type=USER_AVC msg=audit(1561059114.937:239): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { reload } for auid=n/a uid=0 gid=0 cmdline="systemctl preset ntpdate.service" scontext=system_u:system_r:rpm_script_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-08 20:38:46 -04:00
Sugar, David 66bbd568e4 Allow rpm to map file contexts
type=AVC msg=audit(1560944465.365:270): avc:  denied  { map } for pid=1265 comm="rpm" path="/etc/selinux/clip/contexts/files/file_contexts.bin" dev="dm-0" ino=44911 scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:object_r:file_context_t:s0 tclass=file permissive=1

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-08 20:38:46 -04:00
Sugar, David 79fd6ddb3e grant rpm permissions to map locale_t
type=AVC msg=audit(1560913896.408:217): avc:  denied  { map } for pid=1265 comm="rpm" path="/usr/lib/locale/locale-archive" dev="dm-0" ino=24721 scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:object_r:locale_t:s0 tclass=file permissive=1

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-08 20:38:46 -04:00
Sugar, David 8e09ba5637 grant permission for rpm to write to audit log
Messages like this are added to the audit log when an rpm is installed:
type=SOFTWARE_UPDATE msg=audit(1560913896.581:244): pid=1265 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:rpm_t:s0 msg='sw="ntpdate-4.2.6p5-25.el7_3.2.x86_64" sw_type=rpm key_enforce=0 gpg_res=0 root_dir="/" comm="rpm" exe="/usr/bin/rpm" hostname=? addr=?  terminal=? res=success'

These are the denials that I'm seeing:
type=AVC msg=audit(1560913896.581:243): avc:  denied  { audit_write } for  pid=1265 comm="rpm" capability=29 scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:system_r:rpm_t:s0 tclass=capability permissive=1

type=AVC msg=audit(1561298132.446:240): avc:  denied  { create } for pid=1266 comm="rpm" scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:system_r:rpm_t:s0 tclass=netlink_audit_socket permissive=1
type=AVC msg=audit(1561298132.446:241): avc:  denied  { write } for pid=1266 comm="rpm" scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:system_r:rpm_t:s0 tclass=netlink_audit_socket permissive=1
type=AVC msg=audit(1561298132.446:241): avc:  denied  { nlmsg_relay } for  pid=1266 comm="rpm" scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:system_r:rpm_t:s0 tclass=netlink_audit_socket permissive=1
type=AVC msg=audit(1561298132.447:243): avc:  denied  { read } for pid=1266 comm="rpm" scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:system_r:rpm_t:s0 tclass=netlink_audit_socket permissive=1

v2 - Use interface rather than adding permissions here - this change may
confuse subsequent patches in this set, if so let me know and I will
submit a pull request on github.

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-08 20:37:19 -04:00
Sugar, David c2f504c25e grant rpm permission to map rpm_var_lib_t
type=AVC msg=audit(1560913896.432:218): avc:  denied  { map } for pid=1265 comm="rpm" path="/var/lib/rpm/__db.001" dev="dm-0" ino=2223 scontext=system_u:system_r:rpm_t:s0 tcontext=system_u:object_r:rpm_var_lib_t:s0 tclass=file permissive=1

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-07-08 20:37:19 -04:00