commit:     c307ecefdf832e0c77ea2ffce048b4818f7a09ec
Author:     Yi Zhao <yi.zhao <AT> windriver <DOT> com>
AuthorDate: Wed Jul  8 06:38:55 2020 +0000
Commit:     Kenton Groombridge <concord <AT> gentoo <DOT> org>
CommitDate: Wed Nov  2 14:06:49 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=c307ecef

sysnetwork: allow systemd_networkd_t to read link file

Per https://systemd.network/systemd.network.html, we can create a
symlink pointing to /dev/null for systemd network configuration file.
For example:
$ ls -l /etc/systemd/network/80-wired.network
lrwxrwxrwx. 1 root root 9 Mar  9  2022 /etc/systemd/network/80-wired.network -> 
/dev/null

Fixes:
avc:  denied  { read } for  pid=211 comm="systemd-network"
name="80-wired.network" dev="vda" ino=1477
scontext=system_u:system_r:systemd_networkd_t:s0-s15:c0.c1023
tcontext=system_u:object_r:net_conf_t:s0 tclass=lnk_file permissive=0

systemd-networkd[211]: Failed to load /etc/systemd/network/80-wired.network, 
ignoring: Permission denied

Signed-off-by: Yi Zhao <yi.zhao <AT> windriver.com>
Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>

 policy/modules/system/sysnetwork.if | 1 +
 1 file changed, 1 insertion(+)

diff --git a/policy/modules/system/sysnetwork.if 
b/policy/modules/system/sysnetwork.if
index 2598c7adc..77c175970 100644
--- a/policy/modules/system/sysnetwork.if
+++ b/policy/modules/system/sysnetwork.if
@@ -349,6 +349,7 @@ interface(`sysnet_read_config',`
        files_search_runtime($1)
        allow $1 net_conf_t:dir list_dir_perms;
        allow $1 net_conf_t:file read_file_perms;
+       allow $1 net_conf_t:lnk_file read_lnk_file_perms;
 
        ifdef(`distro_debian',`
                files_search_runtime($1)

Reply via email to