Commit Graph

820 Commits

Author SHA1 Message Date
Chris PeBenito 5d636c2d16 various: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-09-03 19:47:12 -04:00
Chris PeBenito 9d80ada777 Merge pull request #78 from fishilico/debian-dynamic-motd 2019-09-03 19:44:13 -04:00
Chris PeBenito f907287428 Merge pull request #79 from fishilico/corecommands-no-backslash-d 2019-09-03 19:34:47 -04:00
Dominick Grift 3228c2b997 domain: unconfined access to bpf
Signed-off-by: Dominick Grift <dac.override@gmail.com>
2019-09-03 19:25:41 -04:00
Nicolas Iooss 2da886dccf
corecommands: no longer use \d
In order to detect bugs like the one fixed by commit d938683bf4
("drbd: fix pattern for /usr/lib/ocf/resource.d/linbit/drbd"), forbid
the use of \d in the policy. This was actually only used to match

    /usr/share/apr-1/build/...

with

    /usr/share/apr(-\d)?/build/[^/]+\.sh --	gen_context(system_u:object_r:bin_t,s0)
    /usr/share/apr(-\d)?/build/libtool --	gen_context(system_u:object_r:bin_t,s0)

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-09-01 15:26:55 +02:00
Nicolas Iooss c021287125
Allow Debian to generate a dynamic motd when users log in
Debian's PAM configuration uses a patched pam_motd module that runs
files in /etc/update-motd.d/ in order to generate a dynamic Message Of
The Day (MOTD). By default, there is only one script:

    $ cat /etc/update-motd.d/10-uname
    #!/bin/sh
    uname -snrvm

According to https://wiki.debian.org/motd, the script is executed
through run-parts:

    if (!system("/usr/bin/env -i
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    run-parts --lsbsysinit /etc/update-motd.d >
    /run/motd.dynamic.new"))
        rename("/run/motd.dynamic.new", "/run/motd.dynamic");

This requires allowing pam_motd users to execute bin_t commands
(/usr/bin/env) and shells (/bin/sh), and to manage /run/motd.dynamic*
files.

Allow relevant accesses for Debian-based systems.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-09-01 13:44:28 +02:00
Chris PeBenito 6b11dcef89 Various: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-08-31 06:55:57 -04:00
Chris PeBenito b43aebcc2f Merge pull request #70 from fishilico/typo-dot-star-question-fc 2019-08-31 06:26:00 -04:00
Chris PeBenito e88ca002eb Merge pull request #75 from fishilico/fc-escape-single-dot 2019-08-31 06:24:06 -04:00
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
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 fb04518b9d devices, storage: Module version bump
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-07-29 20:50:45 -04: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
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 8c3893e427 Bump module versions for release.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-06-09 14:05:19 -04:00
Chris PeBenito 10784f3b33 various: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-06-09 13:37:51 -04:00
Chris PeBenito 666b744714 devices: Add type for /dev/daxX.Y.
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
2019-06-04 15:10:28 -04:00
Chris PeBenito f0e8bdbf50 storage: Add fc entry for /dev/pmem*
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
2019-06-04 15:10:06 -04:00
Chris PeBenito 5d345b79ee various: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-04-27 10:51:06 -04:00
Chris PeBenito 54dbc8a7a7 Merge pull request #43 from pebenito/various-device-labels 2019-04-27 10:50:27 -04:00
Chris PeBenito 4bca3dade2 devices: Change netcontrol devices to pmqos.
Devices with the netcontrol_device_t type are actually PM QoS devices.
Rename the type and add labeling for /dev/memory_bandwidth.

Signed-off-by: Chris PeBenito <Christopher.PeBenito@microsoft.com>
2019-04-24 09:17:36 -04:00
Chris PeBenito 3b0d0ea330 devices: Add type for GPIO chips, /dev/gpiochip[0-9]
Signed-off-by: Chris PeBenito <Christopher.PeBenito@microsoft.com>
2019-04-24 08:50:41 -04:00
Chris PeBenito b1a312152c devices: Label /dev/tpmrm[0-9].
Signed-off-by: Chris PeBenito <Christopher.PeBenito@microsoft.com>
2019-04-24 08:50:41 -04:00
Chris PeBenito 77161ca8b7 storage: Label /dev/mmcblk* character nodes.
An example is mmcblk0rpmb, which is for the replay protected memory block
subsystem.

Signed-off-by: Chris PeBenito <Christopher.PeBenito@microsoft.com>
2019-04-24 08:50:41 -04:00
Chris PeBenito ae2d2ec470 kernel, devices, plymouthd, xserver: Module version bump. 2019-04-23 18:37:22 -04:00
Dave Sugar 51aadce3c2 Changes to support plymouth working in enforcing
plymouth is started very early in the boot process.  Looks
like before the SELinux policy is loaded so plymouthd is
running as kernel_t rather than plymouthd_t.  Due to this
I needed to allow a few permissions on kernel_t to get
the system to boot.

type=AVC msg=audit(1554917011.127:225): avc:  denied  { write } for  pid=2585 comm="plymouthd" name="plymouth" dev="tmpfs" ino=18877 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:plymouthd_var_run_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1554917011.127:226): avc:  denied  { remove_name } for  pid=2585 comm="plymouthd" name="pid" dev="tmpfs" ino=18883 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:plymouthd_var_run_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1554917011.127:227): avc:  denied  { unlink } for  pid=2585 comm="plymouthd" name="pid" dev="tmpfs" ino=18883 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:plymouthd_var_run_t:s0 tclass=file permissive=1

