1PAM_NAMESPACE(8) Linux-PAM Manual PAM_NAMESPACE(8)
2
3
4
6 pam_namespace - PAM module for configuring namespace for a session
7
9 pam_namespace.so [debug] [unmnt_remnt] [unmnt_only] [require_selinux]
10 [gen_hash] [ignore_config_error]
11 [ignore_instance_parent_mode] [no_unmount_on_close]
12 [use_current_context] [use_default_context]
13
15 The pam_namespace PAM module sets up a private namespace for a session
16 with polyinstantiated directories. A polyinstantiated directory
17 provides a different instance of itself based on user name, or when
18 using SELinux, user name, security context or both. If an executable
19 script /etc/security/namespace.init exists, it is used to initialize
20 the instance directory after it is set up and mounted on the
21 polyinstantiated directory. The script receives the polyinstantiated
22 directory path, the instance directory path, flag whether the instance
23 directory was newly created (0 for no, 1 for yes), and the user name as
24 its arguments.
25
26 The pam_namespace module disassociates the session namespace from the
27 parent namespace. Any mounts/unmounts performed in the parent
28 namespace, such as mounting of devices, are not reflected in the
29 session namespace. To propagate selected mount/unmount events from the
30 parent namespace into the disassociated session namespace, an
31 administrator may use the special shared-subtree feature. For
32 additional information on shared-subtree feature, please refer to the
33 mount(8) man page and the shared-subtree description at
34 http://lwn.net/Articles/159077 and http://lwn.net/Articles/159092.
35
37 debug
38 A lot of debug information is logged using syslog
39
40 unmnt_remnt
41 For programs such as su and newrole, the login session has already
42 setup a polyinstantiated namespace. For these programs,
43 polyinstantiation is performed based on new user id or security
44 context, however the command first needs to undo the
45 polyinstantiation performed by login. This argument instructs the
46 command to first undo previous polyinstantiation before proceeding
47 with new polyinstantiation based on new id/context
48
49 unmnt_only
50 For trusted programs that want to undo any existing bind mounts and
51 process instance directories on their own, this argument allows
52 them to unmount currently mounted instance directories
53
54 require_selinux
55 If selinux is not enabled, return failure
56
57 gen_hash
58 Instead of using the security context string for the instance name,
59 generate and use its md5 hash.
60
61 ignore_config_error
62 If a line in the configuration file corresponding to a
63 polyinstantiated directory contains format error, skip that line
64 process the next line. Without this option, pam will return an
65 error to the calling program resulting in termination of the
66 session.
67
68 ignore_instance_parent_mode
69 Instance parent directories by default are expected to have the
70 restrictive mode of 000. Using this option, an administrator can
71 choose to ignore the mode of the instance parent. This option
72 should be used with caution as it will reduce security and
73 isolation goals of the polyinstantiation mechanism.
74
75 no_unmount_on_close
76 For certain trusted programs such as newrole, open session is
77 called from a child process while the parent performs close session
78 and pam end functions. For these commands use this option to
79 instruct pam_close_session to not unmount the bind mounted
80 polyinstantiated directory in the parent.
81
82 use_current_context
83 Useful for services which do not change the SELinux context with
84 setexeccon call. The module will use the current SELinux context of
85 the calling process for the level and context polyinstantiation.
86
87 use_default_context
88 Useful for services which do not use pam_selinux for changing the
89 SELinux context with setexeccon call. The module will use the
90 default SELinux context of the user for the level and context
91 polyinstantiation.
92
94 Only the session module type is provided. The module must not be called
95 from multithreaded processes.
96
98 PAM_SUCCESS
99 Namespace setup was successful.
100
101 PAM_SERVICE_ERR
102 Unexpected system error occurred while setting up namespace.
103
104 PAM_SESSION_ERR
105 Unexpected namespace configuration error occurred.
106
108 /etc/security/namespace.conf
109 Main configuration file
110
111 /etc/security/namespace.d
112 Directory for additional configuration files
113
114 /etc/security/namespace.init
115 Init script for instance directories
116
118 For the <service>s you need polyinstantiation (login for example) put
119 the following line in /etc/pam.d/<service> as the last line for session
120 group:
121
122 session required pam_namespace.so [arguments]
123
124 To use polyinstantiation with graphical display manager gdm, insert the
125 following line, before exit 0, in /etc/gdm/PostSession/Default:
126
127 /usr/sbin/gdm-safe-restart
128
129 This allows gdm to restart after each session and appropriately adjust
130 namespaces of display manager and the X server. If polyinstantiation of
131 /tmp is desired along with the graphical environment, then additional
132 configuration changes are needed to address the interaction of X server
133 and font server namespaces with their use of /tmp to create
134 communication sockets. Please use the initialization script
135 /etc/security/namespace.init to ensure that the X server and its
136 clients can appropriately access the communication socket X0. Please
137 refer to the sample instructions provided in the comment section of the
138 instance initialization script /etc/security/namespace.init. In
139 addition, perform the following changes to use graphical environment
140 with polyinstantiation of /tmp:
141
142 1. Disable the use of font server by commenting out "FontPath"
143 line in /etc/X11/xorg.conf. If you do want to use the font server
144 then you will have to augment the instance initialization
145 script to appropriately provide /tmp/.font-unix from the
146 polyinstantiated /tmp.
147 2. Ensure that the gdm service is setup to use pam_namespace,
148 as described above, by modifying /etc/pam.d/gdm.
149 3. Ensure that the display manager is configured to restart X server
150 with each new session. This default setup can be verified by
151 making sure that /usr/share/gdm/defaults.conf contains
152 "AlwaysRestartServer=true", and it is not overridden by
153 /etc/gdm/custom.conf.
154
155
156
158 namespace.conf(5), pam.d(5), mount(8), pam(8).
159
161 The namespace setup scheme was designed by Stephen Smalley, Janak Desai
162 and Chad Sellers. The pam_namespace PAM module was developed by Janak
163 Desai <janak@us.ibm.com>, Chad Sellers <csellers@tresys.com> and Steve
164 Grubb <sgrubb@redhat.com>. Additional improvements by Xavier Toth
165 <txtoth@gmail.com> and Tomas Mraz <tmraz@redhat.com>.
166
167
168
169Linux-PAM Manual 06/16/2009 PAM_NAMESPACE(8)