forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac_do: add a new MAC/do policy and mdo(1) utility
This policy enables a user to become another user without having to be root (hence no setuid binary). it is configured via rules using sysctl security.mac.do.rules For example: security.mac.do.rules=uid=1001:80,gid=0:any The above rule means the user identifier by the uid 1001 is able to become user 80 Any user of the group 0 are allowed to become any user on the system. The mdo(1) utility expects the MAC/do policy to be installed and its rules defined. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D45145
- Loading branch information
Showing
9 changed files
with
757 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.\"- | ||
.\" Copyright (c) 2024 Baptiste Daroussin <bapt@FreeBSD.org> | ||
.\" | ||
.\" SPDX-License-Identifier: BSD-2-Clause | ||
.\" | ||
.Dd May 22, 2024 | ||
.Dt MAC_DO 4 | ||
.Os | ||
.Sh NAME | ||
.Nm mac_do | ||
.Nd "policy allowing user to execute program as another user" | ||
.Sh SYNOPSIS | ||
To compile the | ||
.Nm | ||
policy into your kernel, place the following lines | ||
in your kernel configruation file: | ||
.Bd -ragged -offset indent | ||
.Cd "options MAC" | ||
.Cd "options MAC_DO" | ||
.Ed | ||
.Sh DESCRIPTION | ||
The | ||
.Nm | ||
policy grants users the ability to run processs as other users | ||
according to predefined rules. | ||
.Pp | ||
The exact set of kernel privileges granted are: | ||
.Bl -inset -compact -offset indent | ||
.It Dv PRIV_CRED_SETGROUPS | ||
.It Dv PRIV_CRET_SETUID | ||
.El | ||
.Pp | ||
The following | ||
.Xr sysctl 8 | ||
MIBs are available: | ||
.Bl -tag -width indent | ||
.It Va security.mac.do.enabled | ||
Enable the | ||
.Nm | ||
policy. | ||
(Default: 1). | ||
.It Va security.mac.do.rules | ||
The set of rules. | ||
.El | ||
.Pp | ||
The rules consist of a list of elements separated by | ||
.So , Sc . | ||
Each element is of the form | ||
.Sm off | ||
.Do | ||
.Op Cm uid | Cm gid | ||
.Li = | ||
.Ar fid | ||
.Li : | ||
.Ar tid | ||
.Dc | ||
.Sm on . | ||
Where | ||
.Ar fid | ||
is the uid or gid of the user or group the rule applies to, and | ||
.Ar tid | ||
is the uid of the targetted user. | ||
Two special forms are accepted for | ||
.Ar tid : | ||
.Va any | ||
or | ||
.Va * , | ||
which allow to target any user. | ||
.Sh EXAMPLES | ||
The following rule: | ||
.Pp | ||
.Dl security.mac.do.rules=uid=1001:80,gid=0:any | ||
.Pp | ||
means the user with the uid 1001 can execute processes as user with uid 80, | ||
all the users which belongs to the group gid 0 can execute processes as any user. | ||
.Sh SEE ALSO | ||
.Xr mac 4 , | ||
.Xr mdo 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.PATH: ${SRCTOP}/sys/security/mac_do | ||
|
||
KMOD= mac_do | ||
SRCS= mac_do.c vnode_if.h | ||
|
||
.include <bsd.kmod.mk> |
Oops, something went wrong.