Commit Graph

813 Commits

Author SHA1 Message Date
Nicolas Iooss 0cd1ea9596 Remove redundant Gentoo-specific term_append_unallocated_ttys(syslogd_t)
Since commit 0fd9dc55, logging.te contains:

  term_write_all_user_ttys(syslogd_t)

As "write" is a superset of "append", this rule is no longer needed:

    term_append_unallocated_ttys(syslogd_t)

While at it, add a comment which explains why
term_dontaudit_setattr_unallocated_ttys is needed.
2014-09-12 09:55:58 -04:00
Nicolas Iooss 6a201e405b Allow journald to access to the state of all processes
When a process sends a syslog message to journald, journald records
information such as command, executable, cgroup, etc.:
http://cgit.freedesktop.org/systemd/systemd/tree/src/journal/journald-server.c?id=v215#n589

This needs domain_read_all_domains_state.
2014-09-12 09:55:13 -04:00
Chris PeBenito 6ced8116bd Add comment for journald ring buffer reading. 2014-09-12 09:54:11 -04:00
Nicolas Iooss 3a7e30c22d Allow journald to read the kernel ring buffer and to use /dev/kmsg
audit.log shows that journald needs to read the kernel read buffer:

    avc:  denied  { syslog_read } for  pid=147 comm="systemd-journal" scontext=system_u:system_r:syslogd_t tcontext=system_u:system_r:kernel_t tclass=system permissive=1

Moreover journald uses RW access to /dev/kmsg, according to its code:
http://cgit.freedesktop.org/systemd/systemd/tree/src/journal/journald-kmsg.c?id=v215#n394
2014-09-12 09:52:18 -04:00
Nicolas Iooss ae4d07c8a8 Support logging with /run/systemd/journal/dev-log
In June 2014 systemd moved the socket used by journald to /run.  This
requires two new directory search access for every domain sending syslog
messages:

* /run/systemd/ (handled by init_search_run)
* /run/systemd/journal/ (labeled syslogd_var_run_t)

systemd commit:
http://cgit.freedesktop.org/systemd/systemd/commit/units/systemd-journald-dev-log.socket?id=03ee5c38cb0da193dd08733fb4c0c2809cee6a99
2014-09-12 09:50:48 -04:00
Chris PeBenito a30feb2a5b Whitespace change in logging.fc. 2014-09-12 09:49:37 -04:00
Nicolas Iooss d7b2ccf89a Label systemd-journald files and directories 2014-09-12 09:47:59 -04:00
Nicolas Iooss 687b5d3391 Introduce init_search_run interface 2014-09-12 09:46:01 -04:00
Chris PeBenito 8cfe827a3d Move systemd fc entry. 2014-09-12 09:42:59 -04:00
Nicolas Iooss dcca3e977b Label systemd files in init module 2014-09-12 09:41:25 -04:00
Chris PeBenito 4451a6c497 Module version bump for FUSE fix for mount from Luis Ressel. 2014-08-21 09:53:51 -04:00
Luis Ressel 6c9f445e55 Grant mount permission to access /dev/fuse
This is needed for mounting FUSE-based filesystems like ntfs-3g.
2014-08-21 08:27:02 -04:00
Chris PeBenito 617466b2bd Module version bump for losetup fixes from Luis Ressel. 2014-08-19 08:45:38 -04:00
Chris PeBenito 503f2749e0 Move losetup addition in fstools. 2014-08-19 08:44:57 -04:00
Luis Ressel 9946965a53 Add neccessary permissions for losetup
This allows losetup to bind mount_loopback_t files to loop devices.
2014-08-18 15:24:46 -04:00
Luis Ressel d18b43bae7 system/fstools.if: Add fstools_use_fds interface 2014-08-18 15:24:46 -04:00
Luis Ressel 0aa6f5b644 system/mount.if: Add mount_rw_loopback_files interface 2014-08-18 15:24:46 -04:00
Chris PeBenito daa6ad17ad Module version bump for fstools fc entries from Luis Ressel. 2014-08-14 15:47:55 -04:00
Luis Ressel b6dcb211f0 Label /usr/sbin/{add, del}part as fsadm_exec_t
These are seldomly-used tools from the util-linux package.

Please check if they are located in /sbin instead of /usr/sbin on other
distributions.

