source: postlfs/security/shadow.xml@ 17fb537e

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 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 17fb537e was 17fb537e, checked in by Randy McMurchy <randy@…>, 19 years ago

Added download location and build entities to Shadow instructions; misc Chapter 4 clean-up

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

  • Property mode set to 100644
File size: 9.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/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-size "814 KB">
10 <!ENTITY shadow-buildsize "14.1 MB">
11 <!ENTITY shadow-time "0.42 SBU">
12]>
13
14<sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
15<sect1info>
16<othername>$LastChangedBy$</othername>
17<date>$Date$</date>
18</sect1info>
19<?dbhtml filename="shadow.html"?>
20<title>Shadow-&shadow-version;</title>
21<indexterm zone="shadow">
22<primary sortas="a-Shadow">Shadow</primary></indexterm>
23
24<!--
25<sect2>
26<title>Configuring shadow</title>
27
28<para>Shadow's Configuration File</para>
29
30<para><userinput>/etc/login.defs</userinput></para>
31
32<para>Enabling <acronym>MD</acronym>5 Passwords</para>
33
34<para>To enable <acronym>MD</acronym>5 Passwords, modify the line in the
35<filename>login.defs</filename> file that reads:
36<screen><userinput>#MD5_CRYPT_ENAB no</userinput></screen>
37to read:
38<screen><userinput>MD5_CRYPT_ENAB yes</userinput></screen>
39Passwords created after this change will be encrypted using
40<acronym>MD</acronym>5 (Message-Digest Algorithm) instead of using
41<acronym>DES</acronym> encryption.
42</para>
43</sect2>
44-->
45
46<sect2>
47<title>Introduction to <application>Shadow</application></title>
48
49<para>Shadow was indeed installed in <acronym>LFS</acronym> and there is
50no reason to reinstall it unless you installed
51<application>Linux-<acronym>PAM</acronym></application>. If you did,
52this will allow programs like <command>login</command> and
53<command>su</command> to utilize
54<acronym>PAM</acronym>.</para>
55
56<sect3><title>Package information</title>
57<itemizedlist spacing="compact">
58<listitem><para>Download (HTTP):
59<ulink url="&shadow-download-http;"/></para></listitem>
60<listitem><para>Download (FTP):
61<ulink url="&shadow-download-ftp;"/></para></listitem>
62<listitem><para>Download size:
63&shadow-size;</para></listitem>
64<listitem><para>Estimated disk space required:
65&shadow-buildsize;</para></listitem>
66<listitem><para>Estimated build time:
67&shadow-time;</para></listitem></itemizedlist>
68</sect3>
69
70<sect3><title>Additional downloads</title>
71<itemizedlist spacing='compact'>
72<listitem><para>Patch to fix linking against PAM:
73<ulink url="&patch-root;/shadow-&shadow-version;-pam-1.patch"/></para>
74</listitem>
75</itemizedlist>
76</sect3>
77
78<sect3><title><application>Shadow</application> dependencies</title>
79<sect4><title>Required</title>
80<para><xref linkend="Linux_PAM"/></para></sect4>
81</sect3>
82</sect2>
83
84<sect2>
85<title>Installation of <application>Shadow</application></title>
86
87<para>Reinstall <application>Shadow</application> by running the following
88commands:</para>
89
90<screen><userinput><command>patch -Np1 -i ../shadow-&shadow-version;-pam-1.patch &amp;&amp;
91LIBS="-lpam -lpam_misc" ./configure --libdir=/usr/lib \
92 --enable-shared --with-libpam --without-libcrack &amp;&amp;
93echo '#define HAVE_SETLOCALE 1' >> config.h &amp;&amp;
94sed -i '/extern char/d' libmisc/xmalloc.c &amp;&amp;
95make</command></userinput></screen>
96
97<para>Now, as the root user:</para>
98
99<screen><userinput role='root'><command>make install &amp;&amp;
100mv /bin/sg /usr/bin &amp;&amp;
101mv /bin/vigr /usr/sbin &amp;&amp;
102mv /usr/bin/passwd /bin &amp;&amp;
103rm /bin/groups &amp;&amp;
104mv /usr/lib/lib{misc,shadow}.so.0* /lib &amp;&amp;
105ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so &amp;&amp;
106ln -sf ../../lib/libmisc.so.0 /usr/lib/libmisc.so</command></userinput></screen>
107
108</sect2>
109
110<sect2>
111<title>Command explanations</title>
112
113<para><parameter>--without-libcrack</parameter>: This switch tells
114<application>Shadow</application> not to use
115<filename class='libraryfile'>libcrack</filename>. This is desired as
116<application>Linux-<acronym>PAM</acronym></application> already contains
117<filename class='libraryfile'>libcrack</filename>.</para>
118
119<para><command>sed -i '/extern char/d' libmisc/xmalloc.c</command>: This
120fixes a compilation problem when using <application>GCC</application>-3.4.x.
121</para>
122
123</sect2>
124
125<sect2>
126<title>Configuring <application>Linux-<acronym>PAM</acronym></application> to
127work with <application>Shadow</application></title>
128
129<sect3 id="pam.d"><title>Config files</title>
130<para><filename>/etc/pam.d/login</filename>,
131<filename>/etc/pam.d/passwd</filename>,
132<filename>/etc/pam.d/su</filename>,
133<filename>/etc/pam.d/shadow</filename>,
134<filename>/etc/pam.d/useradd</filename>, and
135<filename>/etc/pam.d/chage</filename> &ndash;
136alternatively, <filename>/etc/pam.conf</filename></para>
137<indexterm zone="shadow pam.d">
138<primary sortas="e-etc-pam.d">/etc/pam.d/*</primary></indexterm>
139<indexterm zone="shadow pam.d">
140<primary sortas="e-etc-pam.conf">/etc/pam.conf</primary></indexterm>
141</sect3>
142
143<sect3><title>Configuration Information</title>
144
145<para>Add the following <application>Linux-<acronym>PAM</acronym></application>
146configuration files to <filename class="directory">/etc/pam.d/</filename> (or
147add them to <filename>/etc/pam.conf</filename> with the additional field for
148the program).</para>
149
150<screen><userinput><command>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"</command>
151# Begin /etc/pam.d/login
152
153auth requisite pam_securetty.so
154auth requisite pam_nologin.so
155auth required pam_env.so
156auth required pam_unix.so
157account required pam_access.so
158account required pam_unix.so
159session required pam_motd.so
160session required pam_limits.so
161session optional pam_mail.so dir=/var/mail standard
162session optional pam_lastlog.so
163session required pam_unix.so
164
165# End /etc/pam.d/login
166<command>EOF
167cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"</command>
168# Begin /etc/pam.d/passwd
169
170password required pam_unix.so md5 shadow
171
172# End /etc/pam.d/passwd
173<command>EOF
174cat &gt; /etc/pam.d/shadow &lt;&lt; "EOF"</command>
175# Begin /etc/pam.d/shadow
176
177auth sufficient pam_rootok.so
178auth required pam_unix.so
179account required pam_unix.so
180session required pam_unix.so
181password required pam_permit.so
182
183# End /etc/pam.d/shadow
184<command>EOF
185cat &gt; /etc/pam.d/su &lt;&lt; "EOF"</command>
186# Begin /etc/pam.d/su
187
188auth sufficient pam_rootok.so
189auth required pam_unix.so
190account required pam_unix.so
191session required pam_unix.so
192
193# End /etc/pam.d/su
194<command>EOF
195cat &gt; /etc/pam.d/useradd &lt;&lt; "EOF"</command>
196# Begin /etc/pam.d/useradd
197
198auth sufficient pam_rootok.so
199auth required pam_unix.so
200account required pam_unix.so
201session required pam_unix.so
202password required pam_permit.so
203
204# End /etc/pam.d/useradd
205<command>EOF
206cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"</command>
207# Begin /etc/pam.d/chage
208
209auth sufficient pam_rootok.so
210auth required pam_unix.so
211account required pam_unix.so
212session required pam_unix.so
213password required pam_permit.so
214
215# End /etc/pam.d/chage
216<command>EOF</command></userinput></screen>
217
218<note><para>If you've installed <application>cracklib</application>, replace
219<filename>/etc/pam.d/passwd</filename> with the following:</para></note>
220<screen><userinput><command>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"</command>
221# Begin /etc/pam.d/passwd
222
223password required pam_cracklib.so \
224 retry=3 difok=8 minlen=5 dcredit=3 ocredit=3 ucredit=2 lcredit=2
225password required pam_unix.so md5 shadow use_authtok
226
227# End /etc/pam.d/passwd
228<command>EOF</command></userinput></screen>
229
230<warning><para>At this point, you should do a simple test to see if
231<application>Shadow</application> is
232working as expected. Open another term and login as a user, then su to
233to root. If you do not see any errors, then all is well and you should
234proceed with the rest of the configuration. If you did
235receive errors, stop now and double check the above configuration files
236manually. If you cannot find, and fix the error, you should recompile
237shadow replacing <envar>--with-libpam</envar> with
238<envar>--without-libpam</envar> in the above
239instructions. If you fail to do this and the errors remain, you
240will be unable to log into your system.</para></warning>
241
242<para>Currently, <filename>/etc/pam.d/other</filename> is configured to
243allow anyone with an account on the machine to use programs
244that do not specifically have a configuration file of their own. After
245testing <application>Linux-<acronym>PAM</acronym></application> for proper
246configuration, it can be changed to the following:</para>
247
248<screen><userinput><command>cat &gt; /etc/pam.d/other &lt;&lt; "EOF"</command>
249# Begin /etc/pam.d/other
250
251auth required pam_deny.so
252auth required pam_warn.so
253account required pam_deny.so
254session required pam_deny.so
255password required pam_deny.so
256password required pam_warn.so
257
258# End /etc/pam.d/other
259<command>EOF</command></userinput></screen>
260
261<para>Finally, edit <filename>/etc/login.defs</filename> by adding '#'
262to the beginning of the following lines:</para>
263<screen>LASTLOG_ENAB
264MAIL_CHECK_ENAB
265PORTTIME_CHECKS_ENAB
266CONSOLE
267MOTD_FILE
268NOLOGINS_FILE
269PASS_MIN_LEN
270SU_WHEEL_ONLY
271MD5_CRYPT_ENAB
272CONSOLE_GROUPS
273ENVIRON_FILE</screen>
274
275<para>This stops <command>login</command> from performing these functions, as
276they will now be performed by <acronym>PAM</acronym> modules. Additionally,
277add a '#' to the beginning of the following lines if you've installed
278<application>cracklib</application>:</para>
279<screen>OBSCURE_CHECKS_ENAB
280CRACKLIB_DICTPATH
281PASS_CHANGE_TRIES
282PASS_ALWAYS_WARN</screen>
283</sect3>
284
285</sect2>
286
287<sect2>
288<title>Contents</title>
289
290<para>A list of the installed files, along with their short descriptions can
291be found at <ulink
292url="http://www.linuxfromscratch.org/lfs/view/6.0/chapter06/shadow.html"/>.
293</para>
294
295</sect2>
296
297</sect1>
Note: See TracBrowser for help on using the repository browser.