Commit Graph

96 Commits

Author SHA1 Message Date
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
Chris PeBenito
03e2f1a809 Simple map patch from Russell Coker. 2018-02-15 17:10:34 -05:00
Luis Ressel via refpolicy
75a5ebca75 kernel/files.if: files_list_kernel_modules should grant read perms for symlinks
files_search_kernel_modules also grant this; there's a couple of
symlinks in /lib/modules/.
2017-10-25 17:16:06 -04:00
Chris PeBenito
2ec1c9b85c files: Whitespace fix. 2017-10-12 18:00:12 -04:00
David Sugar
e7b4159ec5 Denial relabeling /run/systemd/private
I am seeing the following denial (in dmesg) during system startup:
[    4.623332] type=1400 audit(1507767947.042:3): avc:  denied  { relabelto } for  pid=1 comm="systemd" name="private" dev="tmpfs" ino=5865 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=sock_file

It appears that systemd is attempting to relablel the socket file /run/systemd/private to init_var_run_t but doesn't have permission.

Updated to create new interface for relabeling of sock_files rather than adding to existing interface

Signed-off-by: Dave Sugar <dsugar@tresys.com>
2017-10-12 18:00:12 -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
c695860748 files: Create files_map_usr_files interface 2017-09-11 20:31:23 -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
Chris PeBenito
efa32d9b56 Remove deprecated interfaces older than one year old.
Additionally one deprecated attribute removed.
2017-08-06 17:03:17 -04:00
Krzysztof Nowicki
3b5e622339 Enable /etc directory protection using ProtectSystem
Setting this service option to 'full' or 'strict' will also remount the
/etc directory. Allow this in the policy.

This fixes the systemd-networkd service, but will also positively affect
any other service using the above hardening option.
2017-05-15 18:41:00 -04:00
Chris PeBenito
8527b86621 Further strict systemd fixes from Russell Coker. 2017-04-20 20:00:34 -04:00
Chris PeBenito
73d8b3026c Systemd-related changes from Russell Coker. 2017-04-06 17:37:50 -04:00
Chris PeBenito
2cd92db5cd systemd-nspawn again
This patch doesn't do everything that is needed to have systemd-nspawn work.
But it does everything that is needed and which I have written in a clear and
uncontroversial way.  I think it's best to get this upstream now and then
either have a separate discussion about the more difficult issues, or wait
until I devise a way of solving those problems that's not too hacky.

Who knows, maybe someone else will devise a brilliant solution to the remaining
issues after this is accepted upstream.

Also there's a tiny patch for systemd_machined_t that is required by
systemd_nspawn_t.

Description: systemd-nspawn
Author: Russell Coker <russell@coker.com.au>
Last-Update: 2017-03-29
2017-04-01 12:08:42 -04:00
Chris PeBenito
160d08f3ae systemd-resolvd, sessions, and tmpfiles take2
I believe that I have addressed all the issues Chris raised, so here's a newer
version of the patch which applies to today's git version.

Description: systemd-resolved, sessions, and tmpfiles patches
Author: Russell Coker <russell@coker.com.au>
Last-Update: 2017-03-26
2017-03-28 18:51:35 -04:00
Chris PeBenito
2087bde934 Systemd fixes from Russell Coker. 2017-02-23 20:03:23 -05:00
Chris PeBenito
1720e109a3 Sort capabilities permissions from Russell Coker. 2017-02-15 18:47:33 -05:00
cgzones
ab652e1f59 add files_search_src()
required by loadkeys
2017-01-05 12:47:58 +01:00
Guido Trentalancia
d52463b9fe kernel: missing permissions for confined execution
This patch adds missing permissions in the kernel module that prevent
to run it without the unconfined module.

This second version improves the comment section of new interfaces:
"Domain" is replaced by "Domain allowed access".

Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
2016-12-27 10:38:07 -05:00
Guido Trentalancia
732234f8b6 modutils: update to run in confined mode
Update the modutils module so that it can run in confined
mode instead of unconfined mode.

Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
2016-12-27 10:23:58 -05:00
Guido Trentalancia
5c5d2d8d49 Add module_load permission to can_load_kernmodule
The "module_load" permission has been recently added to the "system"
class (kernel 4.7).

The following patch updates the Reference Policy so that the new
permission is allowed when a kernel module should be loaded.

To preserve the module encapsulation, a new interface is defined
in the kernel files module and that interface is then used in the
kernel module.

A short note is added about unneeded permissions that set the
kernel scheduling parameters (might lead to service disruption).

Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
2016-08-29 20:29:46 -04:00
Nicolas Iooss
c82a479ed8 Fix interface descriptions when duplicate ones are found
Distinct interfaces should have different comments
2016-01-19 00:17:34 +01:00
Chris PeBenito
f7286189b3 Add systemd units for core refpolicy services.
Only for services that already have a named init script.

Add rules to init_startstop_service(), with conditional arg until
all of refpolicy-contrib callers are updated.
2015-10-23 10:17:46 -04:00
Chris PeBenito
3639880cf6 Implement core systemd policy.
Significant contributions from the Tresys CLIP team.

