source: postlfs/security/shadow.xml@ 8ddd8400

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 8ddd8400 was 8ddd8400, checked in by Douglas R. Reno <renodr@…>, 2 years ago

Minor rewords/text changes for Shadow/Util-Linux

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