Debian Codegraph @

upstream/debian-unstable/man8/pam_selinux.8

raw
1 '\" t
2 .\" Title: pam_selinux
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
5 .\" Date: 06/29/2025
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "PAM_SELINUX" "8" "06/29/2025" "Linux\-PAM" "Linux\-PAM Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 pam_selinux \- PAM module to set the default security context
32 .SH "SYNOPSIS"
33 .HP \w'\fBpam_selinux\&.so\fR\ 'u
34 \fBpam_selinux\&.so\fR [open] [close] [restore] [nottys] [debug] [verbose] [select_context] [env_params] [use_current_range]
35 .SH "DESCRIPTION"
36 .PP
37 pam_selinux is a PAM module that sets up the default SELinux security context for the next executed process\&.
38 .PP
39 When a new session is started, the open_session part of the module computes and sets up the execution security context used for the next
40 \fBexecve\fR(2)
41 call, the file security context for the controlling terminal, and the security context used for creating a new kernel keyring\&.
42 .PP
43 When the session is ended, the close_session part of the module restores old security contexts that were in effect before the change made by the open_session part of the module\&.
44 .PP
45 Adding pam_selinux into the PAM stack might disrupt behavior of other PAM modules which execute applications\&. To avoid that,
46 \fIpam_selinux\&.so open\fR
47 should be placed after such modules in the PAM stack, and
48 \fIpam_selinux\&.so close\fR
49 should be placed before them\&. When such a placement is not feasible,
50 \fIpam_selinux\&.so restore\fR
51 could be used to temporary restore original security contexts\&.
52 .SH "OPTIONS"
53 .PP
54 open
55 .RS 4
56 Only execute the open_session part of the module\&.
57 .RE
58 .PP
59 close
60 .RS 4
61 Only execute the close_session part of the module\&.
62 .RE
63 .PP
64 restore
65 .RS 4
66 In open_session part of the module, temporarily restore the security contexts as they were before the previous call of the module\&. Another call of this module without the restore option will set up the new security contexts again\&.
67 .RE
68 .PP
69 nottys
70 .RS 4
71 Do not setup security context of the controlling terminal\&.
72 .RE
73 .PP
74 debug
75 .RS 4
76 Turn on debug messages via
77 \fBsyslog\fR(3)\&.
78 .RE
79 .PP
80 verbose
81 .RS 4
82 Attempt to inform the user when security context is set\&.
83 .RE
84 .PP
85 select_context
86 .RS 4
87 Attempt to ask the user for a custom security context role\&. If MLS is on, ask also for sensitivity level\&.
88 .RE
89 .PP
90 env_params
91 .RS 4
92 Attempt to obtain a custom security context role from PAM environment\&. If MLS is on, obtain also sensitivity level\&. This option and the select_context option are mutually exclusive\&. The respective PAM environment variables are
93 \fISELINUX_ROLE_REQUESTED\fR,
94 \fISELINUX_LEVEL_REQUESTED\fR, and
95 \fISELINUX_USE_CURRENT_RANGE\fR\&. The first two variables are self describing and the last one if set to 1 makes the PAM module behave as if the use_current_range was specified on the command line of the module\&.
96 .RE
97 .PP
98 use_current_range
99 .RS 4
100 Use the sensitivity level of the current process for the user context instead of the default level\&. Also suppresses asking of the sensitivity level from the user or obtaining it from PAM environment\&.
101 .RE
102 .SH "MODULE TYPES PROVIDED"
103 .PP
104 Only the
105 \fBsession\fR
106 module type is provided\&.
107 .SH "RETURN VALUES"
108 .PP
109 PAM_SUCCESS
110 .RS 4
111 The security context was set successfully\&.
112 .RE
113 .PP
114 PAM_SESSION_ERR
115 .RS 4
116 Unable to get or set a valid context\&.
117 .RE
118 .PP
119 PAM_USER_UNKNOWN
120 .RS 4
121 The user is not known to the system\&.
122 .RE
123 .PP
124 PAM_BUF_ERR
125 .RS 4
126 Memory allocation error\&.
127 .RE
128 .SH "EXAMPLES"
129 .sp
130 .if n \{\
131 .RS 4
132 .\}
133 .nf
134 auth required pam_unix\&.so
135 session required pam_permit\&.so
136 session optional pam_selinux\&.so
137
138 .fi
139 .if n \{\
140 .RE
141 .\}
142 .SH "SEE ALSO"
143 .PP
144 \fBexecve\fR(2),
145 \fBtty\fR(4),
146 \fBpam.d\fR(5),
147 \fBpam\fR(7),
148 \fBselinux\fR(8)
149 .SH "AUTHOR"
150 .PP
151 pam_selinux was written by Dan Walsh <dwalsh@redhat\&.com>\&.