type=AVC msg=audit(1554917011.116:224): avc:  denied  { write } for  pid=2585 comm="plymouthd" name="boot-duration" dev="dm-16" ino=2097285 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:plymouthd_var_lib_t:s0 tclass=file permissive=1

type=AVC msg=audit(1555069712.938:237): avc:  denied  { ioctl } for  pid=2554 comm="plymouthd" path="/dev/dri/card0" dev="devtmpfs" ino=12229 ioctlcmd=64b1 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:dri_device_t:s0 tclass=chr_file permissive=0
2019-04-23 07:48:15 -04:00
Chris PeBenito 32ce73f9b8 kernel: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-04-12 07:57:00 -04:00
Lukas Vrabec ce570ab34d Label /sys/kernel/ns_last_pid as sysctl_kernel_ns_last_pid_t
CRIU can influence the PID of the threads it wants to create.
CRIU uses /proc/sys/kernel/ns_last_pidto tell the kernel which
PID it wants for the next clone().
So it has to write to that file. This feels like a problematic as
it opens up the container writing to all sysctl_kernel_t.

Using new label container_t will just write to
sysctl_kernel_ns_last_pid_t instad writing to more generic
sysctl_kernel_t files.
2019-04-12 07:52:27 -04:00
Chris PeBenito df696a3254 kernel, init, systemd, udev: Module version bump.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
2019-03-27 18:58:15 -04:00
Chris PeBenito 40bf663090 systemd: Drop unconfined kernel access for systemd_nspawn.
Revise kernel assertion to /proc/kmsg to be more precise.

Signed-off-by: Chris PeBenito <Christopher.PeBenito@microsoft.com>
2019-03-20 10:09:37 -04:00
Chris PeBenito bb83a721cf filesystem, cron, authlogin: Module version bump. 2019-03-07 19:02:57 -05:00
Sugar, David 4f8d21ea71 Add interface to allow relabeling of iso 9660 filesystems.
I have a case where I'm labeling media with my own types to control
access.  But that is requiring that I relabel from iso9660_t to my
own type.  This interface allows that relabel.

type=AVC msg=audit(1551621984.372:919): avc:  denied  { relabelfrom } for  pid=9717 comm="mount" scontext=staff_u:staff_r:mymedia_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=filesystem permissive=0

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2019-03-07 19:02:57 -05:00
Chris PeBenito 807cf71287 corenetwork: Module version bump. 2019-02-17 21:11:43 -05:00
Nicolas Iooss 919c889b7d
Add policy for stubby DNS resolver
Stubby is a DNS resolver that encrypts DNS queries and transmits them to
a resolver in a TLS channel. It therefore requires less permissions than
a traditionnal DNS resolver such as named or unbound (provided by module
"bind").

