pam_namespace.8.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
  4. <refentry id='pam_namespace'>
  5. <refmeta>
  6. <refentrytitle>pam_namespace</refentrytitle>
  7. <manvolnum>8</manvolnum>
  8. <refmiscinfo class='setdesc'>Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv id='pam_namespace-name'>
  11. <refname>pam_namespace</refname>
  12. <refpurpose>
  13. PAM module for configuring namespace for a session
  14. </refpurpose>
  15. </refnamediv>
  16. <!-- body begins here -->
  17. <refsynopsisdiv>
  18. <cmdsynopsis id="pam_namespace-cmdsynopsis">
  19. <command>pam_namespace.so</command>
  20. <arg choice="opt">
  21. debug
  22. </arg>
  23. <arg choice="opt">
  24. unmnt_remnt
  25. </arg>
  26. <arg choice="opt">
  27. unmnt_only
  28. </arg>
  29. <arg choice="opt">
  30. require_selinux
  31. </arg>
  32. <arg choice="opt">
  33. gen_hash
  34. </arg>
  35. <arg choice="opt">
  36. ignore_config_error
  37. </arg>
  38. <arg choice="opt">
  39. ignore_instance_parent_mode
  40. </arg>
  41. <arg choice="opt">
  42. unmount_on_close
  43. </arg>
  44. <arg choice="opt">
  45. use_current_context
  46. </arg>
  47. <arg choice="opt">
  48. use_default_context
  49. </arg>
  50. <arg choice="opt">
  51. mount_private
  52. </arg>
  53. </cmdsynopsis>
  54. </refsynopsisdiv>
  55. <refsect1 id="pam_namespace-description">
  56. <title>DESCRIPTION</title>
  57. <para>
  58. The pam_namespace PAM module sets up a private namespace for a session
  59. with polyinstantiated directories. A polyinstantiated directory
  60. provides a different instance of itself based on user name, or when
  61. using SELinux, user name, security context or both. If an executable
  62. script <filename>/etc/security/namespace.init</filename> exists, it
  63. is used to initialize the instance directory after it is set up
  64. and mounted on the polyinstantiated directory. The script receives the
  65. polyinstantiated directory path, the instance directory path, flag
  66. whether the instance directory was newly created (0 for no, 1 for yes),
  67. and the user name as its arguments.
  68. </para>
  69. <para>
  70. The pam_namespace module disassociates the session namespace from
  71. the parent namespace. Any mounts/unmounts performed in the parent
  72. namespace, such as mounting of devices, are not reflected in the
  73. session namespace. To propagate selected mount/unmount events from
  74. the parent namespace into the disassociated session namespace, an
  75. administrator may use the special shared-subtree feature. For
  76. additional information on shared-subtree feature, please refer to
  77. the mount(8) man page and the shared-subtree description at
  78. http://lwn.net/Articles/159077 and http://lwn.net/Articles/159092.
  79. </para>
  80. </refsect1>
  81. <refsect1 id="pam_namespace-options">
  82. <title>OPTIONS</title>
  83. <variablelist>
  84. <varlistentry>
  85. <term>
  86. <option>debug</option>
  87. </term>
  88. <listitem>
  89. <para>
  90. A lot of debug information is logged using syslog
  91. </para>
  92. </listitem>
  93. </varlistentry>
  94. <varlistentry>
  95. <term>
  96. <option>unmnt_remnt</option>
  97. </term>
  98. <listitem>
  99. <para>
  100. For programs such as su and newrole, the login
  101. session has already setup a polyinstantiated
  102. namespace. For these programs, polyinstantiation
  103. is performed based on new user id or security
  104. context, however the command first needs to
  105. undo the polyinstantiation performed by login.
  106. This argument instructs the command to
  107. first undo previous polyinstantiation before
  108. proceeding with new polyinstantiation based on
  109. new id/context
  110. </para>
  111. </listitem>
  112. </varlistentry>
  113. <varlistentry>
  114. <term>
  115. <option>unmnt_only</option>
  116. </term>
  117. <listitem>
  118. <para>
  119. For trusted programs that want to undo any
  120. existing bind mounts and process instance
  121. directories on their own, this argument allows
  122. them to unmount currently mounted instance
  123. directories
  124. </para>
  125. </listitem>
  126. </varlistentry>
  127. <varlistentry>
  128. <term>
  129. <option>require_selinux</option>
  130. </term>
  131. <listitem>
  132. <para>
  133. If selinux is not enabled, return failure
  134. </para>
  135. </listitem>
  136. </varlistentry>
  137. <varlistentry>
  138. <term>
  139. <option>gen_hash</option>
  140. </term>
  141. <listitem>
  142. <para>
  143. Instead of using the security context string
  144. for the instance name, generate and use its
  145. md5 hash.
  146. </para>
  147. </listitem>
  148. </varlistentry>
  149. <varlistentry>
  150. <term>
  151. <option>ignore_config_error</option>
  152. </term>
  153. <listitem>
  154. <para>
  155. If a line in the configuration file corresponding
  156. to a polyinstantiated directory contains format
  157. error, skip that line process the next line.
  158. Without this option, pam will return an error
  159. to the calling program resulting in termination
  160. of the session.
  161. </para>
  162. </listitem>
  163. </varlistentry>
  164. <varlistentry>
  165. <term>
  166. <option>ignore_instance_parent_mode</option>
  167. </term>
  168. <listitem>
  169. <para>
  170. Instance parent directories by default are expected to have
  171. the restrictive mode of 000. Using this option, an administrator
  172. can choose to ignore the mode of the instance parent. This option
  173. should be used with caution as it will reduce security and
  174. isolation goals of the polyinstantiation mechanism.
  175. </para>
  176. </listitem>
  177. </varlistentry>
  178. <varlistentry>
  179. <term>
  180. <option>unmount_on_close</option>
  181. </term>
  182. <listitem>
  183. <para>
  184. Explicitly unmount the polyinstantiated directories instead
  185. of relying on automatic namespace destruction after the last
  186. process in a namespace exits. This option should be used
  187. only in case it is ensured by other means that there cannot be
  188. any processes running in the private namespace left after the
  189. session close. It is also useful only in case there are
  190. multiple pam session calls in sequence from the same process.
  191. </para>
  192. </listitem>
  193. </varlistentry>
  194. <varlistentry>
  195. <term>
  196. <option>use_current_context</option>
  197. </term>
  198. <listitem>
  199. <para>
  200. Useful for services which do not change the SELinux context
  201. with setexeccon call. The module will use the current SELinux
  202. context of the calling process for the level and context
  203. polyinstantiation.
  204. </para>
  205. </listitem>
  206. </varlistentry>
  207. <varlistentry>
  208. <term>
  209. <option>use_default_context</option>
  210. </term>
  211. <listitem>
  212. <para>
  213. Useful for services which do not use pam_selinux for changing
  214. the SELinux context with setexeccon call. The module will use
  215. the default SELinux context of the user for the level and context
  216. polyinstantiation.
  217. </para>
  218. </listitem>
  219. </varlistentry>
  220. <varlistentry>
  221. <term>
  222. <option>mount_private</option>
  223. </term>
  224. <listitem>
  225. <para>
  226. This option can be used on systems where the / mount point or
  227. its submounts are made shared (for example with a
  228. <command>mount --make-rshared /</command> command).
  229. The module will mark the whole directory tree so any mount and
  230. unmount operations in the polyinstantiation namespace are private.
  231. Normally the pam_namespace will try to detect the
  232. shared / mount point and make the polyinstantiated directories
  233. private automatically. This option has to be used just when
  234. only a subtree is shared and / is not.
  235. </para>
  236. <para>
  237. Note that mounts and unmounts done in the private namespace will not
  238. affect the parent namespace if this option is used or when the
  239. shared / mount point is autodetected.
  240. </para>
  241. </listitem>
  242. </varlistentry>
  243. </variablelist>
  244. </refsect1>
  245. <refsect1 id="pam_namespace-types">
  246. <title>MODULE TYPES PROVIDED</title>
  247. <para>
  248. Only the <option>session</option> module type is provided.
  249. The module must not be called from multithreaded processes.
  250. </para>
  251. </refsect1>
  252. <refsect1 id="pam_namespace-return_values">
  253. <title>RETURN VALUES</title>
  254. <variablelist>
  255. <varlistentry>
  256. <term>PAM_SUCCESS</term>
  257. <listitem>
  258. <para>
  259. Namespace setup was successful.
  260. </para>
  261. </listitem>
  262. </varlistentry>
  263. <varlistentry>
  264. <term>PAM_SERVICE_ERR</term>
  265. <listitem>
  266. <para>
  267. Unexpected system error occurred while setting up namespace.
  268. </para>
  269. </listitem>
  270. </varlistentry>
  271. <varlistentry>
  272. <term>PAM_SESSION_ERR</term>
  273. <listitem>
  274. <para>
  275. Unexpected namespace configuration error occurred.
  276. </para>
  277. </listitem>
  278. </varlistentry>
  279. </variablelist>
  280. </refsect1>
  281. <refsect1 id="pam_namespace-files">
  282. <title>FILES</title>
  283. <variablelist>
  284. <varlistentry>
  285. <term><filename>/etc/security/namespace.conf</filename></term>
  286. <listitem>
  287. <para>Main configuration file</para>
  288. </listitem>
  289. </varlistentry>
  290. <varlistentry>
  291. <term><filename>/etc/security/namespace.d</filename></term>
  292. <listitem>
  293. <para>Directory for additional configuration files</para>
  294. </listitem>
  295. </varlistentry>
  296. <varlistentry>
  297. <term><filename>/etc/security/namespace.init</filename></term>
  298. <listitem>
  299. <para>Init script for instance directories</para>
  300. </listitem>
  301. </varlistentry>
  302. </variablelist>
  303. </refsect1>
  304. <refsect1 id="pam_namespace-examples">
  305. <title>EXAMPLES</title>
  306. <para>
  307. For the &lt;service&gt;s you need polyinstantiation (login for example)
  308. put the following line in /etc/pam.d/&lt;service&gt; as the last line for
  309. session group:
  310. </para>
  311. <para>
  312. session required pam_namespace.so [arguments]
  313. </para>
  314. <para>
  315. To use polyinstantiation with graphical display manager gdm, please refer
  316. to gdm's documentation.
  317. </para>
  318. </refsect1>
  319. <refsect1 id="pam_namespace-see_also">
  320. <title>SEE ALSO</title>
  321. <para>
  322. <citerefentry>
  323. <refentrytitle>namespace.conf</refentrytitle><manvolnum>5</manvolnum>
  324. </citerefentry>,
  325. <citerefentry>
  326. <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
  327. </citerefentry>,
  328. <citerefentry>
  329. <refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum>
  330. </citerefentry>,
  331. <citerefentry>
  332. <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
  333. </citerefentry>.
  334. </para>
  335. </refsect1>
  336. <refsect1 id="pam_namespace-authors">
  337. <title>AUTHORS</title>
  338. <para>
  339. The namespace setup scheme was designed by Stephen Smalley, Janak Desai
  340. and Chad Sellers.
  341. The pam_namespace PAM module was developed by Janak Desai &lt;janak@us.ibm.com&gt;,
  342. Chad Sellers &lt;csellers@tresys.com&gt; and Steve Grubb &lt;sgrubb@redhat.com&gt;.
  343. Additional improvements by Xavier Toth &lt;txtoth@gmail.com&gt; and Tomas Mraz
  344. &lt;tmraz@redhat.com&gt;.
  345. </para>
  346. </refsect1>
  347. </refentry>