10d6bf73cSOlivier Certner.\" 20d6bf73cSOlivier Certner.\" SPDX-License-Identifier: BSD-2-Clause 30d6bf73cSOlivier Certner.\" 40d6bf73cSOlivier Certner.\" Copyright (c) 2023 Olivier Certner <olce.freebsd@certner.fr> 50d6bf73cSOlivier Certner.\" 60d6bf73cSOlivier Certner.\" Redistribution and use in source and binary forms, with or without 70d6bf73cSOlivier Certner.\" modification, are permitted provided that the following conditions 80d6bf73cSOlivier Certner.\" are met: 90d6bf73cSOlivier Certner.\" 1. Redistributions of source code must retain the above copyright 100d6bf73cSOlivier Certner.\" notice, this list of conditions and the following disclaimer. 110d6bf73cSOlivier Certner.\" 2. Redistributions in binary form must reproduce the above copyright 120d6bf73cSOlivier Certner.\" notice, this list of conditions and the following disclaimer in the 130d6bf73cSOlivier Certner.\" documentation and/or other materials provided with the distribution. 140d6bf73cSOlivier Certner.\" 150d6bf73cSOlivier Certner.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 160d6bf73cSOlivier Certner.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 170d6bf73cSOlivier Certner.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 180d6bf73cSOlivier Certner.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 190d6bf73cSOlivier Certner.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 200d6bf73cSOlivier Certner.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 210d6bf73cSOlivier Certner.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 220d6bf73cSOlivier Certner.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 230d6bf73cSOlivier Certner.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 240d6bf73cSOlivier Certner.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 250d6bf73cSOlivier Certner.\" 260d6bf73cSOlivier Certner.Dd August 18, 2023 270d6bf73cSOlivier Certner.Dt CR_BSD_VISIBLE 9 280d6bf73cSOlivier Certner.Os 290d6bf73cSOlivier Certner.Sh NAME 300d6bf73cSOlivier Certner.Nm cr_bsd_visible 310d6bf73cSOlivier Certner.Nd determine if subjects may see entities according to BSD security policies 320d6bf73cSOlivier Certner.Sh SYNOPSIS 330d6bf73cSOlivier Certner.In sys/proc.h 340d6bf73cSOlivier Certner.Ft int 350d6bf73cSOlivier Certner.Fn cr_bsd_visible "struct ucred *u1" "struct ucred *u2" 360d6bf73cSOlivier Certner.Sh DESCRIPTION 370d6bf73cSOlivier CertnerThis function determines if a subject with credentials 380d6bf73cSOlivier Certner.Fa u1 390d6bf73cSOlivier Certneris denied seeing an object or subject associated to credentials 400d6bf73cSOlivier Certner.Fa u2 410d6bf73cSOlivier Certnerby the following policies and associated 420d6bf73cSOlivier Certner.Xr sysctl 8 430d6bf73cSOlivier Certnerknobs: 440d6bf73cSOlivier Certner.Bl -tag -width indent 450d6bf73cSOlivier Certner.It Va security.bsd.seeotheruids 460d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects if they are not 470d6bf73cSOlivier Certnerassociated with the same real user ID. 480d6bf73cSOlivier CertnerThe corresponding internal function is 490d6bf73cSOlivier Certner.Xr cr_canseeotheruids 9 . 500d6bf73cSOlivier Certner.It Va security.bsd.seeothergids 510d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects if they are not both 520d6bf73cSOlivier Certnera member of at least one common group. 530d6bf73cSOlivier CertnerThe corresponding internal function is 540d6bf73cSOlivier Certner.Xr cr_canseeothergids 9 . 550d6bf73cSOlivier Certner.It Va security.bsd.see_jail_proc 560d6bf73cSOlivier CertnerIf set to 0, subjects cannot see other subjects or objects that are not 570d6bf73cSOlivier Certnerassociated with the same jail as they are. 580d6bf73cSOlivier CertnerThe corresponding internal function is 590d6bf73cSOlivier Certner.Xr cr_canseejailproc 9 . 600d6bf73cSOlivier Certner.El 610d6bf73cSOlivier Certner.Pp 620d6bf73cSOlivier CertnerAs usual, the superuser (effective user ID 0) is exempt from any of these 630d6bf73cSOlivier Certnerpolicies provided that the 640d6bf73cSOlivier Certner.Xr sysctl 8 650d6bf73cSOlivier Certnervariable 660d6bf73cSOlivier Certner.Va security.bsd.suser_enabled 670d6bf73cSOlivier Certneris non-zero and no active MAC policy explicitly denies the exemption 680d6bf73cSOlivier Certner.Po 690d6bf73cSOlivier Certnersee 700d6bf73cSOlivier Certner.Xr priv_check_cred 9 710d6bf73cSOlivier Certner.Pc . 720d6bf73cSOlivier Certner.Pp 730d6bf73cSOlivier CertnerThis function is intended to be used as a helper to implement 740d6bf73cSOlivier Certner.Xr cr_cansee 9 750d6bf73cSOlivier Certnerand similar functions. 760d6bf73cSOlivier Certner.Sh RETURN VALUES 770d6bf73cSOlivier CertnerThis function returns zero if a subject with credentials 780d6bf73cSOlivier Certner.Fa u1 790d6bf73cSOlivier Certnermay see a subject or object with credentials 800d6bf73cSOlivier Certner.Fa u2 810d6bf73cSOlivier Certnerby the active above-mentioned policies, or 820d6bf73cSOlivier Certner.Er ESRCH 830d6bf73cSOlivier Certnerotherwise. 840d6bf73cSOlivier Certner.Sh ERRORS 850d6bf73cSOlivier Certner.Bl -tag -width Er 860d6bf73cSOlivier Certner.It Bq Er ESRCH 870d6bf73cSOlivier CertnerCredentials 880d6bf73cSOlivier Certner.Fa u1 890d6bf73cSOlivier Certnerand 900d6bf73cSOlivier Certner.Fa u2 910d6bf73cSOlivier Certnerdo not have the same real user ID. 920d6bf73cSOlivier Certner.It Bq Er ESRCH 930d6bf73cSOlivier CertnerCredentials 940d6bf73cSOlivier Certner.Fa u1 950d6bf73cSOlivier Certnerand 960d6bf73cSOlivier Certner.Fa u2 970d6bf73cSOlivier Certnerare not members of any common group 980d6bf73cSOlivier Certner.Po 990d6bf73cSOlivier Certneras determined by 1000452dd84SOlivier Certner.Xr realgroupmember 9 1010d6bf73cSOlivier Certner.Pc . 1020d6bf73cSOlivier Certner.It Bq Er ESRCH 1030d6bf73cSOlivier CertnerCredentials 1040d6bf73cSOlivier Certner.Fa u1 1050d6bf73cSOlivier Certnerand 1060d6bf73cSOlivier Certner.Fa u2 1070d6bf73cSOlivier Certnerare not in the same jail. 1080d6bf73cSOlivier Certner.El 1090d6bf73cSOlivier Certner.Sh SEE ALSO 110*6e1fc011SGraham Percival.Xr cr_cansee 9 , 1110d6bf73cSOlivier Certner.Xr cr_canseejailproc 9 , 112*6e1fc011SGraham Percival.Xr cr_canseeothergids 9 , 113*6e1fc011SGraham Percival.Xr cr_canseeotheruids 9 , 114*6e1fc011SGraham Percival.Xr priv_check_cred 9 1150d6bf73cSOlivier Certner.Sh AUTHORS 1160d6bf73cSOlivier CertnerThis function and its manual page were written by 1170d6bf73cSOlivier Certner.An Olivier Certner Aq Mt olce.freebsd@certner.fr . 118