cf. https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby

This program is packaged for Arch Linux, Debian, etc.

DNS-over-TLS uses TCP port 853, which does not seem to conflict with
existing ports. Label it like other DNS ports.

init_dbus_chat(stubby_t) is required on systemd-based distributions
because stubby's service uses DynamicUser=yes [1]. Without this
statement, the following denials are reported by dbus:

    type=USER_AVC msg=audit(1550007165.936:257): pid=274 uid=81
    auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t
    msg='avc:  denied  { send_msg } for msgtype=method_call
    interface=org.freedesktop.DBus member=Hello
    dest=org.freedesktop.DBus spid=649
    scontext=system_u:system_r:stubby_t
    tcontext=system_u:system_r:system_dbusd_t tclass=dbus permissive=1
    exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

    type=USER_AVC msg=audit(1550007165.939:258): pid=274 uid=81
    auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t
    msg='avc:  denied  { send_msg } for msgtype=method_call
    interface=org.freedesktop.systemd1.Manager
    member=LookupDynamicUserByUID dest=org.freedesktop.systemd1 spid=649
    tpid=1 scontext=system_u:system_r:stubby_t
    tcontext=system_u:system_r:init_t tclass=dbus permissive=1
    exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

    type=USER_AVC msg=audit(1550007165.939:259): pid=274 uid=81
    auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t
    msg='avc:  denied  { send_msg } for msgtype=method_return dest=:1.39
    spid=1 tpid=649 scontext=system_u:system_r:init_t
    tcontext=system_u:system_r:stubby_t tclass=dbus permissive=1
    exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

[1] https://github.com/getdnsapi/stubby/blob/v0.2.5/systemd/stubby.service#L8
2019-02-17 22:16:33 +01:00
Chris PeBenito 445cbed7c7 Bump module versions for release. 2019-02-01 15:03:42 -05:00
Chris PeBenito 83ebbd23d3 corecommands, staff, unprivuser, ssh, locallogin, systemd: Module version bump. 2019-02-01 14:21:55 -05:00
Russell Coker 044da0b8b9 more misc stuff
Here's the latest stuff, most of which is to make staff_t usable as a login
domain.  Please merge whatever you think is good and skip the rest.
2019-02-01 14:16:57 -05:00
Chris PeBenito 535cea9ad1 filesystem, postgresql: Module version bump. 2019-01-27 12:58:33 -05:00
Chris PeBenito b78be0cc7a Merge branch 'postgres' of git://github.com/alexminder/refpolicy 2019-01-27 12:44:39 -05:00
Alexander Miroshnichenko 548564099e fs_mmap_rw_hugetlbfs_files is a more appropriate name for the interface 2019-01-26 21:50:12 +03:00
Chris PeBenito 30a46e5676 various: Module version bump. 2019-01-23 19:02:01 -05:00
Jason Zaman 4ed30f7492 kernel: introduce kernel_dontaudit_read_kernel_sysctl
Signed-off-by: Jason Zaman <jason@perfinion.com>
2019-01-23 18:40:57 -05:00
Jason Zaman d83a104eda files: introduce files_dontaudit_read_etc_files
Signed-off-by: Jason Zaman <jason@perfinion.com>
2019-01-23 18:40:57 -05:00
Jason Zaman 1bc0503d53 devices: introduce dev_dontaudit_read_sysfs
Signed-off-by: Jason Zaman <jason@perfinion.com>
2019-01-23 18:40:57 -05:00
Alexander Miroshnichenko cff5e0026c Add new interface fs_rmw_hugetlbfs_files.
Add new interface fs_rmw_hugetlbfs_files and grant it to postgresql_t.
2019-01-23 17:58:54 +03:00
Chris PeBenito 85536c64e1 kernel, jabber, ntp, init, logging, systemd: Module version bump. 2019-01-09 19:36:41 -05:00