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@windriver.com>
This commit is contained in:
Yi Zhao 2020-07-08 14:38:55 +08:00
parent 5a93c88acc
commit ce8616ad34

View File

@ -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)