|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
|
|
Packit |
7cfc04 |
.\" Written by David Howells (dhowells@redhat.com)
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
|
|
Packit |
7cfc04 |
.\" This program is free software; you can redistribute it and/or
|
|
Packit |
7cfc04 |
.\" modify it under the terms of the GNU General Public License
|
|
Packit |
7cfc04 |
.\" as published by the Free Software Foundation; either version
|
|
Packit |
7cfc04 |
.\" 2 of the License, or (at your option) any later version.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH "USER-SESSION-KEYRING" 7 2017-03-13 Linux "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
user-session-keyring \- per-user default session keyring
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The user session keyring is a keyring used to anchor keys on behalf of a user.
|
|
Packit |
7cfc04 |
Each UID the kernel deals with has its own user session keyring that
|
|
Packit |
7cfc04 |
is shared by all processes with that UID.
|
|
Packit |
7cfc04 |
The user session keyring has a name (description) of the form
|
|
Packit |
7cfc04 |
.I _uid_ses.<UID>
|
|
Packit |
7cfc04 |
where
|
|
Packit |
7cfc04 |
.I <UID>
|
|
Packit |
7cfc04 |
is the user ID of the corresponding user.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The user session keyring is associated with the record that
|
|
Packit |
7cfc04 |
the kernel maintains for the UID.
|
|
Packit |
7cfc04 |
It comes into existence upon the first attempt to access either the
|
|
Packit |
7cfc04 |
user session keyring, the
|
|
Packit |
7cfc04 |
.BR user-keyring (7),
|
|
Packit |
7cfc04 |
or the
|
|
Packit |
7cfc04 |
.BR session-keyring (7).
|
|
Packit |
7cfc04 |
.\" Davis Howells: the user and user-session keyrings are managed as a pair.
|
|
Packit |
7cfc04 |
The keyring remains pinned in existence so long as there are processes
|
|
Packit |
7cfc04 |
running with that real UID or files opened by those processes remain open.
|
|
Packit |
7cfc04 |
(The keyring can also be pinned indefinitely by linking it
|
|
Packit |
7cfc04 |
into another keyring.)
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The user session keyring is created on demand when a thread requests it
|
|
Packit |
7cfc04 |
or when a thread asks for its
|
|
Packit |
7cfc04 |
.BR session-keyring (7)
|
|
Packit |
7cfc04 |
and that keyring doesn't exist.
|
|
Packit |
7cfc04 |
In the latter case, a user session keyring will be created and,
|
|
Packit |
7cfc04 |
if the session keyring wasn't to be created,
|
|
Packit |
7cfc04 |
the user session keyring will be set as the process's actual session keyring.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The user session keyring is searched by
|
|
Packit |
7cfc04 |
.BR request_key (2)
|
|
Packit |
7cfc04 |
if the actual session keyring does not exist and is ignored otherwise.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A special serial number value,
|
|
Packit |
7cfc04 |
.BR KEY_SPEC_USER_SESSION_KEYRING ,
|
|
Packit |
7cfc04 |
is defined
|
|
Packit |
7cfc04 |
that can be used in lieu of the actual serial number of
|
|
Packit |
7cfc04 |
the calling process's user session keyring.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
From the
|
|
Packit |
7cfc04 |
.BR keyctl (1)
|
|
Packit |
7cfc04 |
utility, '\fB@us\fP' can be used instead of a numeric key ID in
|
|
Packit |
7cfc04 |
much the same way.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
User session keyrings are independent of
|
|
Packit |
7cfc04 |
.BR clone (2),
|
|
Packit |
7cfc04 |
.BR fork (2),
|
|
Packit |
7cfc04 |
.BR vfork (2),
|
|
Packit |
7cfc04 |
.BR execve (2),
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR _exit (2)
|
|
Packit |
7cfc04 |
excepting that the keyring is destroyed when the UID record is destroyed
|
|
Packit |
7cfc04 |
when the last process pinning it exits.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
If a user session keyring does not exist when it is accessed,
|
|
Packit |
7cfc04 |
it will be created.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Rather than relying on the user session keyring,
|
|
Packit |
7cfc04 |
it is strongly recommended\(emespecially if the process
|
|
Packit |
7cfc04 |
is running as root\(emthat a
|
|
Packit |
7cfc04 |
.BR session-keyring (7)
|
|
Packit |
7cfc04 |
be set explicitly, for example by
|
|
Packit |
7cfc04 |
.BR pam_keyinit (8).
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
The user session keyring was added to support situations where
|
|
Packit |
7cfc04 |
a process doesn't have a session keyring,
|
|
Packit |
7cfc04 |
perhaps because it was created via a pathway that didn't involve PAM
|
|
Packit |
7cfc04 |
(e.g., perhaps it was a daemon started by
|
|
Packit |
7cfc04 |
.BR inetd (8)).
|
|
Packit |
7cfc04 |
In such a scenario, the user session keyring acts as a substitute for the
|
|
Packit |
7cfc04 |
.BR session-keyring (7).
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.ad l
|
|
Packit |
7cfc04 |
.nh
|
|
Packit |
7cfc04 |
.BR keyctl (1),
|
|
Packit |
7cfc04 |
.BR keyctl (3),
|
|
Packit |
7cfc04 |
.BR keyrings (7),
|
|
Packit |
7cfc04 |
.BR persistent\-keyring (7),
|
|
Packit |
7cfc04 |
.BR process\-keyring (7),
|
|
Packit |
7cfc04 |
.BR session\-keyring (7),
|
|
Packit |
7cfc04 |
.BR thread\-keyring (7),
|
|
Packit |
7cfc04 |
.BR user\-keyring (7)
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|