source: postlfs/security/shadow.xml@ c6bdcb0

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since c6bdcb0 was c6bdcb0, checked in by Randy McMurchy <randy@…>, 18 years ago

Added a note to the CrackLib instructions advising to reinstall Shadow if you need strong password support without installing Linux-PAM; also modified the Shadow instructions to reflect that it needs to be reinstalled (and provided the modified commands) if CrackLib is installed without Linux-PAM

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@5740 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 17.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY shadow-download-http "http://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
8 <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
9 <!ENTITY shadow-md5sum "5c6a105d89afb0900922260e9c5650cc">
10 <!ENTITY shadow-size "1.0 MB">
11 <!ENTITY shadow-buildsize "13.6 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 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 <keywordset>
22 <keyword role="package">shadow-&shadow-version;.tar</keyword>
23 <keyword role="ftpdir">shadow</keyword>
24 </keywordset>
25 </sect1info>
26
27 <title>Shadow-&shadow-version;</title>
28
29 <indexterm zone="shadow">
30 <primary sortas="a-Shadow">Shadow</primary>
31 </indexterm>
32
33 <sect2 role="package">
34 <title>Introduction to Shadow</title>
35
36 <para><application>Shadow</application> was indeed installed in LFS and
37 there is no reason to reinstall it unless you installed
38 <application>CrackLib</application> or
39 <application>Linux-PAM</application> after your LFS system was completed.
40 If you have installed <application>CrackLib</application> after LFS, then
41 reinstalling <application>Shadow</application> will enable strong password
42 support. If you have installed <application>Linux-PAM</application>,
43 reinstalling <application>Shadow</application> will allow programs such as
44 <command>login</command> and <command>su</command> to utilize PAM.</para>
45
46 <bridgehead renderas="sect3">Package Information</bridgehead>
47 <itemizedlist spacing="compact">
48 <listitem>
49 <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
50 </listitem>
51 <listitem>
52 <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
53 </listitem>
54 <listitem>
55 <para>Download MD5 sum: &shadow-md5sum;</para>
56 </listitem>
57 <listitem>
58 <para>Download size: &shadow-size;</para>
59 </listitem>
60 <listitem>
61 <para>Estimated disk space required: &shadow-buildsize;</para>
62 </listitem>
63 <listitem>
64 <para>Estimated build time: &shadow-time;</para>
65 </listitem>
66 </itemizedlist>
67
68 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
69 <itemizedlist spacing='compact'>
70 <listitem>
71 <para>Required patch: <ulink
72 url="&patch-root;/shadow-&shadow-version;-configure_fix-1.patch"/></para>
73 </listitem>
74 </itemizedlist>
75
76 <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
77
78 <bridgehead renderas="sect4">Required</bridgehead>
79 <para role="required"><xref linkend="linux-pam"/> and/or
80 <xref linkend="cracklib"/></para>
81
82 </sect2>
83
84 <sect2 role="installation">
85 <title>Installation of Shadow</title>
86
87 <important>
88 <para>The installation shown below is for a situation where
89 <application>Linux-PAM</application> has been installed (with or
90 without a <application>CrackLib</application> installation) and
91 <application>Shadow</application> is being reinstalled to support the
92 <application>Linux-PAM</application> installation. If you are
93 reinstalling <application>Shadow</application> to provide strong
94 password support via the <application>CrackLib</application> library
95 and you have not installed <application>Linux-PAM</application>, ensure
96 you replace the <parameter>--with-libpam --without-libcrack</parameter>
97 parameters with <parameter>--with-libcrack</parameter>.</para>
98 </important>
99
100 <para>Reinstall <application>Shadow</application> by running the following
101 commands:</para>
102
103<screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-configure_fix-1.patch &amp;&amp;
104./configure --libdir=/lib --enable-shared \
105 --with-libpam --without-libcrack &amp;&amp;
106sed -i 's/groups$(EXEEXT) //' src/Makefile &amp;&amp;
107find man -name Makefile -exec sed -i '/groups/d' {} \; &amp;&amp;
108make</userinput></screen>
109
110 <para>This package does not come with a test suite.</para>
111
112 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
113
114<screen role="root"><userinput>make install &amp;&amp;
115mv -v /usr/bin/passwd /bin &amp;&amp;
116mv -v /lib/libshadow.*a /usr/lib &amp;&amp;
117rm -v /lib/libshadow.so &amp;&amp;
118ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
119
120 </sect2>
121
122 <sect2 role="commands">
123 <title>Command Explanations</title>
124
125 <para><parameter>--without-libcrack</parameter>: This switch tells
126 <application>Shadow</application> not to use
127 <filename class='libraryfile'>libcrack</filename>. This is desired as
128 <application>Linux-PAM</application> will provide
129 <filename class='libraryfile'>libcrack</filename> functionality.</para>
130
131 <para><command>sed -i ...</command>: These commands are used to suppress
132 the installation of the <command>groups</command> program and man pages
133 as the version from the <application>Coreutils</application> package
134 installed during LFS is preferred.</para>
135
136 </sect2>
137
138 <sect2 role="configuration">
139 <title>Configuring Linux-PAM to Work with Shadow</title>
140
141 <sect3 id="pam.d">
142 <title>Config Files</title>
143
144 <para><filename>/etc/pam.d/*</filename> or alternatively
145 <filename>/etc/pam.conf, /etc/login.defs and
146 /etc/security/*</filename></para>
147
148 <indexterm zone="shadow pam.d">
149 <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
150 </indexterm>
151
152 <indexterm zone="shadow pam.d">
153 <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
154 </indexterm>
155
156 <indexterm zone="shadow pam.d">
157 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
158 </indexterm>
159
160 <indexterm zone="shadow pam.d">
161 <primary sortas="e-etc-security">/etc/security/*</primary>
162 </indexterm>
163
164 </sect3>
165
166 <sect3>
167 <title>Configuration Information</title>
168
169 <sect4 id="pam-login-defs">
170 <title>Configuring /etc/login.defs</title>
171
172 <para>The <command>login</command> program currently performs many
173 functions which <application>Linux-PAM</application> modules should
174 now handle. The following <command>sed</command> command will comment
175 out the appropriate lines in <filename>/etc/login.defs</filename>, and
176 stop <command>login</command> from performing these functions (a backup
177 file named <filename>/etc/login.defs.orig</filename> is also created
178 to preserve the original file's contents). Issue the following commands
179 as the <systemitem class="username">root</systemitem> user:</para>
180
181 <indexterm zone="shadow pam-login-defs">
182 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
183 </indexterm>
184
185<screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &amp;&amp;
186for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
187 PORTTIME_CHECKS_ENAB CONSOLE \
188 MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
189 SU_WHEEL_ONLY MD5_CRYPT_ENAB \
190 CONSOLE_GROUPS ENVIRON_FILE \
191 ULIMIT ENV_TZ ENV_HZ ENV_SUPATH \
192 ENV_PATH QMAIL_DIR MAIL_DIR MAIL_FILE \
193 CHFN_AUTH FAILLOG_ENAB QUOTAS_ENAB FTMP_FILE
194do
195 sed -i "s/^$FUNCTION/# &amp;/" /etc/login.defs
196done</userinput></screen>
197
198 <para>If you have <application>CrackLib</application> installed,
199 also comment out four more lines using the following command as the
200 <systemitem class="username">root</systemitem> user:</para>
201
202<screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
203 PASS_CHANGE_TRIES PASS_ALWAYS_WARN
204do
205 sed -i "s/^$FUNCTION/# &amp;/" /etc/login.defs
206done</userinput></screen>
207
208 </sect4>
209
210 <sect4>
211 <title>Configuring the /etc/pam.d/ Files</title>
212
213 <para>Add the following <application>Linux-PAM</application> configuration
214 files to <filename class="directory">/etc/pam.d/</filename> (or add them
215 to <filename>/etc/pam.conf</filename> with the additional field for
216 the program). Issue the commands as the
217 <systemitem class="username">root</systemitem> user:</para>
218
219 </sect4>
220
221 <sect4>
222 <title>'login' (with CrackLib)</title>
223
224<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
225<literal># Begin /etc/pam.d/login
226
227auth requisite pam_securetty.so
228auth requisite pam_nologin.so
229auth required pam_unix.so
230account required pam_access.so
231account required pam_unix.so
232session required pam_env.so
233session required pam_motd.so
234session required pam_limits.so
235session optional pam_mail.so dir=/var/mail standard
236session optional pam_lastlog.so
237session required pam_unix.so
238password required pam_cracklib.so retry=3 difok=8 minlen=5 \
239 dcredit=3 ocredit=3 \
240 ucredit=2 lcredit=2
241password required pam_unix.so md5 shadow use_authtok
242
243# End /etc/pam.d/login</literal>
244EOF</userinput></screen>
245
246 </sect4>
247
248 <sect4>
249 <title>'login' (without CrackLib)</title>
250
251<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
252<literal># Begin /etc/pam.d/login
253
254auth requisite pam_securetty.so
255auth requisite pam_nologin.so
256auth required pam_env.so
257auth required pam_unix.so
258account required pam_access.so
259account required pam_unix.so
260session required pam_motd.so
261session required pam_limits.so
262session optional pam_mail.so dir=/var/mail standard
263session optional pam_lastlog.so
264session required pam_unix.so
265password required pam_unix.so md5 shadow
266
267# End /etc/pam.d/login</literal>
268EOF</userinput></screen>
269
270 </sect4>
271
272 <sect4>
273 <title>'passwd' (with CrackLib)</title>
274
275<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
276<literal># Begin /etc/pam.d/passwd
277
278password required pam_cracklib.so retry=3 difok=8 minlen=5 \
279 dcredit=3 ocredit=3 \
280 ucredit=2 lcredit=2
281password required pam_unix.so md5 shadow use_authtok
282
283# End /etc/pam.d/passwd</literal>
284EOF</userinput></screen>
285
286 </sect4>
287
288 <sect4>
289 <title>'passwd' (without CrackLib)</title>
290
291<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
292<literal># Begin /etc/pam.d/passwd
293
294password required pam_unix.so md5 shadow
295
296# End /etc/pam.d/passwd</literal>
297EOF</userinput></screen>
298
299 </sect4>
300
301 <sect4>
302 <title>'su'</title>
303
304<screen role="root"><userinput>cat &gt; /etc/pam.d/su &lt;&lt; "EOF"
305<literal># Begin /etc/pam.d/su
306
307auth sufficient pam_rootok.so
308auth required pam_unix.so
309account required pam_unix.so
310session optional pam_mail.so dir=/var/mail standard
311session required pam_env.so
312session required pam_unix.so
313
314# End /etc/pam.d/su</literal>
315EOF</userinput></screen>
316
317 </sect4>
318
319 <sect4>
320 <title>'chage'</title>
321
322<screen role="root"><userinput>cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"
323<literal># Begin /etc/pam.d/chage
324
325auth sufficient pam_rootok.so
326auth required pam_unix.so
327account required pam_unix.so
328session required pam_unix.so
329password required pam_permit.so
330
331# End /etc/pam.d/chage</literal>
332EOF</userinput></screen>
333
334 </sect4>
335
336 <sect4>
337 <title>'chpasswd', 'newusers', 'groupadd', 'groupdel',
338 'groupmod', 'useradd', 'userdel', and 'usermod'</title>
339
340<screen role="root"><userinput>for PROGRAM in chpasswd newusers groupadd groupdel \
341 groupmod useradd userdel usermod
342do
343 install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
344 sed -i "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
345done</userinput></screen>
346
347 <warning>
348 <para>At this point, you should do a simple test to see if
349 <application>Shadow</application> is working as expected. Open
350 another terminal and log in as a user, then <command>su</command> to
351 <systemitem class="username">root</systemitem>. If you do not see any
352 errors, then all is well and you should proceed with the rest of the
353 configuration. If you did receive errors, stop now and double check
354 the above configuration files manually. If you cannot find and
355 fix the error, you should recompile <application>Shadow</application>
356 replacing <option>--with-libpam</option> with
357 <option>--without-libpam</option> in the above instructions (also move
358 the <filename>/etc/login.defs.orig</filename> backup file to
359 <filename>/etc/login.defs</filename>). If you
360 fail to do this and the errors remain, you will be unable to log into
361 your system.</para>
362 </warning>
363
364 </sect4>
365
366 <sect4>
367 <title>Other</title>
368
369 <para>Currently, <filename>/etc/pam.d/other</filename> is configured
370 to allow anyone with an account on the machine to use PAM-aware
371 programs without a configuration file for that program. After testing
372 <application>Linux-PAM</application> for proper configuration, install
373 a more restrictive <filename>other</filename> file so that
374 program-specific configuration files are required:</para>
375
376<screen role="root"><userinput>cat &gt; /etc/pam.d/other &lt;&lt; "EOF"
377<literal># Begin /etc/pam.d/other
378
379auth required pam_deny.so
380auth required pam_warn.so
381account required pam_deny.so
382session required pam_deny.so
383password required pam_deny.so
384password required pam_warn.so
385
386# End /etc/pam.d/other</literal>
387EOF</userinput></screen>
388
389 </sect4>
390
391 <sect4 id="pam-access">
392 <title>Configuring Login Access</title>
393
394 <para>Instead of using the <filename>/etc/login.access</filename>
395 file for controlling access to the system,
396 <application>Linux-PAM</application> uses the
397 <filename class='libraryfile'>pam_access.so</filename> module along
398 with the <filename>/etc/security/access.conf</filename> file. Rename
399 the <filename>/etc/login.access</filename> file using the following
400 command:</para>
401
402 <indexterm zone="shadow pam-access">
403 <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
404 </indexterm>
405
406<screen role="root"><userinput>if [ -f /etc/login.access ]; then
407 mv -v /etc/login.access /etc/login.access.NOUSE
408fi</userinput></screen>
409
410 </sect4>
411
412 <sect4 id="pam-limits">
413 <title>Configuring Resource Limits</title>
414
415 <para>Instead of using the <filename>/etc/limits</filename> file
416 for limiting usage of system resources,
417 <application>Linux-PAM</application> uses the
418 <filename class='libraryfile'>pam_limits.so</filename> module along
419 with the <filename>/etc/security/limits.conf</filename> file. Rename
420 the <filename>/etc/limits</filename> file using the following
421 command:</para>
422
423 <indexterm zone="shadow pam-limits">
424 <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
425 </indexterm>
426
427<screen role="root"><userinput>if [ -f /etc/limits ]; then
428 mv -v /etc/limits /etc/limits.NOUSE
429fi</userinput></screen>
430
431 </sect4>
432
433 <sect4 id="pam-env">
434 <title>Configuring Default Environment</title>
435
436 <para>During previous configuration, several items were removed from
437 <filename>/etc/login.defs</filename>. Some of these items are now
438 controlled by the <filename class='libraryfile'>pam_env.so</filename>
439 module and the <filename>/etc/security/pam_env.conf</filename>
440 configuration file. In particular, the default path has been
441 changed. To recover your default path, execute the following
442 commands:</para>
443
444<screen role="root"><userinput>ENV_PATH=`grep '^ENV_PATH' /etc/login.defs.orig | \
445 awk '{ print $2 }' | sed 's/PATH=//'` &amp;&amp;
446echo 'PATH DEFAULT='`echo "${ENV_PATH}"`\
447' OVERRIDE=${PATH}' \
448 >> /etc/security/pam_env.conf &amp;&amp;
449unset ENV_PATH</userinput></screen>
450
451 <note>
452 <para>ENV_SUPATH is no longer supported. You must create
453 a valid <filename>/root/.bashrc</filename> file to provide a
454 modified path for the super-user.</para>
455 </note>
456
457 </sect4>
458
459 </sect3>
460
461 </sect2>
462
463 <sect2 role="content">
464 <title>Contents</title>
465
466 <para>A list of the installed files, along with their short descriptions
467 can be found at
468 <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
469
470 </sect2>
471
472</sect1>
Note: See TracBrowser for help on using the repository browser.