Skip to contentSkip to conversation

setfiles rootfs labeling

DISCUSSION sajjad ahmed 2 participants 3 messages Sep 26, 2018 1 message not in the archive SELinux security module

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi all,
I'm trying to use the setfiles utility (v 2.7) from policycoreutils to label rootfs, it seems like setfiles exclude all the directories straight away and labels nothing. I tried an older version (< 2.6) that works fine. I'm using the yocto project to build packages and using native setfiles utility to "label rootfs on the build system". Is it utility who is not doing what is supposed to? I'm using the following command to label rootfs, sudo setfiles -v -r /tmp/sid/ /etc/selinux/refpolicy/contexts/files/file_contexts /tmp/sid/

- Sajjad Ahmed

#2 lore raw
Quoted 8 lines · sajjad ahmed via Selinux

Hi all,

I'm trying to use the setfiles utility (v 2.7) from policycoreutils to label rootfs, it seems like setfiles exclude all the directories straight away and labels nothing. I tried an older version (< 2.6) that works fine. I'm using the yocto project to build packages and using native setfiles utility to "label rootfs on the build system". Is it utility who is not doing what is supposed to?

I'm using the following command to label rootfs,
/sudosetfiles -v -r /tmp/sid/ /etc/selinux/refpolicy/contexts/files/file_contexts /tmp/sid// /
/

I'll guess that your build host OS has SELinux disabled and that consequently /proc/mounts does not show the seclabel option for the filesystem. Trying using the -m option to setfiles to ignore /proc/mounts.

#3 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 8 lines · sajjad ahmed via Selinux

Hi all,

I'm trying to use the setfiles utility (v 2.7) from policycoreutils to label rootfs, it seems like setfiles exclude all the directories straight away and labels nothing. I tried an older version (< 2.6) that works fine. I'm using the yocto project to build packages and using native setfiles utility to "label rootfs on the build system". Is it utility who is not doing what is supposed to?

I'm using the following command to label rootfs,
/sudosetfiles -v -r /tmp/sid/ /etc/selinux/refpolicy/contexts/files/file_contexts /tmp/sid// /
/

I'll guess that your build host OS has SELinux disabled and that consequently /proc/mounts does not show the seclabel option for the filesystem.  Trying using the -m option to setfiles to ignore /proc/mounts.

I guess we should be enabling this option automatically if SELinux is disabled on the host? Looks like we were skipping use of /proc/mounts in setfiles until moving it to use selinux_restorecon()