freebsd-src/sys/security
Olivier Certner d40c6fa7db
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
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40626

(cherry picked from commit 7974ca1cdb)

Approved by:    markj (mentor)
2023-12-21 14:36:00 +01:00
..
audit sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
mac sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00
mac_biba cr_canseejailproc(): New privilege, no direct check for UID 0 2023-12-21 14:36:00 +01:00
mac_bsdextended sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_ifoff sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_lomac cr_canseejailproc(): New privilege, no direct check for UID 0 2023-12-21 14:36:00 +01:00
mac_mls sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_none sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_ntpd sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_partition sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_portacl sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_priority Thread creation privilege for realtime group 2021-12-19 04:42:52 +02:00
mac_seeotheruids sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_stub sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_test sys: Remove $FreeBSD$: two-line .h pattern 2023-08-23 11:43:20 -06:00
mac_veriexec sys: Remove $FreeBSD$: one-line .h pattern 2023-08-23 11:43:22 -06:00
mac_veriexec_parser sys: Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:25 -06:00