aboutsummaryrefslogtreecommitdiff
path: root/sys/security
diff options
context:
space:
mode:
authorOlivier Certner <olce.freebsd@certner.fr>2023-08-17 23:54:37 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2023-09-28 14:42:22 +0000
commit7974ca1cdbee949f5e453eea112be265b425c407 (patch)
tree7d0296a6dd8e4fb1ae3782b69b67782ac6fa19c2 /sys/security
parent62d3f57c22eea353dcc3c4a2f70ef72a42a8cd83 (diff)
downloadsrc-7974ca1cdbee949f5e453eea112be265b425c407.tar.gz
src-7974ca1cdbee949f5e453eea112be265b425c407.zip
cr_canseejailproc(): New privilege, no direct check for UID 0
Use priv_check_cred() with a new privilege (PRIV_SEEJAILPROC) instead of explicitly testing for UID 0 (the former has been the rule for almost 20 years). As a consequence, cr_canseejailproc() now abides by the 'security.bsd.suser_enabled' sysctl and MAC policies. Update the MAC policies Biba and LOMAC, and prison_priv_check() so that they don't deny this privilege. This preserves the existing behavior (the 'root' user is not restricted, even when jailed, unless 'security.bsd.suser_enabled' is not 0) and is consistent with what is done for the related policies/privileges (PRIV_SEEOTHERGIDS, PRIV_SEEOTHERUIDS). Reviewed by: emaste (earlier version), mhorne MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40626
Diffstat (limited to 'sys/security')
-rw-r--r--sys/security/mac_biba/mac_biba.c1
-rw-r--r--sys/security/mac_lomac/mac_lomac.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c
index 6948548503e1..5d66e2fd4b9b 100644
--- a/sys/security/mac_biba/mac_biba.c
+++ b/sys/security/mac_biba/mac_biba.c
@@ -1924,6 +1924,7 @@ biba_priv_check(struct ucred *cred, int priv)
*/
case PRIV_SEEOTHERGIDS:
case PRIV_SEEOTHERUIDS:
+ case PRIV_SEEJAILPROC:
break;
/*
diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c
index 05bd0da06960..aa9abf458721 100644
--- a/sys/security/mac_lomac/mac_lomac.c
+++ b/sys/security/mac_lomac/mac_lomac.c
@@ -1702,6 +1702,7 @@ lomac_priv_check(struct ucred *cred, int priv)
*/
case PRIV_SEEOTHERGIDS:
case PRIV_SEEOTHERUIDS:
+ case PRIV_SEEJAILPROC:
break;
/*