Revert "keyrings.7: ffix"
[man-pages.git] / man / man7 / keyrings.7
blob07d7bc297bd873ba97a0948c273d60eb077feede
1 .\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
2 .\" Written by David Howells (dhowells@redhat.com)
3 .\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\"
7 .TH keyrings 7 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 keyrings \- in-kernel key management and retention facility
10 .SH DESCRIPTION
11 The Linux key-management facility
12 is primarily a way for various kernel components
13 to retain or cache security data,
14 authentication keys, encryption keys, and other data in the kernel.
16 System call interfaces are provided so that user-space programs can manage
17 those objects and also use the facility for their own purposes; see
18 .BR add_key (2),
19 .BR request_key (2),
20 and
21 .BR keyctl (2).
23 A library and some user-space utilities are provided to allow access to the
24 facility.
25 See
26 .BR keyctl (1),
27 .BR keyctl (3),
28 and
29 .BR keyutils (7)
30 for more information.
31 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
32 .SS Keys
33 A key has the following attributes:
34 .TP
35 Serial number (ID)
36 This is a unique integer handle by which a key is referred to in system calls.
37 The serial number is sometimes synonymously referred as the key ID.
38 Programmatically, key serial numbers are represented using the type
39 .IR key_serial_t .
40 .TP
41 Type
42 A key's type defines what sort of data can be held in the key,
43 how the proposed content of the key will be parsed,
44 and how the payload will be used.
45 .IP
46 There are a number of general-purpose types available, plus some specialist
47 types defined by specific kernel components.
48 .TP
49 Description (name)
50 The key description is a printable string that is used as the search term
51 for the key (in conjunction with the key type) as well as a display name.
52 During searches, the description may be partially matched or exactly matched.
53 .TP
54 Payload (data)
55 The payload is the actual content of a key.
56 This is usually set when a key is created,
57 but it is possible for the kernel to upcall to user space to finish the
58 instantiation of a key if that key wasn't already known to the kernel
59 when it was requested.
60 For further details, see
61 .BR request_key (2).
62 .IP
63 A key's payload can be read and updated if the key type supports it and if
64 suitable permission is granted to the caller.
65 .TP
66 Access rights
67 Much as files do,
68 each key has an owning user ID, an owning group ID, and a security label.
69 Each key also has a set of permissions,
70 though there are more than for a normal UNIX file,
71 and there is an additional category\[em]possessor\[em]beyond the usual user,
72 group, and other (see
73 .IR Possession ,
74 below).
75 .IP
76 Note that keys are quota controlled, since they require unswappable kernel
77 memory.
78 The owning user ID specifies whose quota is to be debited.
79 .TP
80 Expiration time
81 Each key can have an expiration time set.
82 When that time is reached,
83 the key is marked as being expired and accesses to it fail with the error
84 .BR EKEYEXPIRED .
85 If not deleted, updated, or replaced, then, after a set amount of time,
86 an expired key is automatically removed (garbage collected)
87 along with all links to it,
88 and attempts to access the key fail with the error
89 .BR ENOKEY .
90 .TP
91 Reference count
92 Each key has a reference count.
93 Keys are referenced by keyrings, by currently active users,
94 and by a process's credentials.
95 When the reference count reaches zero,
96 the key is scheduled for garbage collection.
97 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
98 .SS Key types
99 The kernel provides several basic types of key:
101 .I \[dq]keyring\[dq]
102 .\" Note that keyrings use different fields in struct key in order to store
103 .\" their data - index_key instead of type/description and name_link/keys
104 .\" instead of payload.
105 Keyrings are special keys which store a set of links
106 to other keys (including other keyrings),
107 analogous to a directory holding links to files.
108 The main purpose of a keyring is to prevent other keys from
109 being garbage collected because nothing refers to them.
111 Keyrings with descriptions (names)
112 that begin with a period (\[aq].\[aq]) are reserved to the implementation.
114 .I \[dq]user\[dq]
115 This is a general-purpose key type.
116 The key is kept entirely within kernel memory.
117 The payload may be read and updated by user-space applications.
119 The payload for keys of this type is a blob of arbitrary data
120 of up to 32,767 bytes.
122 The description may be any valid string, though it is preferred that it
123 start with a colon-delimited prefix representing the service
124 to which the key is of interest
125 (for instance
126 .IR \[dq]afs:mykey\[dq] ).
128 .IR \[dq]logon\[dq] " (since Linux 3.3)"
129 .\" commit 9f6ed2ca257fa8650b876377833e6f14e272848b
130 This key type is essentially the same as
131 .IR \[dq]user\[dq] ,
132 but it does not provide reading (i.e., the
133 .BR keyctl (2)
134 .B KEYCTL_READ
135 operation),
136 meaning that the key payload is never visible from user space.
137 This is suitable for storing username-password pairs
138 that should not be readable from user space.
140 The description of a
141 .I \[dq]logon\[dq]
143 .I must
144 start with a non-empty colon-delimited prefix whose purpose
145 is to identify the service to which the key belongs.
146 (Note that this differs from keys of the
147 .I \[dq]user\[dq]
148 type, where the inclusion of a prefix is recommended but is not enforced.)
150 .IR \[dq]big_key\[dq] " (since Linux 3.13)"
151 .\" commit ab3c3587f8cda9083209a61dbe3a4407d3cada10
152 This key type is similar to the
153 .I \[dq]user\[dq]
154 key type, but it may hold a payload of up to 1\ MiB in size.
155 This key type is useful for purposes such as holding Kerberos ticket caches.
157 The payload data may be stored in a tmpfs filesystem,
158 rather than in kernel memory,
159 if the data size exceeds the overhead of storing the data in the filesystem.
160 (Storing the data in a filesystem requires filesystem structures
161 to be allocated in the kernel.
162 The size of these structures determines the size threshold
163 above which the tmpfs storage method is used.)
164 Since Linux 4.8,
165 .\" commit 13100a72f40f5748a04017e0ab3df4cf27c809ef
166 the payload data is encrypted when stored in tmpfs,
167 thereby preventing it from being written unencrypted into swap space.
169 There are more specialized key types available also,
170 but they aren't discussed here
171 because they aren't intended for normal user-space use.
173 Key type names
174 that begin with a period (\[aq].\[aq]) are reserved to the implementation.
175 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
176 .SS Keyrings
177 As previously mentioned, keyrings are a special type of key that contain
178 links to other keys (which may include other keyrings).
179 Keys may be linked to by multiple keyrings.
180 Keyrings may be considered as analogous to UNIX directories
181 where each directory contains a set of hard links to files.
183 Various operations (system calls) may be applied only to keyrings:
185 Adding
186 A key may be added to a keyring by system calls that create keys.
187 This prevents the new key from being immediately deleted
188 when the system call releases its last reference to the key.
190 Linking
191 A link may be added to a keyring pointing to a key that is already known,
192 provided this does not create a self-referential cycle.
194 Unlinking
195 A link may be removed from a keyring.
196 When the last link to a key is removed,
197 that key will be scheduled for deletion by the garbage collector.
199 Clearing
200 All the links may be removed from a keyring.
202 Searching
203 A keyring may be considered the root of a tree or subtree in which keyrings
204 form the branches and non-keyrings the leaves.
205 This tree may be searched for a key matching
206 a particular type and description.
209 .BR keyctl_clear (3),
210 .BR keyctl_link (3),
211 .BR keyctl_search (3),
213 .BR keyctl_unlink (3)
214 for more information.
215 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
216 .SS Anchoring keys
217 To prevent a key from being garbage collected,
218 it must be anchored to keep its reference count elevated
219 when it is not in active use by the kernel.
221 Keyrings are used to anchor other keys:
222 each link is a reference on a key.
223 Note that keyrings themselves are just keys and
224 are also subject to the same anchoring requirement to prevent
225 them being garbage collected.
227 The kernel makes available a number of anchor keyrings.
228 Note that some of these keyrings will be created only when first accessed.
230 Process keyrings
231 Process credentials themselves reference keyrings with specific semantics.
232 These keyrings are pinned as long as the set of credentials exists,
233 which is usually as long as the process exists.
235 There are three keyrings with different inheritance/sharing rules:
237 .BR session\-keyring (7)
238 (inherited and shared by all child processes),
240 .BR process\-keyring (7)
241 (shared by all threads in a process) and
243 .BR thread\-keyring (7)
244 (specific to a particular thread).
246 As an alternative to using the actual keyring IDs,
247 in calls to
248 .BR add_key (2),
249 .BR keyctl (2),
251 .BR request_key (2),
252 the special keyring values
253 .BR KEY_SPEC_SESSION_KEYRING ,
254 .BR KEY_SPEC_PROCESS_KEYRING ,
256 .B KEY_SPEC_THREAD_KEYRING
257 can be used to refer to the caller's own instances of these keyrings.
259 User keyrings
260 Each UID known to the kernel has a record that contains two keyrings: the
261 .BR user\-keyring (7)
262 and the
263 .BR user\-session\-keyring (7).
264 These exist for as long as the UID record in the kernel exists.
266 As an alternative to using the actual keyring IDs,
267 in calls to
268 .BR add_key (2),
269 .BR keyctl (2),
271 .BR request_key (2),
272 the special keyring values
273 .B KEY_SPEC_USER_KEYRING
275 .B KEY_SPEC_USER_SESSION_KEYRING
276 can be used to refer to the caller's own instances of these keyrings.
278 A link to the user keyring is placed in a new session keyring by
279 .BR pam_keyinit (8)
280 when a new login session is initiated.
282 Persistent keyrings
283 There is a
284 .BR persistent\-keyring (7)
285 available to each UID known to the system.
286 It may persist beyond the life of the UID record previously mentioned,
287 but has an expiration time set such that it is automatically cleaned up
288 after a set time.
289 The persistent keyring permits, for example,
290 .BR cron (8)
291 scripts to use credentials that are left in the persistent keyring after
292 the user logs out.
294 Note that the expiration time of the persistent keyring
295 is reset every time the persistent key is requested.
297 Special keyrings
298 There are special keyrings owned by the kernel that can anchor keys
299 for special purposes.
300 An example of this is the \fIsystem keyring\fR used for holding
301 encryption keys for module signature verification.
303 These special keyrings  are usually closed to direct alteration
304 by user space.
306 An originally planned "group keyring",
307 for storing keys associated with each GID known to the kernel,
308 is not so far implemented, is unlikely to be implemented.
309 Nevertheless, the constant
310 .B KEY_SPEC_GROUP_KEYRING
311 has been defined for this keyring.
312 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
313 .SS Possession
314 The concept of possession is important to understanding the keyrings
315 security model.
316 Whether a thread possesses a key is determined by the following rules:
317 .IP (1) 5
318 Any key or keyring that does not grant
319 .I search
320 permission to the caller is ignored in all the following rules.
321 .IP (2)
322 A thread possesses its
323 .BR session\-keyring (7),
324 .BR process\-keyring (7),
326 .BR thread\-keyring (7)
327 directly because those keyrings are referred to by its credentials.
328 .IP (3)
329 If a keyring is possessed, then any key it links to is also possessed.
330 .IP (4)
331 If any key a keyring links to is itself a keyring, then rule (3) applies
332 recursively.
333 .IP (5)
334 If a process is upcalled from the kernel to instantiate a key (see
335 .BR request_key (2)),
336 then it also possesses the requester's keyrings as in
337 rule (1) as if it were the requester.
339 Note that possession is not a fundamental property of a key,
340 but must rather be calculated each time the key is needed.
342 Possession is designed to allow set-user-ID programs run from, say
343 a user's shell to access the user's keys.
344 Granting permissions to the key possessor while denying them
345 to the key owner and group allows the prevention of access to keys
346 on the basis of UID and GID matches.
348 When it creates the session keyring,
349 .BR pam_keyinit (8)
350 adds a link to the
351 .BR user\-keyring (7),
352 thus making the user keyring and anything it contains possessed by default.
353 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
354 .SS Access rights
355 Each key has the following security-related attributes:
356 .IP \[bu] 3
357 The owning user ID
358 .IP \[bu]
359 The ID of a group that is permitted to access the key
360 .IP \[bu]
361 A security label
362 .IP \[bu]
363 A permissions mask
365 The permissions mask contains four sets of rights.
366 The first three sets are mutually exclusive.
367 One and only one will be in force for a particular access check.
368 In order of descending priority, these three sets are:
370 .I user
371 The set specifies the rights granted
372 if the key's user ID matches the caller's filesystem user ID.
374 .I group
375 The set specifies the rights granted
376 if the user ID didn't match and the key's group ID matches the caller's
377 filesystem GID or one of the caller's supplementary group IDs.
379 .I other
380 The set specifies the rights granted
381 if neither the key's user ID nor group ID matched.
383 The fourth set of rights is:
385 .I possessor
386 The set specifies the rights granted
387 if a key is determined to be possessed by the caller.
389 The complete set of rights for a key is the union of whichever
390 of the first three sets is applicable plus the fourth set
391 if the key is possessed.
393 The set of rights that may be granted in each of the four masks
394 is as follows:
396 .I view
397 The attributes of the key may be read.
398 This includes the type,
399 description, and access rights (excluding the security label).
401 .I read
402 For a key: the payload of the key may be read.
403 For a keyring: the list of serial numbers (keys) to
404 which the keyring has links may be read.
406 .I write
407 The payload of the key may be updated and the key may be revoked.
408 For a keyring, links may be added to or removed from the keyring,
409 and the keyring may be cleared completely (all links are removed),
411 .I search
412 For a key (or a keyring): the key may be found by a search.
413 For a keyring: keys and keyrings that are linked to by the
414 keyring may be searched.
416 .I link
417 Links may be created from keyrings to the key.
418 The initial link to a key that is established when the key is created
419 doesn't require this permission.
421 .I setattr
422 The ownership details and security label of the key may be changed,
423 the key's expiration time may be set, and the key may be revoked.
425 In addition to access rights, any active Linux Security Module (LSM) may
426 prevent access to a key if its policy so dictates.
427 A key may be given a
428 security label or other attribute by the LSM;
429 this label is retrievable via
430 .BR keyctl_get_security (3).
433 .BR keyctl_chown (3),
434 .BR keyctl_describe (3),
435 .BR keyctl_get_security (3),
436 .BR keyctl_setperm (3),
438 .BR selinux (8)
439 for more information.
440 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
441 .SS Searching for keys
442 One of the key features of the Linux key-management facility
443 is the ability to find a key that a process is retaining.
445 .BR request_key (2)
446 system call is the primary point of
447 access for user-space applications to find a key.
448 (Internally, the kernel has something similar available
449 for use by internal components that make use of keys.)
451 The search algorithm works as follows:
452 .IP (1) 5
453 The process keyrings are searched in the following order: the
454 .BR thread\-keyring (7)
455 if it exists, the
456 .BR process\-keyring (7)
457 if it exists, and then either the
458 .BR session\-keyring (7)
459 if it exists or the
460 .BR user\-session\-keyring (7)
461 if that exists.
462 .IP (2)
463 If the caller was a process that was invoked by the
464 .BR request_key (2)
465 upcall mechanism, then the keyrings of the original caller of
466 .BR request_key (2)
467 will be searched as well.
468 .IP (3)
469 The search of a keyring tree is in breadth-first order:
470 each keyring is searched first for a match,
471 then the keyrings referred to by that keyring are searched.
472 .IP (4)
473 If a matching key is found that is valid,
474 then the search terminates and that key is returned.
475 .IP (5)
476 If a matching key is found that has an error state attached,
477 that error state is noted and the search continues.
478 .IP (6)
479 If no valid matching key is found,
480 then the first noted error state is returned; otherwise, an
481 .B ENOKEY
482 error is returned.
484 It is also possible to search a specific keyring, in which case only steps
485 (3) to (6) apply.
488 .BR request_key (2)
490 .BR keyctl_search (3)
491 for more information.
492 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
493 .SS On-demand key creation
494 If a key cannot be found,
495 .BR request_key (2)
496 will, if given a
497 .I callout_info
498 argument, create a new key and then upcall to user space to
499 instantiate the key.
500 This allows keys to be created on an as-needed basis.
502 Typically,
503 this will involve the kernel creating a new process that executes the
504 .BR request\-key (8)
505 program, which will then execute the appropriate handler based on its
506 configuration.
508 The handler is passed a special authorization key that allows it
509 and only it to instantiate the new key.
510 This is also used to permit searches performed by the
511 handler program to also search the requester's keyrings.
514 .BR request_key (2),
515 .BR keyctl_assume_authority (3),
516 .BR keyctl_instantiate (3),
517 .BR keyctl_negate (3),
518 .BR keyctl_reject (3),
519 .BR request\-key (8),
521 .BR request\-key.conf (5)
522 for more information.
523 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
524 .SS Users
525 The Linux key-management facility has a number of users and usages,
526 but is not limited to those that already exist.
528 In-kernel users of this facility include:
530 Network filesystems - DNS
531 The kernel uses the upcall mechanism provided by the keys to upcall to
532 user space to do DNS lookups and then to cache the results.
534 AF_RXRPC and kAFS - Authentication
535 The AF_RXRPC network protocol and the in-kernel AFS filesystem
536 use keys to store the ticket needed to do secured or encrypted traffic.
537 These are then looked up by
538 network operations on AF_RXRPC and filesystem operations on kAFS.
540 NFS - User ID mapping
541 The NFS filesystem uses keys to store mappings of
542 foreign user IDs to local user IDs.
544 CIFS - Password
545 The CIFS filesystem uses keys to store passwords for accessing remote shares.
547 Module verification
548 The kernel build process can be made to cryptographically sign modules.
549 That signature is then checked when a module is loaded.
551 User-space users of this facility include:
553 Kerberos key storage
554 The MIT Kerberos 5 facility (libkrb5) can use keys to store authentication
555 tokens which can be made to be automatically cleaned up a set time after
556 the user last uses them,
557 but until then permits them to hang around after the user
558 has logged out so that
559 .BR cron (8)
560 scripts can use them.
561 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
562 .SH FILES
563 The kernel provides various
564 .I /proc
565 files that expose information about keys or define limits on key usage.
567 .IR /proc/keys " (since Linux 2.6.10)"
568 This file exposes a list of the keys for which the reading thread has
569 .I view
570 permission, providing various information about each key.
571 The thread need not possess the key for it to be visible in this file.
572 .\" David Howells, Dec 2016 linux-man@:
573 .\" This [The thread need not possess the key for it to be visible in
574 .\" this file.] is correct.  See proc_keys_show() in security/keys/proc.c:
576 .\"     rc = key_task_permission(key_ref, ctx.cred, KEY_NEED_VIEW);
577 .\"     if (rc < 0)
578 .\"             return 0;
580 .\"Possibly it shouldn't be, but for now it is.
583 The only keys included in the list are those that grant
584 .I view
585 permission to the reading process
586 (regardless of whether or not it possesses them).
587 LSM security checks are still performed,
588 and may filter out further keys that the process is not authorized to view.
590 An example of the data that one might see in this file
591 (with the columns numbered for easy reference below)
592 is the following:
595   (1)     (2)     (3)(4)    (5)     (6)   (7)   (8)        (9)
596 009a2028 I\-\-Q\-\-\-   1 perm 3f010000  1000  1000 user     krb_ccache:primary: 12
597 1806c4ba I\-\-Q\-\-\-   1 perm 3f010000  1000  1000 keyring  _pid: 2
598 25d3a08f I\-\-Q\-\-\-   1 perm 1f3f0000  1000 65534 keyring  _uid_ses.1000: 1
599 28576bd8 I\-\-Q\-\-\-   3 perm 3f010000  1000  1000 keyring  _krb: 1
600 2c546d21 I\-\-Q\-\-\- 190 perm 3f030000  1000  1000 keyring  _ses: 2
601 30a4e0be I\-\-\-\-\-\-   4   2d 1f030000  1000 65534 keyring  _persistent.1000: 1
602 32100fab I\-\-Q\-\-\-   4 perm 1f3f0000  1000 65534 keyring  _uid.1000: 2
603 32a387ea I\-\-Q\-\-\-   1 perm 3f010000  1000  1000 keyring  _pid: 2
604 3ce56aea I\-\-Q\-\-\-   5 perm 3f030000  1000  1000 keyring  _ses: 1
607 The fields shown in each line of this file are as follows:
610 ID (1)
611 The ID (serial number) of the key, expressed in hexadecimal.
613 Flags (2)
614 A set of flags describing the state of the key:
618 .\" KEY_FLAG_INSTANTIATED
619 The key has been instantiated.
622 .\" KEY_FLAG_REVOKED
623 The key has been revoked.
626 .\" KEY_FLAG_DEAD
627 The key is dead (i.e., the key type has been unregistered).
628 .\" unregister_key_type() in the kernel source
629 (A key may be briefly in this state during garbage collection.)
632 .\" KEY_FLAG_IN_QUOTA
633 The key contributes to the user's quota.
636 .\" KEY_FLAG_USER_CONSTRUCT
637 The key is under construction via a callback to user space;
639 .BR request\-key (2).
642 .\" KEY_FLAG_NEGATIVE
643 The key is negatively instantiated.
646 .\" KEY_FLAG_INVALIDATED
647 The key has been invalidated.
650 Usage (3)
651 This is a count of the number of kernel credential
652 structures that are pinning the key
653 (approximately: the number of threads and open file references
654 that refer to this key).
656 Timeout (4)
657 The amount of time until the key will expire,
658 expressed in human-readable form (weeks, days, hours, minutes, and seconds).
659 The string
660 .I perm
661 here means that the key is permanent (no timeout).
662 The string
663 .I expd
664 means that the key has already expired,
665 but has not yet been garbage collected.
667 Permissions (5)
668 The key permissions, expressed as four hexadecimal bytes containing,
669 from left to right, the possessor, user, group, and other permissions.
670 Within each byte, the permission bits are as follows:
672 .PD 0
673 .RS 12
675 0x01
676 .I view
678 0x02
679 .I read
681 0x04
682 .I write
684 0x08
685 .I search
687 0x10
688 .I link
690 0x20
691 .I setattr
695 UID (6)
696 The user ID of the key owner.
698 GID (7)
699 The group ID of the key.
700 The value \-1 here means that the key has no group ID;
701 this can occur in certain circumstances for keys created by the kernel.
703 Type (8)
704 The key type (user, keyring, etc.)
706 Description (9)
707 The key description (name).
708 This field contains descriptive information about the key.
709 For most key types, it has the form
711 .in +4n
713 name[: extra\-info]
718 .I name
719 subfield is the key's description (name).
720 The optional
721 .I extra\-info
722 field provides some further information about the key.
723 The information that appears here depends on the key type, as follows:
726 .IR \[dq]user\[dq] " and " \[dq]logon\[dq]
727 The size in bytes of the key payload (expressed in decimal).
729 .I \[dq]keyring\[dq]
730 The number of keys linked to the keyring,
731 or the string
732 .I empty
733 if there are no keys linked to the keyring.
735 .I \[dq]big_key\[dq]
736 The payload size in bytes, followed either by the string
737 .IR [file] ,
738 if the key payload exceeds the threshold that means that the
739 payload is stored in a (swappable)
740 .BR tmpfs (5)
741 filesystem,
742 or otherwise the string
743 .IR [buff] ,
744 indicating that the key is small enough to reside in kernel memory.
747 For the
748 .I \[dq].request_key_auth\[dq]
749 key type
750 (authorization key; see
751 .BR request_key (2)),
752 the description field has the form shown in the following example:
754 .in +4n
756 key:c9a9b19 pid:28880 ci:10
760 The three subfields are as follows:
763 .I key
764 The hexadecimal ID of the key being instantiated in the requesting program.
766 .I pid
767 The PID of the requesting program.
769 .I ci
770 The length of the callout data with which the requested key should
771 be instantiated
772 (i.e., the length of the payload associated with the authorization key).
776 .IR /proc/key\-users " (since Linux 2.6.10)"
777 This file lists various information for each user ID that
778 has at least one key on the system.
779 An example of the data that one might see in this file is the following:
781 .in +4n
783    0:    10 9/9 2/1000000 22/25000000
784   42:     9 9/9 8/200 106/20000
785 1000:    11 11/11 10/200 271/20000
789 The fields shown in each line are as follows:
792 .I uid
793 The user ID.
795 .I usage
796 This is a kernel-internal usage count for the kernel structure
797 used to record key users.
799 .IR nkeys / nikeys
800 The total number of keys owned by the user,
801 and the number of those keys that have been instantiated.
803 .IR qnkeys / maxkeys
804 The number of keys owned by the user,
805 and the maximum number of keys that the user may own.
807 .IR qnbytes / maxbytes
808 The number of bytes consumed in payloads of the keys owned by this user,
809 and the upper limit on the number of bytes in key payloads for that user.
812 .IR /proc/sys/kernel/keys/gc_delay " (since Linux 2.6.32)"
813 .\" commit 5d135440faf7db8d566de0c6fab36b16cf9cfc3b
814 The value in this file specifies the interval, in seconds,
815 after which revoked and expired keys will be garbage collected.
816 The purpose of having such an interval is so that there is a window
817 of time where user space can see an error (respectively
818 .B EKEYREVOKED
820 .BR EKEYEXPIRED )
821 that indicates what happened to the key.
823 The default value in this file is 300 (i.e., 5 minutes).
825 .IR /proc/sys/kernel/keys/persistent_keyring_expiry " (since Linux 3.13)"
826 .\" commit f36f8c75ae2e7d4da34f4c908cebdb4aa42c977e
827 This file defines an interval, in seconds,
828 to which the persistent keyring's expiration timer is reset
829 each time the keyring is accessed (via
830 .BR keyctl_get_persistent (3)
831 or the
832 .BR keyctl (2)
833 .B KEYCTL_GET_PERSISTENT
834 operation.)
836 The default value in this file is 259200 (i.e., 3 days).
838 The following files (which are writable by privileged processes)
839 are used to enforce quotas on the number of keys
840 and number of bytes of data that can be stored in key payloads:
842 .IR /proc/sys/kernel/keys/maxbytes " (since Linux 2.6.26)"
843 .\" commit 0b77f5bfb45c13e1e5142374f9d6ca75292252a4
844 .\" Previously: KEYQUOTA_MAX_BYTES      10000
845 This is the maximum number of bytes of data that a nonroot user
846 can hold in the payloads of the keys owned by the user.
848 The default value in this file is 20,000.
850 .IR /proc/sys/kernel/keys/maxkeys " (since Linux 2.6.26)"
851 .\" commit 0b77f5bfb45c13e1e5142374f9d6ca75292252a4
852 .\" Previously: KEYQUOTA_MAX_KEYS       100
853 This is the maximum number of keys that a nonroot user may own.
855 The default value in this file is 200.
857 .IR /proc/sys/kernel/keys/root_maxbytes " (since Linux 2.6.26)"
858 This is the maximum number of bytes of data that the root user
859 (UID 0 in the root user namespace)
860 can hold in the payloads of the keys owned by root.
862 .\"738c5d190f6540539a04baf36ce21d46b5da04bd
863 The default value in this file is 25,000,000 (20,000 before Linux 3.17).
864 .\" commit 0b77f5bfb45c13e1e5142374f9d6ca75292252a4
866 .IR /proc/sys/kernel/keys/root_maxkeys " (since Linux 2.6.26)"
867 .\" commit 0b77f5bfb45c13e1e5142374f9d6ca75292252a4
868 This is the maximum number of keys that the root user
869 (UID 0 in the root user namespace)
870 may own.
872 .\"738c5d190f6540539a04baf36ce21d46b5da04bd
873 The default value in this file is 1,000,000 (200 before Linux 3.17).
875 With respect to keyrings,
876 note that each link in a keyring consumes 4 bytes of the keyring payload.
877 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
878 .SH SEE ALSO
879 .ad l
881 .BR keyctl (1),
882 .BR add_key (2),
883 .BR keyctl (2),
884 .BR request_key (2),
885 .BR keyctl (3),
886 .BR keyutils (7),
887 .BR persistent\-keyring (7),
888 .BR process\-keyring (7),
889 .BR session\-keyring (7),
890 .BR thread\-keyring (7),
891 .BR user\-keyring (7),
892 .BR user\-session\-keyring (7),
893 .BR pam_keyinit (8),
894 .BR request\-key (8)
896 .I linux.git/Documentation/crypto/asymmetric\-keys.txt
898 .I linux.git/\:Documentation/\:security/\:keys/