source: postlfs/security/shadow.xml@ 5b01088

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 5b01088 was 5b01088, checked in by Bruce Dubbs <bdubbs@…>, 2 years ago

Add instructions to reinstall man pages to shadow

  • Property mode set to 100644
File size: 20.6 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 "3a7936a9d0834243816fe0977c3b956e">
10 <!ENTITY shadow-size "1.6 MB">
11 <!ENTITY shadow-buildsize "38 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;
133sed -i 's/groups$(EXEEXT) //' src/Makefile.in &amp;&amp;
134
135find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; &amp;&amp;
136find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; &amp;&amp;
137find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; &amp;&amp;
138
139sed -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
140 -e 's@/var/spool/mail@/var/mail@' \
141 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
142 -i etc/login.defs &amp;&amp;
143
144./configure --sysconfdir=/etc \
145 --with-group-name-max-length=32 &amp;&amp;
146make</userinput></screen>
147
148 <para>
149 This package does not come with a test suite.
150 </para>
151
152 <para>
153 Now, as the <systemitem class="username">root</systemitem> user:
154 </para>
155
156<screen role="root"><userinput>make exec_prefix=/usr install</userinput></screen>
157
158 <para>
159 The man pages were installed in LFS, but if reinstallation is
160 desired, run (as the <systemitem class="username">root</systemitem> user):
161 </para>
162
163<screen role="root"><userinput>make -C man install-man</userinput></screen>
164
165 </sect2>
166
167 <sect2 role="commands">
168 <title>Command Explanations</title>
169
170 <para>
171 <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
172 is used to suppress the installation of the <command>groups</command>
173 program as the version from the <application>Coreutils</application>
174 package installed during LFS is preferred.
175 </para>
176
177 <para>
178 <command>find man -name Makefile.in -exec ... {} \;</command>: This
179 command is used to suppress the installation of the
180 <command>groups</command> man pages so the existing ones installed from
181 the <application>Coreutils</application> package are not replaced.
182 </para>
183
184 <para>
185 <command>sed -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
186 's@/var/spool/mail@/var/mail@' -e '/PATH=/{s@/sbin:@@;s@/bin:@@}'
187 -i etc/login.defs</command>: Instead of using
188 the default 'DES' method, this command modifies the installation to use
189 the more secure 'SHA512' method of hashing passwords, which also allows
190 passwords longer than eight characters. It also changes the obsolete
191 <filename class="directory">/var/spool/mail</filename> location for user
192 mailboxes that <application>Shadow</application> uses by default to the
193 <filename class="directory">/var/mail</filename> location. It also
194 changes the default path to be consistent with that set in LFS.
195 </para>
196
197 <para>
198 <command>sed ... libmisc/salt.c</command> and
199 <command>sed ... libsubid/Makefile.am</command>: Fix a couple of errors
200 that were found after the package was released.
201 </para>
202
203 <para>
204 <parameter>--with-group-name-max-length=32</parameter>: The maximum
205 user name is 32 characters. Make the maximum group name the same.
206 </para>
207<!--
208 <para>
209 <parameter>-\-without-su</parameter>: Don't reinstall
210 <command>su</command> because upstream recommends using the
211 <command>su</command> command from <xref linkend='util-linux'/>
212 when <application>Linux-PAM</application> is available.
213 </para>
214-->
215 </sect2>
216
217 <sect2 role="configuration">
218 <title>Configuring Shadow</title>
219
220 <para>
221 <application>Shadow</application>'s stock configuration for the
222 <command>useradd</command> utility may not be desirable for your
223 installation. One default parameter causes <command>useradd</command> to
224 create a mailbox file for any newly created user.
225 <command>useradd</command> will make the group ownership of this file to
226 the <systemitem class="groupname">mail</systemitem> group with 0660
227 permissions. If you would prefer that these mailbox files are not created
228 by <command>useradd</command>, issue the following command as the
229 <systemitem class="username">root</systemitem> user:
230 </para>
231
232<screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
233 </sect2>
234
235 <sect2 role="configuration">
236 <title>Configuring Linux-PAM to Work with Shadow</title>
237
238 <note>
239 <para>
240 The rest of this page is devoted to configuring
241 <application>Shadow</application> to work properly with
242 <application>Linux-PAM</application>. If you do not have
243 <application>Linux-PAM</application> installed, and you reinstalled
244 <application>Shadow</application> to support strong passwords via the
245 <application>CrackLib</application> library, no further configuration is
246 required.
247 </para>
248 </note>
249
250 <sect3 id="pam.d">
251 <title>Config Files</title>
252
253 <para>
254 <filename>/etc/pam.d/*</filename> or alternatively
255 <filename>/etc/pam.conf</filename>,
256 <filename>/etc/login.defs</filename> and
257 <filename>/etc/security/*</filename>
258 </para>
259
260 <indexterm zone="shadow pam.d">
261 <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
262 </indexterm>
263
264 <indexterm zone="shadow pam.d">
265 <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
266 </indexterm>
267
268 <indexterm zone="shadow pam.d">
269 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
270 </indexterm>
271
272 <indexterm zone="shadow pam.d">
273 <primary sortas="e-etc-security">/etc/security/*</primary>
274 </indexterm>
275 </sect3>
276
277 <sect3>
278 <title>Configuration Information</title>
279
280 <para>
281 Configuring your system to use <application>Linux-PAM</application> can
282 be a complex task. The information below will provide a basic setup so
283 that <application>Shadow</application>'s login and password
284 functionality will work effectively with
285 <application>Linux-PAM</application>. Review the information and links
286 on the <xref linkend="linux-pam"/> page for further configuration
287 information. For information specific to integrating
288 <application>Shadow</application>, <application>Linux-PAM</application>
289 and <application>libpwquality</application>, you can visit the
290 following link:
291 </para>
292
293 <itemizedlist spacing="compact">
294 <listitem>
295 <!-- New URL for the below link, according to it's author. -->
296 <para>
297 <ulink url="http://www.deer-run.com/~hal/linux_passwords_pam.html"/>
298 </para>
299 </listitem>
300 </itemizedlist>
301
302 <sect4 id="pam-login-defs">
303 <title>Configuring /etc/login.defs</title>
304
305 <para>
306 The <command>login</command> program currently performs many functions
307 which <application>Linux-PAM</application> modules should now handle.
308 The following <command>sed</command> command will comment out the
309 appropriate lines in <filename>/etc/login.defs</filename>, and stop
310 <command>login</command> from performing these functions (a backup
311 file named <filename>/etc/login.defs.orig</filename> is also created
312 to preserve the original file's contents). Issue the following
313 commands as the <systemitem class="username">root</systemitem> user:
314 </para>
315
316 <indexterm zone="shadow pam-login-defs">
317 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
318 </indexterm>
319
320<screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &amp;&amp;
321for FUNCTION in FAIL_DELAY \
322 FAILLOG_ENAB \
323 LASTLOG_ENAB \
324 MAIL_CHECK_ENAB \
325 OBSCURE_CHECKS_ENAB \
326 PORTTIME_CHECKS_ENAB \
327 QUOTAS_ENAB \
328 CONSOLE MOTD_FILE \
329 FTMP_FILE NOLOGINS_FILE \
330 ENV_HZ PASS_MIN_LEN \
331 SU_WHEEL_ONLY \
332 CRACKLIB_DICTPATH \
333 PASS_CHANGE_TRIES \
334 PASS_ALWAYS_WARN \
335 CHFN_AUTH ENCRYPT_METHOD \
336 ENVIRON_FILE
337do
338 sed -i "s/^${FUNCTION}/# &amp;/" /etc/login.defs
339done</userinput></screen>
340 </sect4>
341
342 <sect4>
343 <title>Configuring the /etc/pam.d/ Files</title>
344
345 <para>
346 As mentioned previously in the <application>Linux-PAM</application>
347 instructions, <application>Linux-PAM</application> has two supported
348 methods for configuration. The commands below assume that you've
349 chosen to use a directory based configuration, where each program has
350 its own configuration file. You can optionally use a single
351 <filename>/etc/pam.conf</filename> configuration file by using the
352 text from the files below, and supplying the program name as an
353 additional first field for each line.
354 </para>
355
356 <para>
357 As the <systemitem class="username">root</systemitem> user, create
358 the following <application>Linux-PAM</application> configuration files
359 in the <filename class="directory">/etc/pam.d/</filename> directory
360 (or add the contents to the <filename>/etc/pam.conf</filename> file)
361 using the following commands:
362 </para>
363 </sect4>
364
365 <sect4>
366 <title>'login'</title>
367
368<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
369<literal># Begin /etc/pam.d/login
370
371# Set failure delay before next prompt to 3 seconds
372auth optional pam_faildelay.so delay=3000000
373
374# Check to make sure that the user is allowed to login
375auth requisite pam_nologin.so
376
377# Check to make sure that root is allowed to login
378# Disabled by default. You will need to create /etc/securetty
379# file for this module to function. See man 5 securetty.
380#auth required pam_securetty.so
381
382# Additional group memberships - disabled by default
383#auth optional pam_group.so
384
385# include system auth settings
386auth include system-auth
387
388# check access for the user
389account required pam_access.so
390
391# include system account settings
392account include system-account
393
394# Set default environment variables for the user
395session required pam_env.so
396
397# Set resource limits for the user
398session required pam_limits.so
399
400# Display date of last login - Disabled by default
401#session optional pam_lastlog.so
402
403# Display the message of the day - Disabled by default
404#session optional pam_motd.so
405
406# Check user's mail - Disabled by default
407#session optional pam_mail.so standard quiet
408
409# include system session and password settings
410session include system-session
411password include system-password
412
413# End /etc/pam.d/login</literal>
414EOF</userinput></screen>
415 </sect4>
416
417 <sect4>
418 <title>'passwd'</title>
419
420<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
421<literal># Begin /etc/pam.d/passwd
422
423password include system-password
424
425# End /etc/pam.d/passwd</literal>
426EOF</userinput></screen>
427 </sect4>
428
429 <sect4>
430 <title>'su'</title>
431
432<screen role="root"><userinput>cat &gt; /etc/pam.d/su &lt;&lt; "EOF"
433<literal># Begin /etc/pam.d/su
434
435# always allow root
436auth sufficient pam_rootok.so
437
438# Allow users in the wheel group to execute su without a password
439# disabled by default
440#auth sufficient pam_wheel.so trust use_uid
441
442# include system auth settings
443auth include system-auth
444
445# limit su to users in the wheel group
446auth required pam_wheel.so use_uid
447
448# include system account settings
449account include system-account
450
451# Set default environment variables for the service user
452session required pam_env.so
453
454# include system session settings
455session include system-session
456
457# End /etc/pam.d/su</literal>
458EOF</userinput></screen>
459 </sect4>
460
461 <sect4>
462 <title>'chage'</title>
463
464<screen role="root"><userinput>cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"
465<literal># Begin /etc/pam.d/chage
466
467# always allow root
468auth sufficient pam_rootok.so
469
470# include system auth, account, and session settings
471auth include system-auth
472account include system-account
473session include system-session
474
475# Always permit for authentication updates
476password required pam_permit.so
477
478# End /etc/pam.d/chage</literal>
479EOF</userinput></screen>
480 </sect4>
481
482 <sect4>
483 <title>Other common programs</title>
484 <!--<title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd', 'groupdel',
485 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel' and
486 'usermod'</title>-->
487
488<screen role="root"><userinput>for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
489 groupmems groupmod newusers useradd userdel usermod
490do
491 install -v -m644 /etc/pam.d/chage /etc/pam.d/${PROGRAM}
492 sed -i "s/chage/$PROGRAM/" /etc/pam.d/${PROGRAM}
493done</userinput></screen>
494
495 <warning>
496 <para>
497 At this point, you should do a simple test to see if
498 <application>Shadow</application> is working as expected. Open
499 another terminal and log in as
500 <systemitem class="username">root</systemitem>, and then run
501 <command>login</command> and login as another user. If you do
502 not see any errors, then all is well and you should proceed with
503 the rest of the configuration. If you did receive errors, stop
504 now and double check the above configuration files manually.
505 Any error is the sign of an error in the above procedure.
506 You can also run the
507 test suite from the <application>Linux-PAM</application> package
508 to assist you in determining the problem. If you cannot find and
509 fix the error, you should recompile
510 <application>Shadow</application> adding the
511 <option>--without-libpam</option> switch to the
512 <command>configure</command> command in the above instructions
513 (also move the <filename>/etc/login.defs.orig</filename> backup
514 file to <filename>/etc/login.defs</filename>). If you fail to do
515 this and the errors remain, you will be unable to log into your
516 system.
517 </para>
518 </warning>
519 </sect4>
520
521 <sect4 id="pam-access">
522 <title>Configuring Login Access</title>
523
524 <para>
525 Instead of using the <filename>/etc/login.access</filename> file for
526 controlling access to the system, <application>Linux-PAM</application>
527 uses the <filename class='libraryfile'>pam_access.so</filename> module
528 along with the <filename>/etc/security/access.conf</filename> file.
529 Rename the <filename>/etc/login.access</filename> file using the
530 following command:
531 </para>
532
533 <indexterm zone="shadow pam-access">
534 <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
535 </indexterm>
536
537<screen role="root"><userinput>[ -f /etc/login.access ] &amp;&amp; mv -v /etc/login.access{,.NOUSE}</userinput></screen>
538 </sect4>
539
540 <sect4 id="pam-limits">
541 <title>Configuring Resource Limits</title>
542
543 <para>
544 Instead of using the <filename>/etc/limits</filename> file for
545 limiting usage of system resources,
546 <application>Linux-PAM</application> uses the
547 <filename class='libraryfile'>pam_limits.so</filename> module along
548 with the <filename>/etc/security/limits.conf</filename> file. Rename
549 the <filename>/etc/limits</filename> file using the following command:
550 </para>
551
552 <indexterm zone="shadow pam-limits">
553 <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
554 </indexterm>
555
556<screen role="root"><userinput>[ -f /etc/limits ] &amp;&amp; mv -v /etc/limits{,.NOUSE}</userinput></screen>
557
558 <caution>
559 <para>
560 Be sure to test the login capabilities of the system before logging
561 out. Errors in the configuration can cause a permanent
562 lockout requiring a boot from an external source to correct the
563 problem.
564 </para>
565 </caution>
566
567 </sect4>
568 </sect3>
569
570 </sect2>
571
572 <sect2 role="content">
573 <title>Contents</title>
574
575 <para>
576 A list of the installed files, along with their short descriptions can be
577 found at
578 <ulink url="&lfs-root;/chapter08/shadow.html#contents-shadow"/>.
579 </para>
580
581 </sect2>
582
583</sect1>
Note: See TracBrowser for help on using the repository browser.