Debian Codegraph @

upstream/debian-unstable/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: 06/29/2025
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "NAMESPACE\&.CONF" "5" "06/29/2025" "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 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\&.
43 .PP
44 When someone logs in, the file
45 namespace\&.conf
46 is scanned\&. Comments are marked by
47 \fI#\fR
48 characters\&. Each non comment line represents one polyinstantiated directory\&. The fields are separated by spaces but can be quoted by
49 \fI"\fR
50 characters also escape sequences
51 \fI\eb\fR,
52 \fI\en\fR, and
53 \fI\et\fR
54 are recognized\&. The fields are as follows:
55 .PP
56 \fIpolydir\fR
57 \fIinstance_prefix\fR
58 \fImethod\fR
59 \fIlist_of_uids\fR
60 .PP
61 The first field,
62 \fIpolydir\fR, is the absolute pathname of the directory to polyinstantiate\&. The special string
63 \fI$HOME\fR
64 is replaced with the user\*(Aqs home directory, and
65 \fI$USER\fR
66 with the username\&. This field cannot be blank\&.
67 .PP
68 The second field,
69 \fIinstance_prefix\fR
70 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
71 \fImethod\fR
72 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
73 \fI$HOME\fR
74 is replaced with the user\*(Aqs home directory, and
75 \fI$USER\fR
76 with the username\&. This field cannot be blank\&.
77 .PP
78 The third field,
79 \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\&.
80 .PP
81 The fourth field,
82 \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\&.
83 .PP
84 The
85 \fImethod\fR
86 field can contain also following optional flags separated by
87 \fI:\fR
88 characters\&.
89 .PP
90 \fIcreate\fR=\fImode\fR,\fIowner\fR,\fIgroup\fR
91 \- 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\&.
92 .PP
93 \fIiscript\fR=\fIpath\fR
94 \- path to the instance directory init script\&. The base directory for relative paths is
95 /etc/security/namespace\&.d\&.
96 .PP
97 \fInoinit\fR
98 \- instance directory init script will not be executed\&.
99 .PP
100 \fIshared\fR
101 \- the instance directories for "context" and "level" methods will not contain the user name and will be shared among all users\&.
102 .PP
103 \fImntopts\fR=\fIvalue\fR
104 \- 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
105 \fBtmpfs\fR(5)
106 manual the
107 \fInosuid\fR,
108 \fInoexec\fR, and
109 \fInodev\fR
110 flags can be used to respectively disable setuid bit effect, disable running executables, and disable devices to be interpreted on the mounted tmpfs filesystem\&.
111 .PP
112 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
113 \fIignore_instance_parent_mode\fR
114 .PP
115 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
116 pam_selinux\&.so
117 module\&. If this context is not set the polyinstantiation will be based just on user name\&.
118 .PP
119 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
120 \fIgen_hash\fR
121 is used the whole string is replaced with md5sum of itself\&.
122 .SH "EXAMPLES"
123 .PP
124 These are some example lines which might be specified in
125 /etc/security/namespace\&.conf\&.
126 .sp
127 .if n \{\
128 .RS 4
129 .\}
130 .nf
131 # The following three lines will polyinstantiate /tmp,
132 # /var/tmp and user\*(Aqs home directories\&. /tmp and /var/tmp
133 # will be polyinstantiated based on the security level
134 # as well as user name, whereas home directory will be
135 # polyinstantiated based on the full security context and user name\&.
136 # Polyinstantiation will not be performed for user root
137 # and adm for directories /tmp and /var/tmp, whereas home
138 # directories will be polyinstantiated for all users\&.
139 #
140 # Note that instance directories do not have to reside inside
141 # the polyinstantiated directory\&. In the examples below,
142 # instances of /tmp will be created in /tmp\-inst directory,
143 # where as instances of /var/tmp and users home directories
144 # will reside within the directories that are being
145 # polyinstantiated\&.
146 #
147 /tmp /tmp\-inst/ level root,adm
148 /var/tmp /var/tmp/tmp\-inst/ level root,adm
149 $HOME $HOME/$USER\&.inst/inst\- context
150
151 .fi
152 .if n \{\
153 .RE
154 .\}
155 .PP
156 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:
157 .PP
158 session required pam_namespace\&.so [arguments]
159 .PP
160 This module also depends on pam_selinux\&.so setting the context\&.
161 .SH "SEE ALSO"
162 .PP
163 \fBpam_namespace\fR(8),
164 \fBpam.d\fR(5),
165 \fBpam\fR(7)
166 .SH "AUTHORS"
167 .PP
168 The namespace\&.conf manual page was written by Janak Desai <janak@us\&.ibm\&.com>\&. More features added by Tomas Mraz <tmraz@redhat\&.com>\&.