source: postlfs/security/shadow.xml@ 07be534

11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 07be534 was 07be534, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Update to shadow-4.11.1

  • Property mode set to 100644
File size: 21.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY shadow-download-http "https://github.com/shadow-maint/shadow/releases/download/v&shadow-version;/shadow-&shadow-version;.tar.xz">
8 <!ENTITY shadow-download-ftp " ">
9 <!ENTITY shadow-md5sum "5a95ec069aa91508167d02fecafaa912">
10 <!ENTITY shadow-size "1.6 MB">
11 <!ENTITY shadow-buildsize "48 MB">
12 <!ENTITY shadow-time "0.2 SBU">
13]>
14
15<sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
16 <?dbhtml filename="shadow.html"?>
17
18 <sect1info>
19 <date>$Date$</date>
20 </sect1info>
21
22 <title>Shadow-&shadow-version;</title>
23
24 <indexterm zone="shadow">
25 <primary sortas="a-Shadow">Shadow</primary>
26 </indexterm>
27
28 <sect2 role="package">
29 <title>Introduction to Shadow</title>
30
31 <para>
32 <application>Shadow</application> was indeed installed in LFS and there is
33 no reason to reinstall it unless you installed
34 <application>CrackLib</application> or
35 <application>Linux-PAM</application> after your LFS system was completed.
36 If you have installed <application>CrackLib</application> after LFS, then
37 reinstalling <application>Shadow</application> will enable strong password
38 support. If you have installed <application>Linux-PAM</application>,
39 reinstalling <application>Shadow</application> will allow programs such as
40 <command>login</command> and <command>su</command> to utilize PAM.
41 </para>
42
43 &lfs110a_checked;
44
45 <bridgehead renderas="sect3">Package Information</bridgehead>
46 <itemizedlist spacing="compact">
47 <listitem>
48 <para>
49 Download (HTTP): <ulink url="&shadow-download-http;"/>
50 </para>
51 </listitem>
52 <listitem>
53 <para>
54 Download (FTP): <ulink url="&shadow-download-ftp;"/>
55 </para>
56 </listitem>
57 <listitem>
58 <para>
59 Download MD5 sum: &shadow-md5sum;
60 </para>
61 </listitem>
62 <listitem>
63 <para>
64 Download size: &shadow-size;
65 </para>
66 </listitem>
67 <listitem>
68 <para>
69 Estimated disk space required: &shadow-buildsize;
70 </para>
71 </listitem>
72 <listitem>
73 <para>
74 Estimated build time: &shadow-time;
75 </para>
76 </listitem>
77 </itemizedlist>
78<!--
79 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
80 <itemizedlist spacing="compact">
81 <listitem>
82 <para>
83 Required patch:
84 <ulink url="&patch-root;/shadow-&shadow-version;-useradd_segfault-1.patch"/>
85 </para>
86 </listitem>
87 </itemizedlist>
88-->
89 <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
90
91 <bridgehead renderas="sect4">Required</bridgehead>
92 <para role="required">
93 <xref linkend="linux-pam"/> or
94 <xref role="nodep" linkend="cracklib"/>
95 </para>
96
97 <para condition="html" role="usernotes">
98 User Notes: <ulink url="&blfs-wiki;/shadow"/>
99 </para>
100 </sect2>
101
102 <sect2 role="installation">
103 <title>Installation of Shadow</title>
104
105 <important>
106 <para>
107 The installation commands shown below are for installations where
108 <application>Linux-PAM</application> has been installed and
109 <application>Shadow</application> is being reinstalled to support the
110 <application>Linux-PAM</application> installation.
111 </para>
112
113 <para>
114 If you are reinstalling <application>Shadow</application> to provide
115 strong password support using the <application>CrackLib</application>
116 library without using <application>Linux-PAM</application>, ensure you
117 add the <parameter>--with-libcrack</parameter> parameter to the
118 <command>configure</command> script below and also issue the following
119 command:
120 </para>
121
122<screen role="nodump"><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
123 </important>
124
125 <para>
126 Reinstall <application>Shadow</application> by running the following
127 commands:
128 </para>
129<!--
130<screen><userinput>patch -Np1 -i ../shadow-4.10-useradd_segfault-1.patch &amp;&amp;
131
132sed -i "224s/rounds/min_rounds/" libmisc/salt.c &amp;&amp;
133-->
134<screen><userinput>sed -i 's/groups$(EXEEXT) //' src/Makefile.in &amp;&amp;
135
136find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; &amp;&amp;
137find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; &amp;&amp;
138find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; &amp;&amp;
139
140sed -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
141 -e 's@/var/spool/mail@/var/mail@' \
142 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
143 -i etc/login.defs &amp;&amp;
144
145./configure --sysconfdir=/etc \
146 --with-group-name-max-length=32 &amp;&amp;
147make</userinput></screen>
148
149 <para>
150 This package does not come with a test suite.
151 </para>
152
153 <para>
154 Now, as the <systemitem class="username">root</systemitem> user:
155 </para>
156
157<screen role="root"><userinput>make exec_prefix=/usr install</userinput></screen>
158
159 <para>
160 The man pages were installed in LFS, but if reinstallation is
161 desired, run (as the <systemitem class="username">root</systemitem> user):
162 </para>
163
164<screen role="root"><userinput>make -C man install-man</userinput></screen>
165
166 </sect2>
167
168 <sect2 role="commands">
169 <title>Command Explanations</title>
170
171 <para>
172 <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
173 is used to suppress the installation of the <command>groups</command>
174 program as the version from the <application>Coreutils</application>
175 package installed during LFS is preferred.
176 </para>
177
178 <para>
179 <command>find man -name Makefile.in -exec ... {} \;</command>: The
180 first command is used to suppress the installation of the
181 <command>groups</command> man pages so the existing ones installed from
182 the <application>Coreutils</application> package are not replaced.
183 The two other commands prevent installation of manual pages that
184 are already installed by <application>Man-pages</application> in LFS.
185 </para>
186
187 <para>
188 <command>sed -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
189 's@/var/spool/mail@/var/mail@' -e '/PATH=/{s@/sbin:@@;s@/bin:@@}'
190 -i etc/login.defs</command>: Instead of using
191 the default 'DES' method, this command modifies the installation to use
192 the more secure 'SHA512' method of hashing passwords, which also allows
193 passwords longer than eight characters. It also changes the obsolete
194 <filename class="directory">/var/spool/mail</filename> location for user
195 mailboxes that <application>Shadow</application> uses by default to the
196 <filename class="directory">/var/mail</filename> location. It also
197 changes the default path to be consistent with that set in LFS.
198 </para>
199<!--
200 <para>
201 <command>sed ... libmisc/salt.c</command> and
202 <command>sed ... libsubid/Makefile.am</command>: Fix a couple of errors
203 that were found after the package was released.
204 </para>
205-->
206 <para>
207 <parameter>--with-group-name-max-length=32</parameter>: The maximum
208 user name is 32 characters. Make the maximum group name the same.
209 </para>
210<!--
211 <para>
212 <parameter>-\-without-su</parameter>: Don't reinstall
213 <command>su</command> because upstream recommends using the
214 <command>su</command> command from <xref linkend='util-linux'/>
215 when <application>Linux-PAM</application> is available.
216 </para>
217-->
218 </sect2>
219
220<!-- Now, /etc/default/useradd is not reinstalled anymore, and this
221 configuration has been done in lfs
222 <sect2 role="configuration">
223 <title>Configuring Shadow</title>
224
225 <para>
226 <application>Shadow</application>'s stock configuration for the
227 <command>useradd</command> utility may not be desirable for your
228 installation. One default parameter causes <command>useradd</command> to
229 create a mailbox file for any newly created user.
230 <command>useradd</command> will make the group ownership of this file to
231 the <systemitem class="groupname">mail</systemitem> group with 0660
232 permissions. If you would prefer that these mailbox files are not created
233 by <command>useradd</command>, issue the following command as the
234 <systemitem class="username">root</systemitem> user:
235 </para>
236
237<screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
238 </sect2>
239-->
240 <sect2 role="configuration">
241 <title>Configuring Linux-PAM to Work with Shadow</title>
242
243 <note>
244 <para>
245 The rest of this page is devoted to configuring
246 <application>Shadow</application> to work properly with
247 <application>Linux-PAM</application>. If you do not have
248 <application>Linux-PAM</application> installed, and you reinstalled
249 <application>Shadow</application> to support strong passwords via the
250 <application>CrackLib</application> library, no further configuration is
251 required.
252 </para>
253 </note>
254
255 <sect3 id="pam.d">
256 <title>Config Files</title>
257
258 <para>
259 <filename>/etc/pam.d/*</filename> or alternatively
260 <filename>/etc/pam.conf</filename>,
261 <filename>/etc/login.defs</filename> and
262 <filename>/etc/security/*</filename>
263 </para>
264
265 <indexterm zone="shadow pam.d">
266 <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
267 </indexterm>
268
269 <indexterm zone="shadow pam.d">
270 <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
271 </indexterm>
272
273 <indexterm zone="shadow pam.d">
274 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
275 </indexterm>
276
277 <indexterm zone="shadow pam.d">
278 <primary sortas="e-etc-security">/etc/security/*</primary>
279 </indexterm>
280 </sect3>
281
282 <sect3>
283 <title>Configuration Information</title>
284
285 <para>
286 Configuring your system to use <application>Linux-PAM</application> can
287 be a complex task. The information below will provide a basic setup so
288 that <application>Shadow</application>'s login and password
289 functionality will work effectively with
290 <application>Linux-PAM</application>. Review the information and links
291 on the <xref linkend="linux-pam"/> page for further configuration
292 information. For information specific to integrating
293 <application>Shadow</application>, <application>Linux-PAM</application>
294 and <application>libpwquality</application>, you can visit the
295 following link:
296 </para>
297
298 <itemizedlist spacing="compact">
299 <listitem>
300 <!-- New URL for the below link, according to it's author. -->
301 <para>
302 <ulink url="http://www.deer-run.com/~hal/linux_passwords_pam.html"/>
303 </para>
304 </listitem>
305 </itemizedlist>
306
307 <sect4 id="pam-login-defs">
308 <title>Configuring /etc/login.defs</title>
309
310 <para>
311 The <command>login</command> program currently performs many functions
312 which <application>Linux-PAM</application> modules should now handle.
313 The following <command>sed</command> command will comment out the
314 appropriate lines in <filename>/etc/login.defs</filename>, and stop
315 <command>login</command> from performing these functions (a backup
316 file named <filename>/etc/login.defs.orig</filename> is also created
317 to preserve the original file's contents). Issue the following
318 commands as the <systemitem class="username">root</systemitem> user:
319 </para>
320
321 <indexterm zone="shadow pam-login-defs">
322 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
323 </indexterm>
324
325<screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &amp;&amp;
326for FUNCTION in FAIL_DELAY \
327 FAILLOG_ENAB \
328 LASTLOG_ENAB \
329 MAIL_CHECK_ENAB \
330 OBSCURE_CHECKS_ENAB \
331 PORTTIME_CHECKS_ENAB \
332 QUOTAS_ENAB \
333 CONSOLE MOTD_FILE \
334 FTMP_FILE NOLOGINS_FILE \
335 ENV_HZ PASS_MIN_LEN \
336 SU_WHEEL_ONLY \
337 CRACKLIB_DICTPATH \
338 PASS_CHANGE_TRIES \
339 PASS_ALWAYS_WARN \
340 CHFN_AUTH ENCRYPT_METHOD \
341 ENVIRON_FILE
342do
343 sed -i "s/^${FUNCTION}/# &amp;/" /etc/login.defs
344done</userinput></screen>
345 </sect4>
346
347 <sect4>
348 <title>Configuring the /etc/pam.d/ Files</title>
349
350 <para>
351 As mentioned previously in the <application>Linux-PAM</application>
352 instructions, <application>Linux-PAM</application> has two supported
353 methods for configuration. The commands below assume that you've
354 chosen to use a directory based configuration, where each program has
355 its own configuration file. You can optionally use a single
356 <filename>/etc/pam.conf</filename> configuration file by using the
357 text from the files below, and supplying the program name as an
358 additional first field for each line.
359 </para>
360
361 <para>
362 As the <systemitem class="username">root</systemitem> user, create
363 the following <application>Linux-PAM</application> configuration files
364 in the <filename class="directory">/etc/pam.d/</filename> directory
365 (or add the contents to the <filename>/etc/pam.conf</filename> file)
366 using the following commands:
367 </para>
368 </sect4>
369
370 <sect4>
371 <title>'login'</title>
372
373<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
374<literal># Begin /etc/pam.d/login
375
376# Set failure delay before next prompt to 3 seconds
377auth optional pam_faildelay.so delay=3000000
378
379# Check to make sure that the user is allowed to login
380auth requisite pam_nologin.so
381
382# Check to make sure that root is allowed to login
383# Disabled by default. You will need to create /etc/securetty
384# file for this module to function. See man 5 securetty.
385#auth required pam_securetty.so
386
387# Additional group memberships - disabled by default
388#auth optional pam_group.so
389
390# include system auth settings
391auth include system-auth
392
393# check access for the user
394account required pam_access.so
395
396# include system account settings
397account include system-account
398
399# Set default environment variables for the user
400session required pam_env.so
401
402# Set resource limits for the user
403session required pam_limits.so
404
405# Display date of last login - Disabled by default
406#session optional pam_lastlog.so
407
408# Display the message of the day - Disabled by default
409#session optional pam_motd.so
410
411# Check user's mail - Disabled by default
412#session optional pam_mail.so standard quiet
413
414# include system session and password settings
415session include system-session
416password include system-password
417
418# End /etc/pam.d/login</literal>
419EOF</userinput></screen>
420 </sect4>
421
422 <sect4>
423 <title>'passwd'</title>
424
425<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
426<literal># Begin /etc/pam.d/passwd
427
428password include system-password
429
430# End /etc/pam.d/passwd</literal>
431EOF</userinput></screen>
432 </sect4>
433
434 <sect4>
435 <title>'su'</title>
436
437<screen role="root"><userinput>cat &gt; /etc/pam.d/su &lt;&lt; "EOF"
438<literal># Begin /etc/pam.d/su
439
440# always allow root
441auth sufficient pam_rootok.so
442
443# Allow users in the wheel group to execute su without a password
444# disabled by default
445#auth sufficient pam_wheel.so trust use_uid
446
447# include system auth settings
448auth include system-auth
449
450# limit su to users in the wheel group
451auth required pam_wheel.so use_uid
452
453# include system account settings
454account include system-account
455
456# Set default environment variables for the service user
457session required pam_env.so
458
459# include system session settings
460session include system-session
461
462# End /etc/pam.d/su</literal>
463EOF</userinput></screen>
464 </sect4>
465
466 <sect4>
467 <title>'chpasswd' and 'newusers'</title>
468
469<screen role="root"><userinput>cat &gt; /etc/pam.d/chpasswd &lt;&lt; "EOF"
470<literal># Begin /etc/pam.d/chpasswd
471
472# always allow root
473auth sufficient pam_rootok.so
474
475# include system auth and account settings
476auth include system-auth
477account include system-account
478password include system-password
479
480# End /etc/pam.d/chpasswd</literal>
481EOF
482
483sed -e s/chpasswd/newusers/ /etc/pam.d/chpasswd >/etc/pam.d/newusers</userinput></screen>
484 </sect4>
485
486 <sect4>
487 <title>'chage'</title>
488
489<screen role="root"><userinput>cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"
490<literal># Begin /etc/pam.d/chage
491
492# always allow root
493auth sufficient pam_rootok.so
494
495# include system auth and account settings
496auth include system-auth
497account include system-account
498
499# End /etc/pam.d/chage</literal>
500EOF</userinput></screen>
501 </sect4>
502
503 <sect4>
504 <title>Other shadow utilities</title>
505
506<screen role="root"><userinput>for PROGRAM in chfn chgpasswd chsh groupadd groupdel \
507 groupmems groupmod useradd userdel usermod
508do
509 install -v -m644 /etc/pam.d/chage /etc/pam.d/${PROGRAM}
510 sed -i "s/chage/$PROGRAM/" /etc/pam.d/${PROGRAM}
511done</userinput></screen>
512
513 <warning>
514 <para>
515 At this point, you should do a simple test to see if
516 <application>Shadow</application> is working as expected. Open
517 another terminal and log in as
518 <systemitem class="username">root</systemitem>, and then run
519 <command>login</command> and login as another user. If you do
520 not see any errors, then all is well and you should proceed with
521 the rest of the configuration. If you did receive errors, stop
522 now and double check the above configuration files manually.
523 Any error is the sign of an error in the above procedure.
524 You can also run the
525 test suite from the <application>Linux-PAM</application> package
526 to assist you in determining the problem. If you cannot find and
527 fix the error, you should recompile
528 <application>Shadow</application> adding the
529 <option>--without-libpam</option> switch to the
530 <command>configure</command> command in the above instructions
531 (also move the <filename>/etc/login.defs.orig</filename> backup
532 file to <filename>/etc/login.defs</filename>). If you fail to do
533 this and the errors remain, you will be unable to log into your
534 system.
535 </para>
536 </warning>
537 </sect4>
538
539 <sect4 id="pam-access">
540 <title>Configuring Login Access</title>
541
542 <para>
543 Instead of using the <filename>/etc/login.access</filename> file for
544 controlling access to the system, <application>Linux-PAM</application>
545 uses the <filename class='libraryfile'>pam_access.so</filename> module
546 along with the <filename>/etc/security/access.conf</filename> file.
547 Rename the <filename>/etc/login.access</filename> file using the
548 following command:
549 </para>
550
551 <indexterm zone="shadow pam-access">
552 <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
553 </indexterm>
554
555<screen role="root"><userinput>[ -f /etc/login.access ] &amp;&amp; mv -v /etc/login.access{,.NOUSE}</userinput></screen>
556 </sect4>
557
558 <sect4 id="pam-limits">
559 <title>Configuring Resource Limits</title>
560
561 <para>
562 Instead of using the <filename>/etc/limits</filename> file for
563 limiting usage of system resources,
564 <application>Linux-PAM</application> uses the
565 <filename class='libraryfile'>pam_limits.so</filename> module along
566 with the <filename>/etc/security/limits.conf</filename> file. Rename
567 the <filename>/etc/limits</filename> file using the following command:
568 </para>
569
570 <indexterm zone="shadow pam-limits">
571 <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
572 </indexterm>
573
574<screen role="root"><userinput>[ -f /etc/limits ] &amp;&amp; mv -v /etc/limits{,.NOUSE}</userinput></screen>
575
576 <caution>
577 <para>
578 Be sure to test the login capabilities of the system before logging
579 out. Errors in the configuration can cause a permanent
580 lockout requiring a boot from an external source to correct the
581 problem.
582 </para>
583 </caution>
584
585 </sect4>
586 </sect3>
587
588 </sect2>
589
590 <sect2 role="content">
591 <title>Contents</title>
592
593 <para>
594 A list of the installed files, along with their short descriptions can be
595 found at
596 <ulink url="&lfs-root;/chapter08/shadow.html#contents-shadow"/>.
597 </para>
598
599 </sect2>
600
601</sect1>
Note: See TracBrowser for help on using the repository browser.