aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init/Kconfig14
-rw-r--r--kernel/auditsc.c10
2 files changed, 4 insertions, 20 deletions
diff --git a/init/Kconfig b/init/Kconfig
index fed81b576f29..18a98c893d07 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -301,20 +301,6 @@ config AUDIT_TREE
301 depends on AUDITSYSCALL 301 depends on AUDITSYSCALL
302 select FSNOTIFY 302 select FSNOTIFY
303 303
304config AUDIT_LOGINUID_IMMUTABLE
305 bool "Make audit loginuid immutable"
306 depends on AUDIT
307 help
308 The config option toggles if a task setting its loginuid requires
309 CAP_SYS_AUDITCONTROL or if that task should require no special permissions
310 but should instead only allow setting its loginuid if it was never
311 previously set. On systems which use systemd or a similar central
312 process to restart login services this should be set to true. On older
313 systems in which an admin would typically have to directly stop and
314 start processes this should be set to false. Setting this to true allows
315 one to drop potentially dangerous capabilites from the login tasks,
316 but may not be backwards compatible with older init systems.
317
318source "kernel/irq/Kconfig" 304source "kernel/irq/Kconfig"
319source "kernel/time/Kconfig" 305source "kernel/time/Kconfig"
320 306
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 72684679e8bd..b55788bf1607 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1968,15 +1968,13 @@ static atomic_t session_id = ATOMIC_INIT(0);
1968 1968
1969static int audit_set_loginuid_perm(kuid_t loginuid) 1969static int audit_set_loginuid_perm(kuid_t loginuid)
1970{ 1970{
1971#ifdef CONFIG_AUDIT_LOGINUID_IMMUTABLE
1972 /* if we are unset, we don't need privs */ 1971 /* if we are unset, we don't need privs */
1973 if (!audit_loginuid_set(current)) 1972 if (!audit_loginuid_set(current))
1974 return 0; 1973 return 0;
1975#else /* CONFIG_AUDIT_LOGINUID_IMMUTABLE */ 1974 /* it is set, you need permission */
1976 if (capable(CAP_AUDIT_CONTROL)) 1975 if (!capable(CAP_AUDIT_CONTROL))
1977 return 0; 1976 return -EPERM;
1978#endif /* CONFIG_AUDIT_LOGINUID_IMMUTABLE */ 1977 return 0;
1979 return -EPERM;
1980} 1978}
1981 1979
1982static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid, 1980static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,