namespace: fix MAC labels of /dev when PrivateDevices=yes

Without changing the SELinux label for private /dev of a service, it will take
a generic file system label:
system_u:object_r:tmpfs_t:s0

After this change it is the same as without `PrivateDevices=yes`:
system_u:object_r:device_t:s0

This helps writing SELinux policies, as the same rules for `/dev` will apply
despite any `PrivateDevices=yes` setting.
This commit is contained in:
Topi Miettinen
2020-02-28 14:17:48 +00:00
committed by Topi Miettinen
parent 07336a0672
commit e6e81ec0a5
7 changed files with 40 additions and 12 deletions
+3 -3
View File
@@ -10,11 +10,11 @@
#include "selinux-util.h"
#include "smack-util.h"
int label_fix(const char *path, LabelFixFlags flags) {
int label_fix_container(const char *path, const char *inside_path, LabelFixFlags flags) {
int r, q;
r = mac_selinux_fix(path, flags);
q = mac_smack_fix(path, flags);
r = mac_selinux_fix_container(path, inside_path, flags);
q = mac_smack_fix_container(path, inside_path, flags);
if (r < 0)
return r;