Signed-off-by: Luis Ressel <aranea@aixah.de>
2014-08-14 15:41:40 -04:00
Luis Ressel 9f538c1697 Some of the fsadm tools can also be in /usr/sbin instead of /sbin
Signed-off-by: Luis Ressel <aranea@aixah.de>
2014-08-14 15:41:40 -04:00
Chris PeBenito 81d9239296 Module version bump for libraries fc fix from Nicolas Iooss. 2014-07-08 08:53:06 -04:00
Nicolas Iooss 74ec2d61b2 Label /lib symlink as lib_t for every distro
As in Debian, Gentoo and Arch Linux /lib may be a symlink, move its file
context definition outside of ifdef blocks.
2014-07-08 08:49:37 -04:00
Chris PeBenito 491683b3e2 Module version bump for init_daemon_pid_file from Sven Vermeulen. 2014-06-30 14:34:51 -04:00
Sven Vermeulen 4a94489be7 Use init_daemon_pid_file instead of init_daemon_run_dir
Update non-contrib modules to use init_daemon_pid_file instead of
init_daemon_run_dir.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2014-06-26 08:34:27 -04:00
Sven Vermeulen 3cea6ac6b6 Deprecate init_daemon_run_dir interface
With init_daemon_pid_file supporting class parameters, all calls to
init_daemon_run_dir can now be transformed into init_daemon_pid_file
calls.

Update the init_daemon_run_dir interface so it gives a warning when
used, and use the init_daemon_pid_file interface underlyingly.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2014-06-26 08:34:27 -04:00
Sven Vermeulen d64826b606 Support initrc_t generated pid files with file transition
For some daemons, it is the init script that is responsible for creating
the PID file of the daemon. As we do not want to update the init SELinux
policy module for each of these situations, we need to introduce an
interface that can be called by the SELinux policy module of the caller
(the daemon domain).

The initial suggestion was to transform the init_daemon_run_dir
interface, which offers a similar approach for directories in /run, into
a class-agnostic interface. Several names have been suggested, such as
init_script_spec_run_content or init_script_generic_run_filetrans_spec,
but in the end init_daemon_pid_file was used.

The interface requires the class(es) on which the file transition should
occur, like so:

  init_daemon_pid_file(xdm_var_run_t, dir, "xdm")
  init_daemon_pid_file(postgresql_var_run_t, file, "postgresql.pid")

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2014-06-26 08:34:26 -04:00
Chris PeBenito 13b837fc15 Module version bump for unconfined syslog cap from Nicolas Iooss. 2014-06-09 09:29:12 -04:00
Nicolas Iooss 4067a18530 Allow unconfined domains to use syslog capability
When an unconfined_t root user runs dmesg, the kernel complains with
this message in its logs (when SELinux is in enforcing mode):

  dmesg (16289): Attempt to access syslog with CAP_SYS_ADMIN but no
  CAP_SYSLOG (deprecated).

audit.log contains following AVC:

  avc:  denied  { syslog } for  pid=16289 comm="dmesg" capability=34
  scontext=unconfined_u:unconfined_r:unconfined_t
  tcontext=unconfined_u:unconfined_r:unconfined_t tclass=capability2
2014-06-09 09:28:33 -04:00
Elia Pinto a55da23db2 Fix misspelling
Fix misspelling using  http://github.com/lyda/misspell-check

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
2014-06-09 08:21:45 -04:00
Chris PeBenito d580aae38f Module version bump for shutdown transitions from Luis Ressel. 2014-06-09 08:21:33 -04:00
Luis Ressel f6352c317b Allow init to execute shutdown
In many inittabs, there's a line like
"ca:12345:ctrlaltdel:/sbin/shutdown -h now" which triggers a shutdown or
a reboot on Ctrl+Alt+Del.
2014-06-09 08:15:57 -04:00
Chris PeBenito 342498065e Module version bump for deprecated interface usage removal from Nicolas Iooss. 2014-05-27 09:23:29 -04:00
Nicolas Iooss 40c155f732 No longer use deprecated MLS interfaces
Since commit 2d0c9cec mls_file_read_up and mls_file_write_down
interfaces are deprecated even though they are still present.

