Skip to content

Commit fc89f88

Browse files
committed
man: document new pam_systemd features in man page
This also updates the suggested PAM snippet in a number of way: 1. Be closer to the logic nowadays implemented in Fedora where the auth/account/password stacks are all finished off with pam_{deny|permit}.so 2. Make pam_unix.so just "sufficient" instead of "required" (paving ground for pam_systemd_home.so being hooked in as additional sufficient module. 3. Only do pam_nologin in the "account" stack, since it's about account validity really. 4. Use modern parameters to pam_unix when changing passwords, i.e. sha512 and shadow, and use already set up passwords (preparing ground for pam_systemd_home again)
1 parent f9c1f4e commit fc89f88

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

man/pam_systemd.xml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
3333
and hence the systemd control group hierarchy.</para>
3434

35+
<para>The module also applies various resource management and runtime parameters to the new session, as
36+
configured in the <ulink url="https://systemd.io/USER_RECORD">JSON User Record</ulink> of the user, when
37+
one is defined.</para>
38+
3539
<para>On login, this module — in conjunction with <filename>systemd-logind.service</filename> — ensures the
3640
following:</para>
3741

@@ -48,7 +52,12 @@
4852
<listitem><para>A new systemd scope unit is created for the session. If this is the first concurrent session of
4953
the user, an implicit per-user slice unit below <filename>user.slice</filename> is automatically created and the
5054
scope placed into it. An instance of the system service <filename>user@.service</filename>, which runs the
51-
systemd user manager instance, is started. </para></listitem>
55+
systemd user manager instance, is started.</para></listitem>
56+
57+
<listitem><para>The <literal>$TZ</literal>, <literal>$EMAIL</literal> and <literal>$LANG</literal>
58+
environment variables are configured for the user, based on the respective data from the user's JSON
59+
record (if it is defined). Moreover, any environment variables explicitly configured in the user record
60+
are imported, and the umask, nice level, and resource limits initialized.</para></listitem>
5261
</orderedlist>
5362

5463
<para>On logout, this module ensures the following:</para>
@@ -172,6 +181,15 @@
172181
is not set if the current user is not the original user of the session.</para></listitem>
173182
</varlistentry>
174183

184+
<varlistentry>
185+
<term><varname>$TZ</varname></term>
186+
<term><varname>$EMAIL</varname></term>
187+
<term><varname>$LANG</varname></term>
188+
189+
<listitem><para>If a JSON user record is known for the user logging in these variables are
190+
initialized from the respective data in the record.</para></listitem>
191+
</varlistentry>
192+
175193
</variablelist>
176194

177195
<para>The following environment variables are read by the module and may be used by the PAM service to pass
@@ -286,14 +304,23 @@ pam_set_data(handle, "systemd.runtime_max_sec", (void *)"3600", cleanup);
286304
<refsect1>
287305
<title>Example</title>
288306

307+
<para>Here's an example PAM configuration fragment that allows users sessions to be managed by
308+
<filename>systemd-logind.service</filename>:</para>
309+
289310
<programlisting>#%PAM-1.0
290-
auth required pam_unix.so
291-
auth required pam_nologin.so
292-
account required pam_unix.so
293-
password required pam_unix.so
294-
session required pam_unix.so
295-
session required pam_loginuid.so
296-
session required pam_systemd.so</programlisting>
311+
auth sufficient pam_unix.so
312+
auth required pam_deny.so
313+
314+
account required pam_nologin.so
315+
account sufficient pam_unix.so
316+
account required pam_permit.so
317+
318+
password sufficient pam_unix.so sha512 shadow try_first_pass try_authtok
319+
password required pam_deny.so
320+
321+
-session optional pam_loginuid.so
322+
-session optional pam_systemd.so
323+
session required pam_unix.so</programlisting>
297324
</refsect1>
298325

299326
<refsect1>
@@ -303,6 +330,7 @@ session required pam_systemd.so</programlisting>
303330
<citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
304331
<citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
305332
<citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
333+
<citerefentry><refentrytitle>pam_systemd_home</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
306334
<citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
307335
<citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
308336
<citerefentry project='man-pages'><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry>,

0 commit comments

Comments
 (0)