| 1 |
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="pam_selinux"> |
| 2 |
|
| 3 |
<refmeta> |
| 4 |
<refentrytitle>pam_selinux</refentrytitle> |
| 5 |
<manvolnum>8</manvolnum> |
| 6 |
<refmiscinfo class="source">Linux-PAM</refmiscinfo> |
| 7 |
<refmiscinfo class="manual">Linux-PAM Manual</refmiscinfo> |
| 8 |
</refmeta> |
| 9 |
|
| 10 |
<refnamediv xml:id="pam_selinux-name"> |
| 11 |
<refname>pam_selinux</refname> |
| 12 |
<refpurpose>PAM module to set the default security context</refpurpose> |
| 13 |
</refnamediv> |
| 14 |
|
| 15 |
<refsynopsisdiv> |
| 16 |
<cmdsynopsis xml:id="pam_selinux-cmdsynopsis" sepchar=" "> |
| 17 |
<command>pam_selinux.so</command> |
| 18 |
<arg choice="opt" rep="norepeat"> |
| 19 |
open |
| 20 |
</arg> |
| 21 |
<arg choice="opt" rep="norepeat"> |
| 22 |
close |
| 23 |
</arg> |
| 24 |
<arg choice="opt" rep="norepeat"> |
| 25 |
restore |
| 26 |
</arg> |
| 27 |
<arg choice="opt" rep="norepeat"> |
| 28 |
nottys |
| 29 |
</arg> |
| 30 |
<arg choice="opt" rep="norepeat"> |
| 31 |
debug |
| 32 |
</arg> |
| 33 |
<arg choice="opt" rep="norepeat"> |
| 34 |
verbose |
| 35 |
</arg> |
| 36 |
<arg choice="opt" rep="norepeat"> |
| 37 |
select_context |
| 38 |
</arg> |
| 39 |
<arg choice="opt" rep="norepeat"> |
| 40 |
env_params |
| 41 |
</arg> |
| 42 |
<arg choice="opt" rep="norepeat"> |
| 43 |
use_current_range |
| 44 |
</arg> |
| 45 |
</cmdsynopsis> |
| 46 |
</refsynopsisdiv> |
| 47 |
|
| 48 |
<refsect1 xml:id="pam_selinux-description"> |
| 49 |
<title>DESCRIPTION</title> |
| 50 |
<para> |
| 51 |
pam_selinux is a PAM module that sets up the default SELinux security |
| 52 |
context for the next executed process. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
When a new session is started, the open_session part of the module |
| 56 |
computes and sets up the execution security context used for the next |
| 57 |
<citerefentry> |
| 58 |
<refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum> |
| 59 |
</citerefentry> |
| 60 |
call, the file security context for the controlling terminal, and |
| 61 |
the security context used for creating a new kernel keyring. |
| 62 |
</para> |
| 63 |
<para> |
| 64 |
When the session is ended, the close_session part of the module restores |
| 65 |
old security contexts that were in effect before the change made |
| 66 |
by the open_session part of the module. |
| 67 |
</para> |
| 68 |
<para> |
| 69 |
Adding pam_selinux into the PAM stack might disrupt behavior of other |
| 70 |
PAM modules which execute applications. To avoid that, |
| 71 |
<emphasis>pam_selinux.so open</emphasis> should be placed after such |
| 72 |
modules in the PAM stack, and <emphasis>pam_selinux.so close</emphasis> |
| 73 |
should be placed before them. When such a placement is not feasible, |
| 74 |
<emphasis>pam_selinux.so restore</emphasis> could be used to temporary |
| 75 |
restore original security contexts. |
| 76 |
</para> |
| 77 |
</refsect1> |
| 78 |
|
| 79 |
<refsect1 xml:id="pam_selinux-options"> |
| 80 |
<title>OPTIONS</title> |
| 81 |
<variablelist> |
| 82 |
<varlistentry> |
| 83 |
<term> |
| 84 |
open |
| 85 |
</term> |
| 86 |
<listitem> |
| 87 |
<para> |
| 88 |
Only execute the open_session part of the module. |
| 89 |
</para> |
| 90 |
</listitem> |
| 91 |
</varlistentry> |
| 92 |
<varlistentry> |
| 93 |
<term> |
| 94 |
close |
| 95 |
</term> |
| 96 |
<listitem> |
| 97 |
<para> |
| 98 |
Only execute the close_session part of the module. |
| 99 |
</para> |
| 100 |
</listitem> |
| 101 |
</varlistentry> |
| 102 |
<varlistentry> |
| 103 |
<term> |
| 104 |
restore |
| 105 |
</term> |
| 106 |
<listitem> |
| 107 |
<para> |
| 108 |
In open_session part of the module, temporarily restore the |
| 109 |
security contexts as they were before the previous call of |
| 110 |
the module. Another call of this module without the restore |
| 111 |
option will set up the new security contexts again. |
| 112 |
</para> |
| 113 |
</listitem> |
| 114 |
</varlistentry> |
| 115 |
<varlistentry> |
| 116 |
<term> |
| 117 |
nottys |
| 118 |
</term> |
| 119 |
<listitem> |
| 120 |
<para> |
| 121 |
Do not setup security context of the controlling terminal. |
| 122 |
</para> |
| 123 |
</listitem> |
| 124 |
</varlistentry> |
| 125 |
<varlistentry> |
| 126 |
<term> |
| 127 |
debug |
| 128 |
</term> |
| 129 |
<listitem> |
| 130 |
<para> |
| 131 |
Turn on debug messages via |
| 132 |
<citerefentry> |
| 133 |
<refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum> |
| 134 |
</citerefentry>. |
| 135 |
</para> |
| 136 |
</listitem> |
| 137 |
</varlistentry> |
| 138 |
<varlistentry> |
| 139 |
<term> |
| 140 |
verbose |
| 141 |
</term> |
| 142 |
<listitem> |
| 143 |
<para> |
| 144 |
Attempt to inform the user when security context is set. |
| 145 |
</para> |
| 146 |
</listitem> |
| 147 |
</varlistentry> |
| 148 |
<varlistentry> |
| 149 |
<term> |
| 150 |
select_context |
| 151 |
</term> |
| 152 |
<listitem> |
| 153 |
<para> |
| 154 |
Attempt to ask the user for a custom security context role. |
| 155 |
If MLS is on, ask also for sensitivity level. |
| 156 |
</para> |
| 157 |
</listitem> |
| 158 |
</varlistentry> |
| 159 |
<varlistentry> |
| 160 |
<term> |
| 161 |
env_params |
| 162 |
</term> |
| 163 |
<listitem> |
| 164 |
<para> |
| 165 |
Attempt to obtain a custom security context role from PAM environment. |
| 166 |
If MLS is on, obtain also sensitivity level. This option and the |
| 167 |
select_context option are mutually exclusive. The respective PAM |
| 168 |
environment variables are <emphasis>SELINUX_ROLE_REQUESTED</emphasis>, |
| 169 |
<emphasis>SELINUX_LEVEL_REQUESTED</emphasis>, and |
| 170 |
<emphasis>SELINUX_USE_CURRENT_RANGE</emphasis>. The first two variables |
| 171 |
are self describing and the last one if set to 1 makes the PAM module behave as |
| 172 |
if the use_current_range was specified on the command line of the module. |
| 173 |
</para> |
| 174 |
</listitem> |
| 175 |
</varlistentry> |
| 176 |
<varlistentry> |
| 177 |
<term> |
| 178 |
use_current_range |
| 179 |
</term> |
| 180 |
<listitem> |
| 181 |
<para> |
| 182 |
Use the sensitivity level of the current process for the user context |
| 183 |
instead of the default level. Also suppresses asking of the |
| 184 |
sensitivity level from the user or obtaining it from PAM environment. |
| 185 |
</para> |
| 186 |
</listitem> |
| 187 |
</varlistentry> |
| 188 |
</variablelist> |
| 189 |
</refsect1> |
| 190 |
|
| 191 |
<refsect1 xml:id="pam_selinux-types"> |
| 192 |
<title>MODULE TYPES PROVIDED</title> |
| 193 |
<para> |
| 194 |
Only the <option>session</option> module type is provided. |
| 195 |
</para> |
| 196 |
</refsect1> |
| 197 |
|
| 198 |
<refsect1 xml:id="pam_selinux-return_values"> |
| 199 |
<title>RETURN VALUES</title> |
| 200 |
<variablelist> |
| 201 |
<varlistentry> |
| 202 |
<term>PAM_SUCCESS</term> |
| 203 |
<listitem> |
| 204 |
<para> |
| 205 |
The security context was set successfully. |
| 206 |
</para> |
| 207 |
</listitem> |
| 208 |
</varlistentry> |
| 209 |
<varlistentry> |
| 210 |
<term>PAM_SESSION_ERR</term> |
| 211 |
<listitem> |
| 212 |
<para> |
| 213 |
Unable to get or set a valid context. |
| 214 |
</para> |
| 215 |
</listitem> |
| 216 |
</varlistentry> |
| 217 |
<varlistentry> |
| 218 |
<term>PAM_USER_UNKNOWN</term> |
| 219 |
<listitem> |
| 220 |
<para> |
| 221 |
The user is not known to the system. |
| 222 |
</para> |
| 223 |
</listitem> |
| 224 |
</varlistentry> |
| 225 |
<varlistentry> |
| 226 |
<term>PAM_BUF_ERR</term> |
| 227 |
<listitem> |
| 228 |
<para> |
| 229 |
Memory allocation error. |
| 230 |
</para> |
| 231 |
</listitem> |
| 232 |
</varlistentry> |
| 233 |
</variablelist> |
| 234 |
</refsect1> |
| 235 |
|
| 236 |
<refsect1 xml:id="pam_selinux-examples"> |
| 237 |
<title>EXAMPLES</title> |
| 238 |
<programlisting> |
| 239 |
auth required pam_unix.so |
| 240 |
session required pam_permit.so |
| 241 |
session optional pam_selinux.so |
| 242 |
</programlisting> |
| 243 |
</refsect1> |
| 244 |
|
| 245 |
<refsect1 xml:id="pam_selinux-see_also"> |
| 246 |
<title>SEE ALSO</title> |
| 247 |
<para> |
| 248 |
<citerefentry> |
| 249 |
<refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum> |
| 250 |
</citerefentry>, |
| 251 |
<citerefentry> |
| 252 |
<refentrytitle>tty</refentrytitle><manvolnum>4</manvolnum> |
| 253 |
</citerefentry>, |
| 254 |
<citerefentry> |
| 255 |
<refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum> |
| 256 |
</citerefentry>, |
| 257 |
<citerefentry> |
| 258 |
<refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum> |
| 259 |
</citerefentry>, |
| 260 |
<citerefentry> |
| 261 |
<refentrytitle>selinux</refentrytitle><manvolnum>8</manvolnum> |
| 262 |
</citerefentry> |
| 263 |
</para> |
| 264 |
</refsect1> |
| 265 |
|
| 266 |
<refsect1 xml:id="pam_selinux-author"> |
| 267 |
<title>AUTHOR</title> |
| 268 |
<para> |
| 269 |
pam_selinux was written by Dan Walsh <[email protected]>. |
| 270 |
</para> |
| 271 |
</refsect1> |
| 272 |
|
| 273 |
</refentry> |