pam_selinux.8.xml 8.0 KB

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