1PAM_SELINUX(8) Linux-PAM Manual PAM_SELINUX(8)
2
3
4
6 pam_selinux - PAM module to set the default security context
7
9 pam_selinux.so [open] [close] [restore] [nottys] [debug] [verbose]
10 [select_context] [env_params] [use_current_range]
11
13 pam_selinux is a PAM module that sets up the default SELinux security
14 context for the next executed process.
15
16 When a new session is started, the open_session part of the module
17 computes and sets up the execution security context used for the next
18 execve(2) call, the file security context for the controlling terminal,
19 and the security context used for creating a new kernel keyring.
20
21 When the session is ended, the close_session part of the module
22 restores old security contexts that were in effect before the change
23 made by the open_session part of the module.
24
25 Adding pam_selinux into the PAM stack might disrupt behavior of other
26 PAM modules which execute applications. To avoid that, pam_selinux.so
27 open should be placed after such modules in the PAM stack, and
28 pam_selinux.so close should be placed before them. When such a
29 placement is not feasible, pam_selinux.so restore could be used to
30 temporary restore original security contexts.
31
33 open
34 Only execute the open_session part of the module.
35
36 close
37 Only execute the close_session part of the module.
38
39 restore
40 In open_session part of the module, temporarily restore the
41 security contexts as they were before the previous call of the
42 module. Another call of this module without the restore option will
43 set up the new security contexts again.
44
45 nottys
46 Do not setup security context of the controlling terminal.
47
48 debug
49 Turn on debug messages via syslog(3).
50
51 verbose
52 Attempt to inform the user when security context is set.
53
54 select_context
55 Attempt to ask the user for a custom security context role. If MLS
56 is on, ask also for sensitivity level.
57
58 env_params
59 Attempt to obtain a custom security context role from PAM
60 environment. If MLS is on, obtain also sensitivity level. This
61 option and the select_context option are mutually exclusive. The
62 respective PAM environment variables are SELINUX_ROLE_REQUESTED,
63 SELINUX_LEVEL_REQUESTED, and SELINUX_USE_CURRENT_RANGE. The first
64 two variables are self describing and the last one if set to 1
65 makes the PAM module behave as if the use_current_range was
66 specified on the command line of the module.
67
68 use_current_range
69 Use the sensitivity level of the current process for the user
70 context instead of the default level. Also suppresses asking of the
71 sensitivity level from the user or obtaining it from PAM
72 environment.
73
75 Only the session module type is provided.
76
78 PAM_SUCCESS
79 The security context was set successfully.
80
81 PAM_SESSION_ERR
82 Unable to get or set a valid context.
83
84 PAM_USER_UNKNOWN
85 The user is not known to the system.
86
87 PAM_BUF_ERR
88 Memory allocation error.
89
91 auth required pam_unix.so
92 session required pam_permit.so
93 session optional pam_selinux.so
94
95
97 execve(2), tty(4), pam.d(5), pam(8), selinux(8)
98
100 pam_selinux was written by Dan Walsh <dwalsh@redhat.com>.
101
102
103
104Linux-PAM Manual 09/03/2021 PAM_SELINUX(8)