namespace.conf.5.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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="namespace.conf">
  5. <refmeta>
  6. <refentrytitle>namespace.conf</refentrytitle>
  7. <manvolnum>5</manvolnum>
  8. <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv>
  11. <refname>namespace.conf</refname>
  12. <refpurpose>the namespace configuration file</refpurpose>
  13. </refnamediv>
  14. <refsect1 id='namespace.conf-description'>
  15. <title>DESCRIPTION</title>
  16. <para>
  17. The <emphasis>pam_namespace.so</emphasis> module allows setup of
  18. private namespaces with polyinstantiated directories.
  19. Directories can be polyinstantiated based on user name
  20. or, in the case of SELinux, user name, sensitivity level or complete security context. If an
  21. executable script <filename>/etc/security/namespace.init</filename>
  22. exists, it is used to initialize the namespace every time an instance
  23. directory is set up and mounted. The script receives the polyinstantiated
  24. directory path and the instance directory path as its arguments.
  25. </para>
  26. <para>
  27. The <filename>/etc/security/namespace.conf</filename> file specifies
  28. which directories are polyinstantiated, how they are polyinstantiated,
  29. how instance directories would be named, and any users for whom
  30. polyinstantiation would not be performed.
  31. </para>
  32. <para>
  33. When someone logs in, the file <filename>namespace.conf</filename> is
  34. scanned. Comments are marked by <emphasis>#</emphasis> characters.
  35. Each non comment line represents one polyinstantiated
  36. directory. The fields are separated by spaces but can be quoted by
  37. <emphasis>"</emphasis> characters also escape
  38. sequences <emphasis>\b</emphasis>, <emphasis>\n</emphasis>, and
  39. <emphasis>\t</emphasis> are recognized. The fields are as follows:
  40. </para>
  41. <para><replaceable>polydir</replaceable> <replaceable>instance_prefix</replaceable> <replaceable>method</replaceable> <replaceable>list_of_uids</replaceable>
  42. </para>
  43. <para>
  44. The first field, <replaceable>polydir</replaceable>, is the absolute
  45. pathname of the directory to polyinstantiate. The special string
  46. <emphasis>$HOME</emphasis> is replaced with the user's home directory,
  47. and <emphasis>$USER</emphasis> with the username. This field cannot
  48. be blank.
  49. </para>
  50. <para>
  51. The second field, <replaceable>instance_prefix</replaceable> is
  52. the string prefix used to build the pathname for the instantiation
  53. of &lt;polydir&gt;. Depending on the polyinstantiation
  54. <replaceable>method</replaceable> it is then appended with
  55. "instance differentiation string" to generate the final
  56. instance directory path. This directory is created if it did not exist
  57. already, and is then bind mounted on the &lt;polydir&gt; to provide an
  58. instance of &lt;polydir&gt; based on the &lt;method&gt; column.
  59. The special string <emphasis>$HOME</emphasis> is replaced with the
  60. user's home directory, and <emphasis>$USER</emphasis> with the username.
  61. This field cannot be blank.
  62. </para>
  63. <para>
  64. The third field, <replaceable>method</replaceable>, is the method
  65. used for polyinstantiation. It can take these values; "user"
  66. for polyinstantiation based on user name, "level" for
  67. polyinstantiation based on process MLS level and user name, "context" for
  68. polyinstantiation based on process security context and user name,
  69. "tmpfs" for mounting tmpfs filesystem as an instance dir, and
  70. "tmpdir" for creating temporary directory as an instance dir which is
  71. removed when the user's session is closed.
  72. Methods "context" and "level" are only available with SELinux. This
  73. field cannot be blank.
  74. </para>
  75. <para>
  76. The fourth field, <replaceable>list_of_uids</replaceable>, is
  77. a comma separated list of user names for whom the polyinstantiation
  78. is not performed. If left blank, polyinstantiation will be performed
  79. for all users. If the list is preceded with a single "~" character,
  80. polyinstantiation is performed only for users in the list.
  81. </para>
  82. <para>
  83. The <replaceable>method</replaceable> field can contain also following
  84. optional flags separated by <emphasis>:</emphasis> characters.
  85. </para>
  86. <para><emphasis>create</emphasis>=<replaceable>mode</replaceable>,<replaceable>owner</replaceable>,<replaceable>group</replaceable>
  87. - create the polyinstantiated directory. The mode, owner and group parameters
  88. are optional. The default for mode is determined by umask, the default
  89. owner is the user whose session is opened, the default group is the
  90. primary group of the user.
  91. </para>
  92. <para><emphasis>iscript</emphasis>=<replaceable>path</replaceable>
  93. - path to the instance directory init script. The base directory for relative
  94. paths is <filename>/etc/security/namespace.d</filename>.
  95. </para>
  96. <para><emphasis>noinit</emphasis>
  97. - instance directory init script will not be executed.
  98. </para>
  99. <para><emphasis>shared</emphasis>
  100. - the instance directories for "context" and "level" methods will not
  101. contain the user name and will be shared among all users.
  102. </para>
  103. <para><emphasis>mntopts</emphasis>=<replaceable>value</replaceable>
  104. - value of this flag is passed to the mount call when the tmpfs mount is
  105. done. It allows for example the specification of the maximum size of the
  106. tmpfs instance that is created by the mount call. In addition to
  107. options specified in the <citerefentry>
  108. <refentrytitle>tmpfs</refentrytitle><manvolnum>5</manvolnum>
  109. </citerefentry> manual the <emphasis>nosuid</emphasis>,
  110. <emphasis>noexec</emphasis>, and <emphasis>nodev</emphasis> flags
  111. can be used to respectively disable setuid bit effect, disable running
  112. executables, and disable devices to be interpreted on the mounted
  113. tmpfs filesystem.
  114. </para>
  115. <para>
  116. The directory where polyinstantiated instances are to be
  117. created, must exist and must have, by default, the mode of 0000. The
  118. requirement that the instance parent be of mode 0000 can be overridden
  119. with the command line option <emphasis>ignore_instance_parent_mode</emphasis>
  120. </para>
  121. <para>
  122. In case of context or level polyinstantiation the SELinux context
  123. which is used for polyinstantiation is the context used for executing
  124. a new process as obtained by getexeccon. This context must be set
  125. by the calling application or <filename>pam_selinux.so</filename>
  126. module. If this context is not set the polyinstatiation will be
  127. based just on user name.
  128. </para>
  129. <para>
  130. The "instance differentiation string" is &lt;user name&gt; for "user"
  131. method and &lt;user name&gt;_&lt;raw directory context&gt; for "context"
  132. and "level" methods. If the whole string is too long the end of it is
  133. replaced with md5sum of itself. Also when command line option
  134. <emphasis>gen_hash</emphasis> is used the whole string is replaced
  135. with md5sum of itself.
  136. </para>
  137. </refsect1>
  138. <refsect1 id="namespace.conf-examples">
  139. <title>EXAMPLES</title>
  140. <para>
  141. These are some example lines which might be specified in
  142. <filename>/etc/security/namespace.conf</filename>.
  143. </para>
  144. <literallayout>
  145. # The following three lines will polyinstantiate /tmp,
  146. # /var/tmp and user's home directories. /tmp and /var/tmp
  147. # will be polyinstantiated based on the security level
  148. # as well as user name, whereas home directory will be
  149. # polyinstantiated based on the full security context and user name.
  150. # Polyinstantiation will not be performed for user root
  151. # and adm for directories /tmp and /var/tmp, whereas home
  152. # directories will be polyinstantiated for all users.
  153. #
  154. # Note that instance directories do not have to reside inside
  155. # the polyinstantiated directory. In the examples below,
  156. # instances of /tmp will be created in /tmp-inst directory,
  157. # where as instances of /var/tmp and users home directories
  158. # will reside within the directories that are being
  159. # polyinstantiated.
  160. #
  161. /tmp /tmp-inst/ level root,adm
  162. /var/tmp /var/tmp/tmp-inst/ level root,adm
  163. $HOME $HOME/$USER.inst/inst- context
  164. </literallayout>
  165. <para>
  166. For the &lt;service&gt;s you need polyinstantiation (login for example)
  167. put the following line in /etc/pam.d/&lt;service&gt; as the last line for
  168. session group:
  169. </para>
  170. <para>
  171. session required pam_namespace.so [arguments]
  172. </para>
  173. <para>
  174. This module also depends on pam_selinux.so setting the context.
  175. </para>
  176. </refsect1>
  177. <refsect1 id="namespace.conf-see_also">
  178. <title>SEE ALSO</title>
  179. <para>
  180. <citerefentry><refentrytitle>pam_namespace</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  181. <citerefentry><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
  182. <citerefentry><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry>
  183. </para>
  184. </refsect1>
  185. <refsect1 id="namespace.conf-author">
  186. <title>AUTHORS</title>
  187. <para>
  188. The namespace.conf manual page was written by Janak Desai &lt;janak@us.ibm.com&gt;.
  189. More features added by Tomas Mraz &lt;tmraz@redhat.com&gt;.
  190. </para>
  191. </refsect1>
  192. </refentry>