| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="pam_systemd_loadkey" conditional='HAVE_PAM' xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>pam_systemd_loadkey</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>pam_systemd_loadkey</refentrytitle> |
| 15 |
<manvolnum>8</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>pam_systemd_loadkey</refname> |
| 20 |
<refpurpose>Read password from kernel keyring and set it as PAM authtok</refpurpose> |
| 21 |
</refnamediv> |
| 22 |
|
| 23 |
<refsynopsisdiv> |
| 24 |
<para><filename>pam_systemd_loadkey.so</filename></para> |
| 25 |
</refsynopsisdiv> |
| 26 |
|
| 27 |
<refsect1> |
| 28 |
<title>Description</title> |
| 29 |
|
| 30 |
<para><command>pam_systemd_loadkey</command> reads a NUL-separated password list from the kernel keyring, |
| 31 |
and sets the last password in the list as the PAM authtok, which can be used by e.g. |
| 32 |
<citerefentry project='man-pages'><refentrytitle>pam_get_authtok</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
| 33 |
</para> |
| 34 |
|
| 35 |
<para>The password list is supposed to be stored in the "user" keyring of the root user, |
| 36 |
by an earlier call to |
| 37 |
<citerefentry><refentrytitle>systemd-ask-password</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 38 |
with <option>--keyname=</option>. |
| 39 |
You can pass the keyname to <command>pam_systemd_loadkey</command> via the <option>keyname=</option> option.</para> |
| 40 |
|
| 41 |
</refsect1> |
| 42 |
|
| 43 |
<refsect1> |
| 44 |
<title>Options</title> |
| 45 |
|
| 46 |
<para>The following options are understood:</para> |
| 47 |
|
| 48 |
<variablelist class='pam-directives'> |
| 49 |
|
| 50 |
<varlistentry> |
| 51 |
<term><varname>keyname=</varname></term> |
| 52 |
|
| 53 |
<listitem><para>Takes a string argument which sets the keyname to read. |
| 54 |
The default is <literal>cryptsetup</literal>. |
| 55 |
During boot, |
| 56 |
<citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 57 |
stores a passphrase or PIN in the keyring. |
| 58 |
The LUKS2 volume key can also be used, via the <option>link-volume-key</option> option in |
| 59 |
<citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
| 60 |
|
| 61 |
<table> |
| 62 |
<title> |
| 63 |
Possible values for <varname>keyname</varname>. |
| 64 |
</title> |
| 65 |
|
| 66 |
<tgroup cols='2'> |
| 67 |
<colspec colname='value' /> |
| 68 |
<colspec colname='description' /> |
| 69 |
<thead> |
| 70 |
<row> |
| 71 |
<entry>Value</entry> |
| 72 |
<entry>Description</entry> |
| 73 |
</row> |
| 74 |
</thead> |
| 75 |
<tbody> |
| 76 |
<row> |
| 77 |
<entry>cryptsetup</entry> |
| 78 |
<entry>Passphrase or recovery key</entry> |
| 79 |
</row> |
| 80 |
<row> |
| 81 |
<entry>fido2-pin</entry> |
| 82 |
<entry>Security token PIN</entry> |
| 83 |
</row> |
| 84 |
<row> |
| 85 |
<entry>luks2-pin</entry> |
| 86 |
<entry>LUKS2 token PIN</entry> |
| 87 |
</row> |
| 88 |
<row> |
| 89 |
<entry>tpm2-pin</entry> |
| 90 |
<entry>TPM2 PIN</entry> |
| 91 |
</row> |
| 92 |
</tbody> |
| 93 |
</tgroup> |
| 94 |
</table> |
| 95 |
|
| 96 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 97 |
</varlistentry> |
| 98 |
|
| 99 |
<varlistentry> |
| 100 |
<term><varname>debug</varname></term> |
| 101 |
|
| 102 |
<listitem><para>The module will log debugging information as it operates.</para> |
| 103 |
|
| 104 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 105 |
</varlistentry> |
| 106 |
</variablelist> |
| 107 |
</refsect1> |
| 108 |
|
| 109 |
<refsect1> |
| 110 |
<title>Example</title> |
| 111 |
|
| 112 |
<para>This module is intended to be used when you use LUKS with a passphrase, enable autologin in the display |
| 113 |
manager, and want to unlock Gnome Keyring / KDE KWallet automatically. So in total, you only enter one password |
| 114 |
during boot.</para> |
| 115 |
|
| 116 |
<para>You need to set the password of your Gnome Keyring/KWallet to the same as your LUKS passphrase. |
| 117 |
Then add the following lines to your display manager's PAM config under <filename>/etc/pam.d/</filename> (e.g. |
| 118 |
<filename>sddm-autologin</filename>):</para> |
| 119 |
|
| 120 |
<programlisting> |
| 121 |
-auth optional pam_systemd_loadkey.so |
| 122 |
-auth optional pam_gnome_keyring.so |
| 123 |
-session optional pam_gnome_keyring.so auto_start |
| 124 |
-session optional pam_kwallet5.so auto_start |
| 125 |
</programlisting> |
| 126 |
|
| 127 |
<para>And add the following lines to your display manager's systemd service file, so it can access root's keyring:</para> |
| 128 |
|
| 129 |
<programlisting> |
| 130 |
[Service] |
| 131 |
KeyringMode=inherit |
| 132 |
</programlisting> |
| 133 |
|
| 134 |
<para>In this setup, early during the boot process, |
| 135 |
<citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 136 |
will ask for the passphrase and store it in the kernel keyring with the keyname <literal>cryptsetup</literal>. |
| 137 |
Then when the display manager does the autologin, <command>pam_systemd_loadkey</command> will read the passphrase |
| 138 |
from the kernel keyring, set it as the PAM authtok, and then <command>pam_gnome_keyring</command> and |
| 139 |
<command>pam_kwallet5</command> will unlock with the same passphrase.</para> |
| 140 |
</refsect1> |
| 141 |
|
| 142 |
</refentry> |