2016-11-01 15:43:33 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
|
|
|
|
.\" Written by David Howells (dhowells@redhat.com)
|
|
|
|
.\"
|
2016-11-02 11:24:22 +00:00
|
|
|
.\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
|
2016-11-01 15:43:33 +00:00
|
|
|
.\" This program is free software; you can redistribute it and/or
|
2016-11-08 08:24:22 +00:00
|
|
|
.\" modify it under the terms of the GNU General Public License
|
2016-11-01 15:43:33 +00:00
|
|
|
.\" as published by the Free Software Foundation; either version
|
2016-11-08 08:24:22 +00:00
|
|
|
.\" 2 of the License, or (at your option) any later version.
|
2016-11-02 11:24:22 +00:00
|
|
|
.\" %%%LICENSE_END
|
2016-11-01 15:43:33 +00:00
|
|
|
.\"
|
2019-09-27 12:04:48 +00:00
|
|
|
.TH PERSISTENT-KEYRING 7 2017-03-13 Linux "Linux Programmer's Manual"
|
2016-11-01 15:43:33 +00:00
|
|
|
.SH NAME
|
2016-11-01 17:26:22 +00:00
|
|
|
persistent-keyring \- per-user persistent keyring
|
2016-11-01 15:43:33 +00:00
|
|
|
.SH DESCRIPTION
|
2016-11-01 18:08:09 +00:00
|
|
|
The persistent keyring is a keyring used to anchor keys on behalf of a user.
|
2016-11-01 17:45:14 +00:00
|
|
|
Each UID the kernel deals with has its own persistent keyring that
|
|
|
|
is shared between all threads owned by that UID.
|
2016-11-07 21:46:40 +00:00
|
|
|
The persistent keyring has a name (description) of the form
|
|
|
|
.I _persistent.<UID>
|
|
|
|
where
|
|
|
|
.I <UID>
|
|
|
|
is the user ID of the corresponding user.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
The persistent keyring may not be accessed directly,
|
|
|
|
even by processes with the appropriate UID.
|
|
|
|
.\" FIXME The meaning of the preceding sentence isn't clear. What is meant?
|
|
|
|
Instead, it must first be linked to one of a process's keyrings,
|
|
|
|
before that keyring can access the persistent keyring
|
|
|
|
by virtue of its possessor permits.
|
|
|
|
This linking is done with the
|
|
|
|
.BR keyctl_get_persistent (3)
|
|
|
|
function.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
If a persistent keyring does not exist when it is accessed by the
|
|
|
|
.BR keyctl_get_persistent (3)
|
|
|
|
operation, it will be automatically created.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
Each time the
|
|
|
|
.BR keyctl_get_persistent (3)
|
|
|
|
operation is performed,
|
|
|
|
the persistent key's expiration timer is reset to the value in:
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
/proc/sys/kernel/keys/persistent_keyring_expiry
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
Should the timeout be reached,
|
|
|
|
the persistent keyring will be removed and
|
|
|
|
everything it pins can then be garbage collected.
|
|
|
|
The key will then be re-created on a subsequent call to
|
2016-11-02 02:52:46 +00:00
|
|
|
.BR keyctl_get_persistent (3).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
The persistent keyring is not directly searched by
|
|
|
|
.BR request_key (2);
|
|
|
|
it is searched only if it is linked into one of the keyrings
|
|
|
|
that is searched by
|
|
|
|
.BR request_key (2).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
The persistent keyring is independent of
|
2016-11-01 18:08:09 +00:00
|
|
|
.BR clone (2),
|
|
|
|
.BR fork (2),
|
|
|
|
.BR vfork (2),
|
|
|
|
.BR execve (2),
|
|
|
|
and
|
2016-11-01 18:11:11 +00:00
|
|
|
.BR _exit (2).
|
2016-11-02 11:05:42 +00:00
|
|
|
It persists until its expiration timer triggers,
|
|
|
|
at which point it is garbage collected.
|
|
|
|
This allows the persistent keyring to carry keys beyond the life of
|
|
|
|
the kernel's record of the corresponding UID
|
|
|
|
(the destruction of which results in the destruction of the
|
|
|
|
.BR user-keyring (7)
|
|
|
|
and the
|
|
|
|
.BR user-session-keyring (7)).
|
|
|
|
The persistent keyring can thus be used to
|
|
|
|
hold authentication tokens for processes that run without user interaction,
|
|
|
|
such as programs started by
|
|
|
|
.BR cron (8).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-02 11:05:42 +00:00
|
|
|
The persistent keyring is used to store UID-specific objects that
|
|
|
|
themselves have limited lifetimes (e.g., kerberos tokens).
|
|
|
|
If those tokens cease to be used
|
|
|
|
(i.e., the persistent keyring is not accessed),
|
|
|
|
then the timeout of the persistent keyring ensures that
|
|
|
|
the corresponding objects are automatically discarded.
|
|
|
|
.\"
|
2016-11-01 20:45:39 +00:00
|
|
|
.SS Special operations
|
2016-11-02 11:05:42 +00:00
|
|
|
The
|
|
|
|
.I keyutils
|
|
|
|
library provides the
|
|
|
|
.BR keyctl_get_persistent (3)
|
|
|
|
function for manipulating persistent keyrings.
|
|
|
|
(This function is an interface to the
|
|
|
|
.BR keyctl (2)
|
|
|
|
.B KEYCTL_GET_PERSISTENT
|
|
|
|
operation.)
|
|
|
|
This operation allows the calling thread to get the persistent keyring
|
|
|
|
corresponding to its own UID or, if the thread has the
|
|
|
|
.BR CAP_SETUID
|
|
|
|
capability, the persistent keyring corresponding to some other UID
|
|
|
|
in the same user namespace.
|
|
|
|
.SH NOTES
|
|
|
|
Each user namespace owns a keyring called
|
|
|
|
.IR .persistent_register
|
|
|
|
that contains links to all of the persistent keys in that namespace.
|
|
|
|
(The
|
|
|
|
.IR .persistent_register
|
|
|
|
keyring can be seen when reading the contents of the
|
|
|
|
.IR /proc/keys
|
|
|
|
file for the UID 0 in the namespace.)
|
|
|
|
The
|
2016-11-02 02:52:46 +00:00
|
|
|
.BR keyctl_get_persistent (3)
|
2016-11-02 11:05:42 +00:00
|
|
|
operation looks for a key with a name of the form
|
|
|
|
.IR _persistent.<UID>
|
|
|
|
in that keyring,
|
|
|
|
creates the key if it does not exist, and links it into the keyring.
|
2016-11-01 15:43:33 +00:00
|
|
|
.SH SEE ALSO
|
2016-11-01 17:12:21 +00:00
|
|
|
.ad l
|
|
|
|
.nh
|
2016-11-01 15:43:33 +00:00
|
|
|
.BR keyctl (1),
|
|
|
|
.BR keyctl (3),
|
|
|
|
.BR keyctl_get_persistent (3),
|
|
|
|
.BR keyrings (7),
|
2016-11-01 17:12:21 +00:00
|
|
|
.BR process\-keyring (7),
|
|
|
|
.BR session\-keyring (7),
|
|
|
|
.BR thread\-keyring (7),
|
|
|
|
.BR user\-keyring (7),
|
|
|
|
.BR user\-session\-keyring (7)
|