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.
This commit is contained in:
Krzysztof Nowicki 2017-05-14 17:24:03 +02:00 committed by Chris PeBenito
parent 3cdaad6e29
commit 3b5e622339
2 changed files with 20 additions and 0 deletions

View File

@ -2849,6 +2849,25 @@ interface(`files_relabelto_etc_dirs',`
allow $1 etc_t:dir relabelto;
')
########################################
## <summary>
## Mount a filesystem on the
## etc directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`files_mounton_etc_dirs',`
gen_require(`
type etc_t;
')
allow $1 etc_t:dir mounton;
')
########################################
## <summary>
## Read generic files in /etc.

View File

@ -288,6 +288,7 @@ ifdef(`init_systemd',`
files_search_kernel_modules(init_t)
# for privatetmp functions
files_mounton_tmp(init_t)
files_mounton_etc_dirs(init_t)
fs_relabel_cgroup_dirs(init_t)
fs_rw_cgroup_files(init_t)