source: postlfs/security/shadow.xml@ 322f172

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.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 322f172 was 322f172, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Tagged shadow.xml

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

  • Property mode set to 100644
File size: 13.4 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 " ">
8 <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
9 <!ENTITY shadow-md5sum "89ebec0d1c0d861a5bd5c4c63e5cb0cc">
10 <!ENTITY shadow-size "1.0 MB">
11 <!ENTITY shadow-buildsize "13.2 MB">
12 <!ENTITY shadow-time "0.31 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 </sect1info>
22
23 <title>Shadow-&shadow-version;</title>
24
25 <indexterm zone="shadow">
26 <primary sortas="a-Shadow">Shadow</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to Shadow</title>
31
32 <para><application>Shadow</application> was indeed installed in LFS and
33 there is no reason to reinstall it unless you installed
34 <application>Linux-PAM</application>. If you did, this will allow programs
35 like <command>login</command> and <command>su</command> to utilize PAM.</para>
36
37 <bridgehead renderas="sect3">Package Information</bridgehead>
38 <itemizedlist spacing="compact">
39 <listitem>
40 <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
41 </listitem>
42 <listitem>
43 <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
44 </listitem>
45 <listitem>
46 <para>Download MD5 sum: &shadow-md5sum;</para>
47 </listitem>
48 <listitem>
49 <para>Download size: &shadow-size;</para>
50 </listitem>
51 <listitem>
52 <para>Estimated disk space required: &shadow-buildsize;</para>
53 </listitem>
54 <listitem>
55 <para>Estimated build time: &shadow-time;</para>
56 </listitem>
57 </itemizedlist>
58
59 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
60 <itemizedlist spacing='compact'>
61 <listitem>
62 <para>Patch to fix a bug in the <command>lastlog</command> program:
63 <ulink url="&patch-root;/shadow-&shadow-version;-fix_lastlog-1.patch"/></para>
64 </listitem>
65 </itemizedlist>
66
67 <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
68
69 <bridgehead renderas="sect4">Required</bridgehead>
70 <para><xref linkend="Linux_PAM"/></para>
71
72 </sect2>
73
74 <sect2 role="installation">
75 <title>Installation of Shadow</title>
76
77 <para>Reinstall <application>Shadow</application> by running the following
78 commands:</para>
79
80<screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-fix_lastlog-1.patch &amp;&amp;
81./configure --libdir=/lib --enable-shared \
82 --with-libpam --without-libcrack &amp;&amp;
83sed -i 's/groups$(EXEEXT) //' src/Makefile &amp;&amp;
84sed -i '/groups/d' man/Makefile &amp;&amp;
85make</userinput></screen>
86
87 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
88
89<screen role="root"><userinput>make install &amp;&amp;
90mv -v /usr/bin/passwd /bin &amp;&amp;
91mv -v /lib/libshadow.*a /usr/lib &amp;&amp;
92rm -v /lib/libshadow.so &amp;&amp;
93ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
94
95 </sect2>
96
97 <sect2 role="commands">
98 <title>Command Explanations</title>
99
100 <para><parameter>--without-libcrack</parameter>: This switch tells
101 <application>Shadow</application> not to use
102 <filename class='libraryfile'>libcrack</filename>. This is desired as
103 <application>Linux-PAM</application> already contains
104 <filename class='libraryfile'>libcrack</filename>.</para>
105
106 <para><command>sed -i ...</command>: These commands are used to suppress
107 the installation of the <command>groups</command> program as the version
108 from the <application>Coreutils</application> package installed during
109 LFS is preferred.</para>
110
111 </sect2>
112
113 <sect2 role="configuration">
114 <title>Configuring Linux-PAM to Work with Shadow</title>
115
116 <sect3 id="pam.d">
117 <title>Config Files</title>
118
119 <para><filename>/etc/pam.d/*</filename>, or alternatively,
120 <filename>/etc/pam.conf</filename></para>
121
122 <indexterm zone="shadow pam.d">
123 <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
124 </indexterm>
125
126 <indexterm zone="shadow pam.d">
127 <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
128 </indexterm>
129
130 </sect3>
131
132 <sect3>
133 <title>Configuration Information</title>
134
135 <para>Add the following <application>Linux-PAM</application> configuration
136 files to <filename class="directory">/etc/pam.d/</filename> (or add them
137 to <filename>/etc/pam.conf</filename> with the additional field for
138 the program).</para>
139
140 <sect4>
141 <title>'login' (with Cracklib)</title>
142
143<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
144<literal># Begin /etc/pam.d/login
145
146auth requisite pam_securetty.so
147auth requisite pam_nologin.so
148auth required pam_env.so
149auth required pam_unix.so
150account required pam_access.so
151account required pam_unix.so
152session required pam_motd.so
153session required pam_limits.so
154session optional pam_mail.so dir=/var/mail standard
155session optional pam_lastlog.so
156session required pam_unix.so
157password required pam_cracklib.so retry=3 difok=8 minlen=5 \
158 dcredit=3 ocredit=3 \
159 ucredit=2 lcredit=2
160password required pam_unix.so md5 shadow use_authtok
161
162# End /etc/pam.d/login</literal>
163EOF</userinput></screen>
164
165 </sect4>
166
167 <sect4>
168 <title>'login' (without Cracklib)</title>
169
170<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
171<literal># Begin /etc/pam.d/login
172
173auth requisite pam_securetty.so
174auth requisite pam_nologin.so
175auth required pam_env.so
176auth required pam_unix.so
177account required pam_access.so
178account required pam_unix.so
179session required pam_motd.so
180session required pam_limits.so
181session optional pam_mail.so dir=/var/mail standard
182session optional pam_lastlog.so
183session required pam_unix.so
184password required pam_unix.so md5 shadow
185
186# End /etc/pam.d/login</literal>
187EOF</userinput></screen>
188
189 </sect4>
190
191 <sect4>
192 <title>'passwd' (with Cracklib)</title>
193
194<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
195<literal># Begin /etc/pam.d/passwd
196
197password required pam_cracklib.so retry=3 difok=8 minlen=5 \
198 dcredit=3 ocredit=3 \
199 ucredit=2 lcredit=2
200password required pam_unix.so md5 shadow use_authtok
201
202# End /etc/pam.d/passwd</literal>
203EOF</userinput></screen>
204
205 </sect4>
206
207 <sect4>
208 <title>'passwd' (without Cracklib)</title>
209
210<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
211<literal># Begin /etc/pam.d/passwd
212
213password required pam_unix.so md5 shadow
214
215# End /etc/pam.d/passwd</literal>
216EOF</userinput></screen>
217
218 </sect4>
219
220 <sect4>
221 <title>'su'</title>
222
223<screen role="root"><userinput>cat &gt; /etc/pam.d/su &lt;&lt; "EOF"
224<literal># Begin /etc/pam.d/su
225
226auth sufficient pam_rootok.so
227auth required pam_unix.so
228account required pam_unix.so
229session optional pam_mail.so dir=/var/mail standard
230session required pam_unix.so
231
232# End /etc/pam.d/su</literal>
233EOF</userinput></screen>
234
235 </sect4>
236
237 <sect4>
238 <title>'chage'</title>
239
240<screen role="root"><userinput>cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"
241<literal># Begin /etc/pam.d/chage
242
243auth sufficient pam_rootok.so
244auth required pam_unix.so
245account required pam_unix.so
246session required pam_unix.so
247password required pam_permit.so
248
249# End /etc/pam.d/chage</literal>
250EOF</userinput></screen>
251
252 </sect4>
253
254 <sect4>
255 <title>'chpasswd', 'newusers', 'groupadd', 'groupdel',
256 'groupmod', 'useradd', 'userdel', and 'usermod'</title>
257
258<screen role="root"><userinput>for PROGRAM in chpasswd newusers groupadd groupdel \
259 groupmod useradd userdel usermod
260do
261 install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
262 sed -i -e "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
263done</userinput></screen>
264
265 </sect4>
266
267 <sect4>
268 <title>Other</title>
269
270 <warning>
271 <para>At this point, you should do a simple test to see if
272 <application>Shadow</application> is working as expected. Open
273 another term and login as a user, then su to <systemitem
274 class="username">root</systemitem>. If you do not see any errors,
275 then all is well and you should proceed with the rest of the
276 configuration. If you did receive errors, stop now and double check
277 the above configuration files manually. If you cannot find, and
278 fix the error, you should recompile <application>Shadow</application>
279 replacing <option>--with-libpam</option> with
280 <option>--without-libpam</option> in the above instructions. If you
281 fail to do this and the errors remain, you will be unable to log into
282 your system.</para>
283 </warning>
284
285 <para>Currently, <filename>/etc/pam.d/other</filename> is configured
286 to allow anyone with an account on the machine to use PAM-aware
287 programs without a configuration file for that program. After testing
288 <application>Linux-PAM</application> for proper configuration, install
289 a more restrictive <filename>other</filename> file so that
290 program-specific configuration files are required:</para>
291
292<screen role="root"><userinput>cat &gt; /etc/pam.d/other &lt;&lt; "EOF"
293<literal># Begin /etc/pam.d/other
294
295auth required pam_deny.so
296auth required pam_warn.so
297account required pam_deny.so
298session required pam_deny.so
299password required pam_deny.so
300password required pam_warn.so
301
302# End /etc/pam.d/other</literal>
303EOF</userinput></screen>
304
305 </sect4>
306
307 <sect4 id="pam-access">
308 <title>Configuring Login Access</title>
309
310 <para>Instead of using the <filename>/etc/login.access</filename>
311 file for controlling access to the system,
312 <application>Linux-PAM</application> uses the
313 <filename class='libraryfile'>pam_access.so</filename> module along
314 with the <filename>/etc/security/access.conf</filename> file. Rename
315 the <filename>/etc/login.access</filename> file using the following
316 command:</para>
317
318 <indexterm zone="shadow pam-access">
319 <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
320 </indexterm>
321
322<screen role="root"><userinput>if [ -f /etc/login.access ]; then
323 mv -v /etc/login.access /etc/login.access.NOUSE
324fi</userinput></screen>
325
326 </sect4>
327
328 <sect4 id="pam-limits">
329 <title>Configuring Resource Limits</title>
330
331 <para>Instead of using the <filename>/etc/limits</filename> file
332 for limiting usage of system resources,
333 <application>Linux-PAM</application> uses the
334 <filename class='libraryfile'>pam_limits.so</filename> module along
335 with the <filename>/etc/security/limits.conf</filename> file. Rename
336 the <filename>/etc/limits</filename> file using the following
337 command:</para>
338
339 <indexterm zone="shadow pam-limits">
340 <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
341 </indexterm>
342
343<screen role="root"><userinput>if [ -f /etc/limits ]; then
344 mv -v /etc/limits /etc/limits.NOUSE
345fi</userinput></screen>
346
347 </sect4>
348
349 <sect4 id="pam-login-defs">
350 <title>Configuring /etc/login.defs</title>
351
352 <para>The <command>login</command> program currently performs many
353 functions which <application>Linux-PAM</application> modules should
354 now handle. The following command will comment out the appropriate
355 lines in <filename>/etc/login.defs</filename>, and stop
356 <command>login</command> from performing these functions:</para>
357
358 <indexterm zone="shadow pam-login-defs">
359 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
360 </indexterm>
361
362<screen role="root"><userinput>for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
363 PORTTIME_CHECKS_ENAB CONSOLE \
364 MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
365 SU_WHEEL_ONLY MD5_CRYPT_ENAB \
366 CONSOLE_GROUPS ENVIRON_FILE
367do
368 sed -i -e "s/^$FUNCTION/# &amp;/" /etc/login.defs
369done</userinput></screen>
370
371 <para>If you have <application>cracklib</application> installed,
372 also comment out four more lines using the following command:</para>
373
374<screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
375 PASS_CHANGE_TRIES PASS_ALWAYS_WARN
376do
377 sed -i -e "s/^$FUNCTION/# &amp;/" /etc/login.defs
378done</userinput></screen>
379
380 </sect4>
381
382 </sect3>
383
384 </sect2>
385
386 <sect2 role="content">
387 <title>Contents</title>
388
389 <para>A list of the installed files, along with their short descriptions
390 can be found at
391 <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
392
393 </sect2>
394
395</sect1>
Note: See TracBrowser for help on using the repository browser.