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