Other changes from Laurent Bigonville.
2015-10-23 10:16:59 -04:00
Luis Ressel
7381deb292 kernel/files.if: Add files_dontaudit_list_var interface
This is required for an update of the couchdb policy.
2014-02-08 09:02:57 -05:00
Chris PeBenito
d66aeb8436 Merge file_t into unlabeled_t, as they are security equivalent. 2014-01-16 11:19:00 -05:00
Dominick Grift
85016ae811 mount: sets kernel thread priority mount: mount reads /lib/modules/3.10-2-amd64/modules.dep mount: mount lists all mount points
In debian mount was trying to list / on a tmpfs (/run/lock). Since
var_lock_t is a mountpoint type, and so is mnt_t, i decided to implement
a files_list_all_mountpoints() and call that for mount because it makes
sense

Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2013-09-27 16:50:38 -04:00
Chris PeBenito
6f1dfe762a Rearrange files interfaces. 2012-10-31 11:49:23 -04:00
Sven Vermeulen
d981fce3e1 Update files_manage_generic_locks with directory permissions
Currently, the files_manage_generic_locks only handles the lock files. If a
domain needs to manage both lock files and the lock directories (like specific
subdirectories in /var/lock that are not owned by a single other domain, such as
Gentoo's /var/lock/subsys location) it also needs the manage permissions on the
directory.

This is to support OpenRC's migration of /var/lock to /run/lock which otherwise
fails:

* Migrating /var/lock to /run/lock
cp: cannot create directory '/run/lock/subsys': Permission denied
rm: cannot remove '/var/lock/subsys': Permission denied

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2012-10-31 11:36:41 -04:00
Sven Vermeulen
5751a33f27 Introduce files_manage_all_pids interface
This interface will be used by domains that need to manage the various pidfile
content (*_var_run_t).

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2012-10-31 11:36:41 -04:00
Chris PeBenito
1673ea6474 Rearrange interfaces in files, clock, and udev. 2012-10-30 14:16:30 -04:00
Dominick Grift
fc749312f5 For virtd lxc
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2012-10-30 13:58:02 -04:00
Dominick Grift
f980fd9208 For virtd lxc
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2012-10-30 13:58:02 -04:00
Dominick Grift
193760f130 For svirt_lxc_domain
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2012-10-30 13:58:02 -04:00
Dominick Grift
298d840e46 Implement files_create_all_files_as() for cachefilesd
Signed-off-by: Dominick Grift <dominick.grift@gmail.com>
2012-10-04 08:13:18 -04:00
Chris PeBenito
61c65fe602 Rearrange interfaces in files.if and udev.if. 2012-07-24 08:55:52 -04:00
Sven Vermeulen
765e7b71ee Supporting interfaces for the /run changes
Since most distributions now support /run (which, thanks the the
file context substitutions, is marked as var_run_t), we need to update the
SELinux policies to support "dynamically" building up /run. Unlike /var/run,
which is most likely statically defined during distribution installation, /run
is a tmpfs which is built up from scratch on each and every boot.

But not only that, many services also use this location for other purposes than
just PID files (which is to be expected as these "other reasons" is why /run
came to be in the first place), so we need to support other types within this
location easily.

For this reason, we introduce support to
- creating the /run/lock location
- supporting named file transitions when init scripts create stuff in /run

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2012-07-24 08:42:10 -04:00
Chris PeBenito
4f24b1841c Add optional name for kernel and system filetrans interfaces. 2012-05-10 09:53:45 -04:00
Chris PeBenito
4f8e1a4e3d Rearrange a few files interfaces. 2012-05-04 09:13:11 -04:00
Chris PeBenito
e7ed5a1fe9 Whitespace fixes in files.if. 2012-05-04 09:00:33 -04:00
James Carter
709fd365b8 Create non_auth_file_type attribute and interfaces
Reduce the binary policy size by eliminating some set expressions
related to file accesses and make Repolicy easier to convert into CIL.
- Moved the auth_file_type attribute.
- Created a new type attribute called non_auth_file_type.
- Created new interfaces to allow file accesses on non_auth_file_type
files.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
2012-05-04 08:47:37 -04:00
Chris PeBenito
cb29c82a28 Rearrange mountpoint interfaces in files. 2012-04-20 15:38:51 -04:00
Chris PeBenito
a1d38fb485 Fix files whitespace issues. 2012-04-20 15:35:24 -04:00
Sven Vermeulen
f93d4fd85c Adding dontaudit interfaces for files module
Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2012-04-20 15:30:10 -04:00
Chris PeBenito
b594647caf Fix missing requires in /var/run and /var/lock symlink patch. 2011-07-18 14:12:07 -04:00
Chris PeBenito
edfe67fd15 Relocated /var/run and /var/lock from Martin Orr.
Add read_lnk_file_perms to all interfaces giving access to var_run_t and
var_lock_t.

This is needed as on Debian /var/run and /var/lock are now symlinks to
/run and /run/lock.
2011-07-18 13:33:22 -04:00
Chris PeBenito
e541d13ae5 Pull in additional kernel layer Fedora policy changes. 2011-04-14 10:05:56 -04:00
Chris PeBenito
0de0ea5c9e Start pulling in kernel layer pieces from Fedora. 2011-03-29 10:33:43 -04:00
Guido Trentalancia
1f93f1fa8c patch to fix a typo in the files module
This patch fixes a typo in the description of kernel files
interfaces.
2011-02-22 11:07:03 -05:00
Chris PeBenito
66ef236c90 Minor fixes for Chris Richards' mount patchset. 2010-11-11 09:47:37 -05:00