diff options
author | Eric Paris <eparis@redhat.com> | 2013-05-24 09:18:04 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-11-05 11:08:13 -0500 |
commit | d040e5af380554c23ffe0a034ae5f3e53da93a1d (patch) | |
tree | 637a2e206c56b1cd2be32f8ef92bea19e25a3e9c /kernel/auditsc.c | |
parent | 81407c84ace88368ff23abb81caaeacf050c8450 (diff) | |
download | linux-d040e5af380554c23ffe0a034ae5f3e53da93a1d.tar.gz linux-d040e5af380554c23ffe0a034ae5f3e53da93a1d.tar.bz2 linux-d040e5af380554c23ffe0a034ae5f3e53da93a1d.zip |
audit: audit feature to only allow unsetting the loginuid
This is a new audit feature which only grants processes with
CAP_AUDIT_CONTROL the ability to unset their loginuid. They cannot
directly set it from a valid uid to another valid uid. The ability to
unset the loginuid is nice because a priviledged task, like that of
container creation, can unset the loginuid and then priv is not needed
inside the container when a login daemon needs to set the loginuid.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index c75d7813aef2..924c0bf048d2 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1974,6 +1974,9 @@ static int audit_set_loginuid_perm(kuid_t loginuid) /* it is set, you need permission */ if (!capable(CAP_AUDIT_CONTROL)) return -EPERM; + /* reject if this is not an unset and we don't allow that */ + if (is_audit_feature_set(AUDIT_FEATURE_ONLY_UNSET_LOGINUID) && uid_valid(loginuid)) + return -EPERM; return 0; } |