Replace mls_file_read_up with mls_file_read_all_levels and
mls_file_write_down with mls_file_write_all_levels.
2014-05-27 09:08:36 -04:00
Chris PeBenito 84f2b380cf Module version bump for ifconfig fc entry from Sven Vermeulen. 2014-05-27 09:08:12 -04:00
Sven Vermeulen bb3d41826b ifconfig can also be in /bin
Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2014-05-27 08:53:55 -04:00
Chris PeBenito 1013c53a94 Module version bump for unconfined->lvm transition from Nicolas Iooss. 2014-05-13 08:44:26 -04:00
Nicolas Iooss 7c356f97f5 Make unconfined user run lvm programs in confined domain
When an unconfined user uses truecrypt to mount an encrypted file, dmsetup is
called to setup a new device.  This program works with udev to configure the
new device and uses SysV semaphores to synchronize states.  As udev runs
dmsetup in lvm_t domain, the first dmsetup process needs to create lvm_t
semaphores (not unconfined_t) and hence needs to run in lvm_t domain.

More details are available in the archives on the ML:
http://oss.tresys.com/pipermail/refpolicy/2014-May/007111.html
2014-05-13 08:18:47 -04:00
Chris PeBenito 16bc3a454f Module version bumps for fc fixes from Nicolas Iooss. 2014-04-21 10:37:44 -04:00
Nicolas Iooss 18421fc720 Label /usr/share/virtualbox/VBoxCreateUSBNode.sh as udev_helper_exec_t
VBoxCreateUSBNode.sh creates character special files in /dev/vboxusb each time
a new USB device appears.  This script is called by udev.

audit.log on a system in permissive mode before this patch contains:

    type=AVC msg=audit(1396889711.890:175): avc:  denied  { execute } for  pid=26284 comm="systemd-udevd" name="VBoxCreateUSBNode.sh" dev="sda5" ino=5899405 scontext=system_u:system_r:udev_t tcontext=unconfined_u:object_r:usr_t tclass=file
    type=AVC msg=audit(1396889711.890:175): avc:  denied  { execute_no_trans } for  pid=26284 comm="systemd-udevd" path="/usr/share/virtualbox/VBoxCreateUSBNode.sh" dev="sda5" ino=5899405 scontext=system_u:system_r:udev_t tcontext=unconfined_u:object_r:usr_t tclass=file
2014-04-21 10:15:51 -04:00
Nicolas Iooss a102fccdba Label syslog-ng.pid as syslogd_var_run_t 2014-04-21 09:26:09 -04:00
Chris PeBenito fbae5870d9 Module version bump for fixes from Laurent Bigonville. 2014-04-21 09:24:28 -04:00
Laurent Bigonville b963532e7c Label /etc/locale.alias as locale_t on Debian
On Debian, /usr/share/locale/locale.alias is a symlink to
/etc/locale.alias, properly label this file.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707246
2014-04-21 09:02:26 -04:00
Chris PeBenito 3b697dbb25 Module version bump for 2 patch sets from Laurent Bigonville.
* xattrfs attribute
* Misc Debian fixes
2014-04-11 11:21:03 -04:00
Laurent Bigonville d30d36a2fe Label /usr/local/share/ca-certificates(/.*)? as cert_t
On Debian, this directory can contain locally trusted certificates that
will be then be symlinked to /etc/ssl/certs by
update-ca-certificates(8), the files should be labelled as cert_t.
2014-04-11 09:26:12 -04:00
Laurent Bigonville b7bd94f923 Properly label the manpages installed by postgresql
The postgresql manpages are installed under a private directory, some of
them are symlinked to the usual location.

Properly labeling them ensure that mandb can read them.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740591
2014-04-11 09:26:12 -04:00
Laurent Bigonville 86a429de23 Use new fs_getattr_all_xattr_fs interface for setfiles_t and restorecond_t
Use the new fs_getattr_all_xattr_fs() interface to allow setfiles_t and
restorecond_t domain to also get the attributes on pseudo-filesystems
that support xattr

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740682
2014-04-11 09:08:19 -04:00
Chris PeBenito 8d94022284 Module version bump for userdomain kernel symbol table fix from Nicolas Iooss. 2014-04-04 15:53:32 -04:00
Nicolas Iooss 27f4846ff8 userdomain: no longer allow unprivileged users to read kernel symbols
Unprivileged users don't need to read kallsyms and /boot/System.map.

This allow rule was introduced in the initial revision of userdomain.if in
2005, with commit b16c6b8c32a631a2e66265f6f60b664222760972:

    # cjp: why?
    bootloader_read_kernel_symbol_table($1_t)
