Debian Codegraph @

upstream/opensuse-tumbleweed/man5/namespace.conf.5

raw
1 '\" t
2 .\" Title: namespace.conf
3 .\" Author: [see the "AUTHORS" section]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
5 .\" Date: 05/26/2026
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "NAMESPACE\&.CONF" "5" "05/26/2026" "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 namespace.conf \- the namespace configuration file
32 .SH "DESCRIPTION"
33 .PP
34 The
35 \fIpam_namespace\&.so\fR
36 module allows setup of private namespaces with polyinstantiated directories\&. Directories can be polyinstantiated based on user name or, in the case of SELinux, user name, sensitivity level or complete security context\&. If an executable script
37 /etc/security/namespace\&.init
38 exists, it is used to initialize the namespace every time an instance directory is set up and mounted\&. The script receives the polyinstantiated directory path and the instance directory path as its arguments\&. The script is invoked with full root privileges and accessing the instance directory in this context needs to be done with caution, as it is controlled by the unprivileged user for which it has been created\&.
39 .PP
40 The
41 /etc/security/namespace\&.conf
42 file ( or
43 /usr/etc/security/namespace\&.conf
44 if it does not exist) specifies which directories are polyinstantiated, how they are polyinstantiated, how instance directories would be named, and any users for whom polyinstantiation would not be performed\&. Then individual
45 *\&.conf
46 files from the
47 /etc/security/namespace\&.d/
48 and
49 /usr/etc/security/namespace\&.d
50 directories are taken too\&. If
51 /etc/security/namespace\&.d/@filename@\&.conf
52 exists, then
53 /usr/etc/security/namespace\&.d/@filename@\&.conf
54 will not be used\&. All
55 namespace\&.d/*\&.conf
56 files are sorted by their
57 @filename@\&.conf
58 in lexicographic order regardless of which of the directories they reside in\&.
59 .PP
60 When someone logs in, the file
61 namespace\&.conf
62 is scanned\&. Comments are marked by
63 \fI#\fR
64 characters\&. Each non comment line represents one polyinstantiated directory\&. The fields are separated by spaces but can be quoted by
65 \fI"\fR
66 characters also escape sequences
67 \fI\eb\fR,
68 \fI\en\fR, and
69 \fI\et\fR
70 are recognized\&. The fields are as follows:
71 .PP
72 \fIpolydir\fR
73 \fIinstance_prefix\fR
74 \fImethod\fR
75 \fIlist_of_uids\fR
76 .PP
77 The first field,
78 \fIpolydir\fR, is the absolute pathname of the directory to polyinstantiate\&. The special string
79 \fI$HOME\fR
80 is replaced with the user\*(Aqs home directory, and
81 \fI$USER\fR
82 with the username\&. This field cannot be blank\&.
83 .PP
84 The second field,
85 \fIinstance_prefix\fR
86 is the string prefix used to build the pathname for the instantiation of <polydir>\&. The path must end in a trailing slash, or in a directory prefix used to build the full per\-instance path\&. Depending on the polyinstantiation
87 \fImethod\fR
88 it is then appended with "instance differentiation string" to generate the final instance directory path\&. This directory is created if it did not exist already, and is then bind mounted on the <polydir> to provide an instance of <polydir> based on the <method> column\&. The special string
89 \fI$HOME\fR
90 is replaced with the user\*(Aqs home directory, and
91 \fI$USER\fR
92 with the username\&. This field cannot be blank\&.
93 .PP
94 The third field,
95 \fImethod\fR, is the method used for polyinstantiation\&. It can take these values; "user" for polyinstantiation based on user name, "level" for polyinstantiation based on process MLS level and user name, "context" for polyinstantiation based on process security context and user name, "tmpfs" for mounting tmpfs filesystem as an instance dir, and "tmpdir" for creating temporary directory as an instance dir which is removed when the user\*(Aqs session is closed\&. Methods "context" and "level" are only available with SELinux\&. This field cannot be blank\&.
96 .PP
97 The fourth field,
98 \fIlist_of_uids\fR, is a comma separated list of user names for whom the polyinstantiation is not performed\&. If left blank, polyinstantiation will be performed for all users\&. If the list is preceded with a single "~" character, polyinstantiation is performed only for users in the list\&.
99 .PP
100 The
101 \fImethod\fR
102 field can contain also following optional flags separated by
103 \fI:\fR
104 characters\&.
105 .PP
106 \fIcreate\fR=\fImode\fR,\fIowner\fR,\fIgroup\fR
107 \- create the polyinstantiated directory\&. The mode, owner and group parameters are optional\&. The default for mode is determined by umask, the default owner is the user whose session is opened, the default group is the primary group of the user\&.
108 .PP
109 \fIiscript\fR=\fIpath\fR
110 \- path to the instance directory init script\&. The base directory for relative paths is
111 /etc/security/namespace\&.d\&.
112 .PP
113 \fInoinit\fR
114 \- instance directory init script will not be executed\&.
115 .PP
116 \fIshared\fR
117 \- the instance directories for "context" and "level" methods will not contain the user name and will be shared among all users\&.
118 .PP
119 \fImntopts\fR=\fIvalue\fR
120 \- value of this flag is passed to the mount call when the tmpfs mount is done\&. It allows for example the specification of the maximum size of the tmpfs instance that is created by the mount call\&. In addition to options specified in the
121 \fBtmpfs\fR(5)
122 manual the
123 \fInosuid\fR,
124 \fInoexec\fR, and
125 \fInodev\fR
126 flags can be used to respectively disable setuid bit effect, disable running executables, and disable devices to be interpreted on the mounted tmpfs filesystem\&.
127 .PP
128 The directory where polyinstantiated instances are to be created, must exist and must have, by default, the mode of 0000\&. The requirement that the instance parent be of mode 0000 can be overridden with the command line option
129 \fIignore_instance_parent_mode\fR
130 .PP
131 In case of context or level polyinstantiation the SELinux context which is used for polyinstantiation is the context used for executing a new process as obtained by getexeccon\&. This context must be set by the calling application or
132 pam_selinux\&.so
133 module\&. If this context is not set the polyinstantiation will be based just on user name\&.
134 .PP
135 The "instance differentiation string" is <user name> for "user" method and <user name>_<raw directory context> for "context" and "level" methods\&. If the whole string is too long the end of it is replaced with md5sum of itself\&. Also when command line option
136 \fIgen_hash\fR
137 is used the whole string is replaced with md5sum of itself\&.
138 .SH "EXAMPLES"
139 .PP
140 These are some example lines which might be specified in
141 /etc/security/namespace\&.conf\&.
142 .sp
143 .if n \{\
144 .RS 4
145 .\}
146 .nf
147 # The following three lines will polyinstantiate /tmp,
148 # /var/tmp and user\*(Aqs home directories\&. /tmp and /var/tmp
149 # will be polyinstantiated based on the security level
150 # as well as user name, whereas home directory will be
151 # polyinstantiated based on the full security context and user name\&.
152 # Polyinstantiation will not be performed for user root
153 # and adm for directories /tmp and /var/tmp, whereas home
154 # directories will be polyinstantiated for all users\&.
155 #
156 # Note that instance directories do not have to reside inside
157 # the polyinstantiated directory\&. In the examples below,
158 # instances of /tmp will be created in /tmp\-inst directory,
159 # where as instances of /var/tmp and users home directories
160 # will reside within the directories that are being
161 # polyinstantiated\&.
162 #
163 /tmp /tmp\-inst/ level root,adm
164 /var/tmp /var/tmp/tmp\-inst/ level root,adm
165 $HOME $HOME/$USER\&.inst/inst\- context
166
167 .fi
168 .if n \{\
169 .RE
170 .\}
171 .PP
172 For the <service>s you need polyinstantiation (login for example) put the following line in /etc/pam\&.d/<service> as the last line for session group:
173 .PP
174 session required pam_namespace\&.so [arguments]
175 .PP
176 This module also depends on pam_selinux\&.so setting the context\&.
177 .SH "SEE ALSO"
178 .PP
179 \fBpam_namespace\fR(8),
180 \fBpam.d\fR(5),
181 \fBpam\fR(8)
182 .SH "AUTHORS"
183 .PP
184 The namespace\&.conf manual page was written by Janak Desai <janak@us\&.ibm\&.com>\&. More features added by Tomas Mraz <tmraz@redhat\&.com>\&.