]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
selinux-access: log warning on context acquisition failure 14778/head
authorChristian Göttsche <cgzones@googlemail.com>
Wed, 18 Dec 2019 13:57:00 +0000 (14:57 +0100)
committerChristian Göttsche <cgzones@googlemail.com>
Tue, 4 Feb 2020 17:11:42 +0000 (18:11 +0100)
Relevant when testing in permissive mode, where the function does not return a failure to the client.
This helps to configure a system in permissive mode, without getting surprising failures when switching to enforced mode.

src/core/selinux-access.c

index 9fd3099feab24f86c28aeaa2bf1fff8ae23453d0..4500e4452fa22f063afc520100a655386dd9e490 100644 (file)
@@ -223,6 +223,7 @@ int mac_selinux_generic_access_check(
 
                 r = getfilecon_raw(path, &fcon);
                 if (r < 0) {
+                        log_warning_errno(errno, "SELinux getfilecon_raw on '%s' failed: %m (tclass=%s perm=%s)", path, tclass, permission);
                         r = sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to get file context on %s.", path);
                         goto finish;
                 }
@@ -231,6 +232,7 @@ int mac_selinux_generic_access_check(
         } else {
                 r = getcon_raw(&fcon);
                 if (r < 0) {
+                        log_warning_errno(errno, "SELinux getcon_raw failed: %m (tclass=%s perm=%s)", tclass, permission);
                         r = sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Failed to get current context.");
                         goto finish;
                 }