xref: /freebsd/share/man/man9/cr_bsd_visible.9 (revision 0d6bf73c4f20e6ed719c29c1b382d24bb0a81a2f)
1*0d6bf73cSOlivier Certner.\"
2*0d6bf73cSOlivier Certner.\" SPDX-License-Identifier: BSD-2-Clause
3*0d6bf73cSOlivier Certner.\"
4*0d6bf73cSOlivier Certner.\" Copyright (c) 2023 Olivier Certner <olce.freebsd@certner.fr>
5*0d6bf73cSOlivier Certner.\"
6*0d6bf73cSOlivier Certner.\" Redistribution and use in source and binary forms, with or without
7*0d6bf73cSOlivier Certner.\" modification, are permitted provided that the following conditions
8*0d6bf73cSOlivier Certner.\" are met:
9*0d6bf73cSOlivier Certner.\" 1. Redistributions of source code must retain the above copyright
10*0d6bf73cSOlivier Certner.\"    notice, this list of conditions and the following disclaimer.
11*0d6bf73cSOlivier Certner.\" 2. Redistributions in binary form must reproduce the above copyright
12*0d6bf73cSOlivier Certner.\"    notice, this list of conditions and the following disclaimer in the
13*0d6bf73cSOlivier Certner.\"    documentation and/or other materials provided with the distribution.
14*0d6bf73cSOlivier Certner.\"
15*0d6bf73cSOlivier Certner.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16*0d6bf73cSOlivier Certner.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*0d6bf73cSOlivier Certner.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*0d6bf73cSOlivier Certner.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19*0d6bf73cSOlivier Certner.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*0d6bf73cSOlivier Certner.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*0d6bf73cSOlivier Certner.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*0d6bf73cSOlivier Certner.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*0d6bf73cSOlivier Certner.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*0d6bf73cSOlivier Certner.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*0d6bf73cSOlivier Certner.\"
26*0d6bf73cSOlivier Certner.Dd August 18, 2023
27*0d6bf73cSOlivier Certner.Dt CR_BSD_VISIBLE 9
28*0d6bf73cSOlivier Certner.Os
29*0d6bf73cSOlivier Certner.Sh NAME
30*0d6bf73cSOlivier Certner.Nm cr_bsd_visible
31*0d6bf73cSOlivier Certner.Nd determine if subjects may see entities according to BSD security policies
32*0d6bf73cSOlivier Certner.Sh SYNOPSIS
33*0d6bf73cSOlivier Certner.In sys/proc.h
34*0d6bf73cSOlivier Certner.Ft int
35*0d6bf73cSOlivier Certner.Fn cr_bsd_visible "struct ucred *u1" "struct ucred *u2"
36*0d6bf73cSOlivier Certner.Sh DESCRIPTION
37*0d6bf73cSOlivier CertnerThis function determines if a subject with credentials
38*0d6bf73cSOlivier Certner.Fa u1
39*0d6bf73cSOlivier Certneris denied seeing an object or subject associated to credentials
40*0d6bf73cSOlivier Certner.Fa u2
41*0d6bf73cSOlivier Certnerby the following policies and associated
42*0d6bf73cSOlivier Certner.Xr sysctl 8
43*0d6bf73cSOlivier Certnerknobs:
44*0d6bf73cSOlivier Certner.Bl -tag -width indent
45*0d6bf73cSOlivier Certner.It Va security.bsd.seeotheruids
46*0d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects if they are not
47*0d6bf73cSOlivier Certnerassociated with the same real user ID.
48*0d6bf73cSOlivier CertnerThe corresponding internal function is
49*0d6bf73cSOlivier Certner.Xr cr_canseeotheruids 9 .
50*0d6bf73cSOlivier Certner.It Va security.bsd.seeothergids
51*0d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects if they are not both
52*0d6bf73cSOlivier Certnera member of at least one common group.
53*0d6bf73cSOlivier CertnerThe corresponding internal function is
54*0d6bf73cSOlivier Certner.Xr cr_canseeothergids 9 .
55*0d6bf73cSOlivier Certner.It Va security.bsd.see_jail_proc
56*0d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects that are not
57*0d6bf73cSOlivier Certnerassociated with the same jail as they are.
58*0d6bf73cSOlivier CertnerThe corresponding internal function is
59*0d6bf73cSOlivier Certner.Xr cr_canseejailproc 9 .
60*0d6bf73cSOlivier Certner.El
61*0d6bf73cSOlivier Certner.Pp
62*0d6bf73cSOlivier CertnerAs usual, the superuser (effective user ID 0) is exempt from any of these
63*0d6bf73cSOlivier Certnerpolicies provided that the
64*0d6bf73cSOlivier Certner.Xr sysctl 8
65*0d6bf73cSOlivier Certnervariable
66*0d6bf73cSOlivier Certner.Va security.bsd.suser_enabled
67*0d6bf73cSOlivier Certneris non-zero and no active MAC policy explicitly denies the exemption
68*0d6bf73cSOlivier Certner.Po
69*0d6bf73cSOlivier Certnersee
70*0d6bf73cSOlivier Certner.Xr priv_check_cred 9
71*0d6bf73cSOlivier Certner.Pc .
72*0d6bf73cSOlivier Certner.Pp
73*0d6bf73cSOlivier CertnerThis function is intended to be used as a helper to implement
74*0d6bf73cSOlivier Certner.Xr cr_cansee 9
75*0d6bf73cSOlivier Certnerand similar functions.
76*0d6bf73cSOlivier Certner.Sh RETURN VALUES
77*0d6bf73cSOlivier CertnerThis function returns zero if a subject with credentials
78*0d6bf73cSOlivier Certner.Fa u1
79*0d6bf73cSOlivier Certnermay see a subject or object with credentials
80*0d6bf73cSOlivier Certner.Fa u2
81*0d6bf73cSOlivier Certnerby the active above-mentioned policies, or
82*0d6bf73cSOlivier Certner.Er ESRCH
83*0d6bf73cSOlivier Certnerotherwise.
84*0d6bf73cSOlivier Certner.Sh ERRORS
85*0d6bf73cSOlivier Certner.Bl -tag -width Er
86*0d6bf73cSOlivier Certner.It Bq Er ESRCH
87*0d6bf73cSOlivier CertnerCredentials
88*0d6bf73cSOlivier Certner.Fa u1
89*0d6bf73cSOlivier Certnerand
90*0d6bf73cSOlivier Certner.Fa u2
91*0d6bf73cSOlivier Certnerdo not have the same real user ID.
92*0d6bf73cSOlivier Certner.It Bq Er ESRCH
93*0d6bf73cSOlivier CertnerCredentials
94*0d6bf73cSOlivier Certner.Fa u1
95*0d6bf73cSOlivier Certnerand
96*0d6bf73cSOlivier Certner.Fa u2
97*0d6bf73cSOlivier Certnerare not members of any common group
98*0d6bf73cSOlivier Certner.Po
99*0d6bf73cSOlivier Certneras determined by
100*0d6bf73cSOlivier Certner.Xr groupmember 9
101*0d6bf73cSOlivier Certner.Pc .
102*0d6bf73cSOlivier Certner.It Bq Er ESRCH
103*0d6bf73cSOlivier CertnerCredentials
104*0d6bf73cSOlivier Certner.Fa u1
105*0d6bf73cSOlivier Certnerand
106*0d6bf73cSOlivier Certner.Fa u2
107*0d6bf73cSOlivier Certnerare not in the same jail.
108*0d6bf73cSOlivier Certner.El
109*0d6bf73cSOlivier Certner.Sh SEE ALSO
110*0d6bf73cSOlivier Certner.Xr cr_canseeotheruids 9 ,
111*0d6bf73cSOlivier Certner.Xr cr_canseeothergids 9 ,
112*0d6bf73cSOlivier Certner.Xr cr_canseejailproc 9 ,
113*0d6bf73cSOlivier Certner.Xr priv_check_cred 9 ,
114*0d6bf73cSOlivier Certner.Xr cr_cansee 9
115*0d6bf73cSOlivier Certner.Sh AUTHORS
116*0d6bf73cSOlivier CertnerThis function and its manual page were written by
117*0d6bf73cSOlivier Certner.An Olivier Certner Aq Mt olce.freebsd@certner.fr .
118