proc.5: Remove duplicated /proc/[pid]/gid_map entry
[man-pages.git] / man7 / session-keyring.7
bloba7340f90c28986ec0cdc474d2038988c958d5dc4
1 .\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
2 .\" Written by David Howells (dhowells@redhat.com)
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License
7 .\" as published by the Free Software Foundation; either version
8 .\" 2 of the License, or (at your option) any later version.
9 .\" %%%LICENSE_END
10 .\"
11 .TH SESSION-KEYRING 7 2021-03-22 Linux "Linux Programmer's Manual"
12 .SH NAME
13 session-keyring \- session shared process keyring
14 .SH DESCRIPTION
15 The session keyring is a keyring used to anchor keys on behalf of a process.
16 It is typically created by
17 .BR pam_keyinit (8)
18 when a user logs in and a link will be added that refers to the
19 .BR user\-keyring (7).
20 Optionally, PAM may revoke the session keyring on logout.
21 (In typical configurations, PAM does do this revocation.)
22 The session keyring has the name (description)
23 .IR _ses .
24 .PP
25 A special serial number value,
26 .BR KEY_SPEC_SESSION_KEYRING ,
27 is defined that can be used in lieu of the actual serial number of
28 the calling process's session keyring.
29 .PP
30 From the
31 .BR keyctl (1)
32 utility, '\fB@s\fP' can be used instead of a numeric key ID in
33 much the same way.
34 .PP
35 A process's session keyring is inherited across
36 .BR clone (2),
37 .BR fork (2),
38 and
39 .BR vfork (2).
40 The session keyring
41 is preserved across
42 .BR execve (2),
43 even when the executable is set-user-ID or set-group-ID or has capabilities.
44 The session keyring is destroyed when the last process that
45 refers to it exits.
46 .PP
47 If a process doesn't have a session keyring when it is accessed, then,
48 under certain circumstances, the
49 .BR user\-session\-keyring (7)
50 will be attached as the session keyring
51 and under others a new session keyring will be created.
52 (See
53 .BR user\-session\-keyring (7)
54 for further details.)
55 .SS Special operations
56 The
57 .I keyutils
58 library provides the following special operations for manipulating
59 session keyrings:
60 .TP
61 .BR keyctl_join_session_keyring (3)
62 This operation allows the caller to change the session keyring
63 that it subscribes to.
64 The caller can join an existing keyring with a specified name (description),
65 create a new keyring with a given name,
66 or ask the kernel to create a new "anonymous"
67 session keyring with the name "_ses".
68 (This function is an interface to the
69 .BR keyctl (2)
70 .B KEYCTL_JOIN_SESSION_KEYRING
71 operation.)
72 .TP
73 .BR keyctl_session_to_parent (3)
74 This operation allows the caller to make the parent process's
75 session keyring to the same as its own.
76 For this to succeed, the parent process must have
77 identical security attributes and must be single threaded.
78 (This function is an interface to the
79 .BR keyctl (2)
80 .B KEYCTL_SESSION_TO_PARENT
81 operation.)
82 .PP
83 These operations are also exposed through the
84 .BR keyctl (1)
85 utility as:
86 .PP
87 .in +4n
88 .EX
89 keyctl session
90 keyctl session \- [<prog> <arg1> <arg2> ...]
91 keyctl session <name> [<prog> <arg1> <arg2> ...]
92 .EE
93 .in
94 .PP
95 and:
96 .PP
97 .in +4n
98 .EX
99 keyctl new_session
102 .SH SEE ALSO
103 .ad l
105 .BR keyctl (1),
106 .BR keyctl (3),
107 .BR keyctl_join_session_keyring (3),
108 .BR keyctl_session_to_parent (3),
109 .BR keyrings (7),
110 .BR persistent\-keyring (7),
111 .BR process\-keyring (7),
112 .BR thread\-keyring (7),
113 .BR user\-keyring (7),
114 .BR user\-session\-keyring (7),
115 .BR pam_keyinit (8)