Hide Forgot
Description of problem: Selinux does not keep the context of some QT SDK files Version-Release number of selected component (if applicable): policycoreutils-2.1.11-5.fc17.x86_64 How reproducible: In Fedora 15+16+17 try to restore the default file SELinux security contexts. Restorecon shows a reset. Try it again, Restorecon will also show a reset again. Steps to Reproduce: 1.download QT SDK (http://qt.nokia.com/downloads) 2.install QT SDK for example to /opt/qtsdk/ 3.restorecon -R -v /opt/qtsdk/ Actual results: restorecon -R -v /opt/qtsdk/ restorecon reset /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids context system_u:object_r:usr_t:s0->system_u:object_r:var_lib_t:s0 restorecon -R -v /opt/qtsdk/ restorecon reset /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids context system_u:object_r:usr_t:s0->system_u:object_r:var_lib_t:s0
So you are saying the restorecon is actully not setting the file context. ls -lZ /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids Does the following report an error? # chcon -t var_lib_t /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids
It seems, that the file context is OK but restorecon shows a reset: # ls -lZ /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids -rw-r--r--. japplo japplo system_u:object_r:var_lib_t:s0 /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids # restorecon -R -v /opt/qtsdk/ | grep "usbutils/usb.ids" restorecon reset /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids context system_u:object_r:usr_t:s0->system_u:object_r:var_lib_t:s0 # chcon -t var_lib_t /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids # restorecon -R -v /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/ | grep "usbutils/usb.ids" Thanks japplo
Is this file hard linked somewhere else? IE if the Inode is in bodth /var/lib and in another directory under /opt, restorecon could be changing the label twice. Once to var_lib_t and once to usr_t, depending on the path to the inode.
ls -i /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/ 805828 usb.ids find / -inum 805828 /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/share/misc/usb.ids /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids OK, thanks, you are right.
But how can I overcome the relabeling issue?
You need to have the same labeling for both files. You will need to use the "semanage" tool to add labeling.
semanage fcontext -a -t var_lib_t /opt/qtsdk/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/var/lib/usbutils/usb.ids
ok, many thanks