提交 c9b37fee 编写于 作者: M Michal Privoznik

selinux: Detect virt_use_nfs boolean set

If we fail setting label on a file and this file is on NFS share,
it is wise to advise user to set virt_use_nfs selinux boolean
variable.
上级 b14e7d2a
...@@ -420,8 +420,17 @@ SELinuxSetFilecon(const char *path, char *tcon) ...@@ -420,8 +420,17 @@ SELinuxSetFilecon(const char *path, char *tcon)
* virt_use_{nfs,usb,pci} boolean tunables to allow it... * virt_use_{nfs,usb,pci} boolean tunables to allow it...
*/ */
if (setfilecon_errno != EOPNOTSUPP) { if (setfilecon_errno != EOPNOTSUPP) {
const char *errmsg;
if ((virStorageFileIsSharedFSType(path,
VIR_STORAGE_FILE_SHFS_NFS) == 1) &&
security_get_boolean_active("virt_use_nfs") != 1) {
errmsg = _("unable to set security context '%s' on '%s'. "
"Consider setting virt_use_nfs");
} else {
errmsg = _("unable to set security context '%s' on '%s'");
}
virReportSystemError(setfilecon_errno, virReportSystemError(setfilecon_errno,
_("unable to set security context '%s' on '%s'"), errmsg,
tcon, path); tcon, path);
if (security_getenforce() == 1) if (security_getenforce() == 1)
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册