source: postlfs/security/shadow.xml@ b907020

11.0 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 upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since b907020 was b907020, checked in by Bruce Dubbs <bdubbs@…>, 3 years ago

Update shadow-4.9 stats

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