2014-04-04 15:52:17 -04:00
Chris PeBenito 10ff4d0fa3 Bump module versions for release. 2014-03-11 08:16:57 -04:00
Luis Ressel a10fefcd39 Label fatsort as fsadm_exec_t.
FATsort is an utility to sort directory entries on FAT partitions, see
http://fatsort.sourceforge.net/ . It requires direct access to the
block devices.
2014-02-15 14:39:32 -05:00
Chris PeBenito 3501307078 Fix read loopback file interface. 2014-02-08 11:35:57 -05:00
Chris PeBenito 92cd2e251c Module version bump for loopback file mounting fixes from Luis Ressel. 2014-02-08 10:50:34 -05:00
Chris PeBenito acf1229dad Rename mount_read_mount_loopback() to mount_read_loopback_file().
Also make kernel block optional since the calls are to a higher layer.
2014-02-08 10:49:47 -05:00
Luis Ressel 24be4c0096 Allow mount_t usage of /dev/loop-control
If loopback devices are not pregenerated (kernel option
CONFIG_BLK_DEV_LOOP_MIN_COUNT=0), mount needs to write to
/dev/loop-control do create them dynamically when needed.
2014-02-08 10:32:45 -05:00
Luis Ressel 09370605a3 system/mount.if: Add mount_read_mount_loopback interface 2014-02-08 10:32:44 -05:00
Chris PeBenito d5a562246e Module version bump for logging fc patch from Laurent Bigonville. 2014-01-31 22:24:08 -05:00
Laurent Bigonville 64be72b662 Add fcontext for rsyslog pidfile 2014-01-31 21:54:40 -05:00
Chris PeBenito 41ee5421a7 Module version bump for unconfined transition to dpkg from Laurent Bigonville. 2014-01-27 13:19:57 -05:00
Laurent Bigonville 0e1c64f3bb Allow unconfined users to transition to dpkg_t domain
dpkg is now using rpm_execcon()/setexecfilecon()-like function to
transition to the dpkg_script_t domain. This function will fail in
enforcing mode if the transition is not allowed.
2014-01-27 12:41:45 -05:00
Chris PeBenito 3ffc91fff4 Module version bump for ZFS tools fc entries from Matthew Thode. 2014-01-21 08:55:37 -05:00
Chris PeBenito 734aebb02d Rearrange ZFS fc entries. 2014-01-21 08:55:28 -05:00
Chris PeBenito 496faf8c43 Fix ZFS fc escaping in mount. 2014-01-21 08:54:59 -05:00
Matthew Thode fd9c2fc1e6 Extending support for SELinux on ZFS
Signed-off-by: Matthew Thode <mthode@mthode.org>
2014-01-21 08:43:40 -05:00
Chris PeBenito 0075ffb8b3 Module version bump for module store labeling fixes from Laurent Bigonville. 2014-01-17 08:54:08 -05:00
Laurent Bigonville be12f4dc18 Label /etc/selinux/([^/]*/)?modules(/.*)? as semanage_store_t
Move the filetrans_patern out of the seutil_manage_module_store
interface as only semanage_t should be creating this directory
2014-01-16 16:12:44 -05:00
Chris PeBenito d3af996d01 Module version bump for direct initrc fixes from Dominick Grift. 2014-01-16 16:11:02 -05:00
Dominick Grift 493ca67e54 Apply direct_initrc to unconfined_r:unconfined_t
Make it consistent with sysadm_r:sysadm_t.

If you build targeted policy then consider direct_initrc=y

If you build with direct_initrc=n then both unconfined_r:unconfined_t,
as well as sysadm_r:sysadm_t rely on run_init for running services on
behalf of the system.

Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2014-01-16 15:27:18 -05:00
Dominick Grift 2be58db792 Change behavior of init_run_daemon()
Callers on init_run_daemon() role and domain transition on all
init_script_file_type to system_r and initrc_t respectively.

The old behavior of role and domain transitioning on init daemon entry
files was causing problems with programs that can be run both by system
and session.

Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2014-01-16 14:42:00 -05:00
Chris PeBenito 58db129761 Update modules for file_t merge into unlabeled_t. 2014-01-16 11:24:25 -05:00
Chris PeBenito 51fe53e3fb Module version bump for patch from Laurent Bigonville. 2013-12-20 15:04:52 -05:00
Laurent Bigonville 62a8012a77 Allow udev to write in /etc/udev/rules.d
Udev is writing persistent rules in /etc/udev/rules.d to ensure the
network interfaces and storage devices have a persistent name.

This patch has been taken from the Fedora policy
2013-12-20 15:04:22 -05:00
Chris PeBenito e9efb9297f Module version bump for patch from Laurent Bigonville. 2013-12-20 15:02:24 -05:00
Laurent Bigonville ac4dad0ed6 Label /bin/fusermount like /usr/bin/fusermount
On Debian, fusermount is installed under that path
2013-12-20 15:01:03 -05:00
Chris PeBenito 05892ad6db Module version bump for 2 patches from Dominick Grift. 2013-12-20 14:56:07 -05:00
Dominick Grift 39f77972ab init: the gdomap and minissdpd init scripts read the respective environ files in /etc/default. We need to give them a private type so that we can give the gdomap_admin() and minissdpd_admin() access to it, but it seems overengineering to create private environ types for these files
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-20 14:47:27 -05:00
Dominick Grift f4a4074d33 init: exim init script runs various helper apps that create and manage /var/lib/exim4/config.autogenerated.tmp file
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-20 14:47:27 -05:00
Chris PeBenito 7725c1b677 Fix Debian compile issue. 2013-12-20 14:44:03 -05:00
Chris PeBenito aa3c38bedb Module version bump for 4 init patches from Dominick Grift. 2013-12-10 10:40:38 -05:00
Chris PeBenito 5c345460b1 init: creates /run/utmp
Manually apply patch from Dominick Grift.
2013-12-10 10:31:01 -05:00
Chris PeBenito 5cb20b443e init: init_script_domain() allow system_r role the init script domain type
Manually apply patch from Dominick Grift.
2013-12-10 10:30:09 -05:00
Chris PeBenito eb0dcf6f94 Whitespace fix in init.te. 2013-12-10 10:29:53 -05:00
Dominick Grift 75cca597f6 init: this is a bug in debian where tmpfs is mounted on /run, and so early on in the boot process init creates /run/utmp and /run/initctl in a tmpfs directory (/) tmpfs
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-10 10:29:53 -05:00
Dominick Grift 32d6aac409 init: for a specified automatic role transition to work. the source role must be allowed to change manually to the target role
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-10 10:29:48 -05:00
Chris PeBenito b339b85001 Module version bump for patches from Dominick Grift. 2013-12-06 09:49:41 -05:00
Dominick Grift 8e01054f07 users: calls pulseaudio_role() for restricted xwindows users and staff_t/user_t
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-06 08:48:09 -05:00
Chris PeBenito c7e2518162 Whitespace fix in libraries. 2013-12-06 08:48:04 -05:00
Dominick Grift b56ecb9d52 libraries: for now i can only confirm mmap, might need to be changed to bin_t later if it turns out to need execute_no_trans
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-06 08:47:53 -05:00
Dominick Grift e784e78825 iptables: calls to firewalld interfaces from Fedora. The firewalld_dontaudit_rw_tmp_files(iptables_t) was confirmed on Debian.
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-06 08:16:49 -05:00
Chris PeBenito 3208ff94c4 Module version bump for second lot of patches from Dominick Grift. 2013-12-03 13:03:35 -05:00
Dominick Grift 1b757c65cc udev: in debian udevadm is located in /bin/udevadm
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-03 11:34:15 -05:00
Chris PeBenito 3ee649f132 Add comment in policy for lvm sysfs write. 2013-12-03 10:54:22 -05:00
Dominick Grift 6905ddaa98 lvm: lvm writes read_ahead_kb
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-03 10:53:23 -05:00
Dominick Grift 198a6b2830 udev: udevd executable location changed
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-03 10:52:44 -05:00
Chris PeBenito 613100a7f4 Whitespace fix in fstools. 2013-12-03 10:39:51 -05:00
Dominick Grift 521bbf8586 These { read write } tty_device_t chr files on boot up in Debian
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-03 10:39:21 -05:00
Chris PeBenito ac22f3a48e setrans: needs to be able to get attributes of selinuxfs, else fails to start in Debian
Access noted by Dominick Grift.
2013-12-03 09:52:21 -05:00
Chris PeBenito 3b52b87615 Rearrage userdom_delete_user_tmpfs_files() interface. 2013-12-03 09:45:16 -05:00
Dominick Grift b0068ace7d userdomain: add userdom_delete_user_tmpfs_files() for pulseaudio clients
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-03 09:43:51 -05:00
Chris PeBenito 1a01976fc4 Module version bump for first batch of patches from Dominick Grift. 2013-12-02 14:22:29 -05:00
Dominick Grift 66c6b8a9f7 unconfined: Do not domain transition to xserver_t (unconfined_t is xserver_unconfined)
It would not be sufficient in the current shape anyways because
unconfined_r is not associated with xserver_t

Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-12-02 08:43:33 -05:00