[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[b4b71892] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
[17fb537e] | 6 |
|
---|
| 7 | <!ENTITY shadow-download-http " ">
|
---|
[4fcf20a5] | 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">
|
---|
[b4b71892] | 13 | ]>
|
---|
| 14 |
|
---|
[17fb537e] | 15 | <sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
|
---|
[322f172] | 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 &&
|
---|
[c53fc5f6] | 81 | ./configure --libdir=/lib --enable-shared \
|
---|
[4fcf20a5] | 82 | --with-libpam --without-libcrack &&
|
---|
| 83 | sed -i 's/groups$(EXEEXT) //' src/Makefile &&
|
---|
| 84 | sed -i '/groups/d' man/Makefile &&
|
---|
[322f172] | 85 | make</userinput></screen>
|
---|
[17fb537e] | 86 |
|
---|
[322f172] | 87 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[17fb537e] | 88 |
|
---|
[322f172] | 89 | <screen role="root"><userinput>make install &&
|
---|
[4fcf20a5] | 90 | mv -v /usr/bin/passwd /bin &&
|
---|
| 91 | mv -v /lib/libshadow.*a /usr/lib &&
|
---|
| 92 | rm -v /lib/libshadow.so &&
|
---|
[322f172] | 93 | ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
|
---|
[b4b71892] | 94 |
|
---|
[322f172] | 95 | </sect2>
|
---|
[b4b71892] | 96 |
|
---|
[322f172] | 97 | <sect2 role="commands">
|
---|
| 98 | <title>Command Explanations</title>
|
---|
[b4b71892] | 99 |
|
---|
[322f172] | 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>
|
---|
[b4b71892] | 105 |
|
---|
[322f172] | 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>
|
---|
[39975e9] | 110 |
|
---|
[322f172] | 111 | </sect2>
|
---|
[b4b71892] | 112 |
|
---|
[322f172] | 113 | <sect2 role="configuration">
|
---|
| 114 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 115 |
|
---|
[322f172] | 116 | <sect3 id="pam.d">
|
---|
| 117 | <title>Config Files</title>
|
---|
[b4b71892] | 118 |
|
---|
[322f172] | 119 | <para><filename>/etc/pam.d/*</filename>, or alternatively,
|
---|
| 120 | <filename>/etc/pam.conf</filename></para>
|
---|
[b4b71892] | 121 |
|
---|
[322f172] | 122 | <indexterm zone="shadow pam.d">
|
---|
| 123 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 124 | </indexterm>
|
---|
[2197589] | 125 |
|
---|
[322f172] | 126 | <indexterm zone="shadow pam.d">
|
---|
| 127 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 128 | </indexterm>
|
---|
[4fcf20a5] | 129 |
|
---|
[322f172] | 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 > /etc/pam.d/login << "EOF"
|
---|
| 144 | <literal># Begin /etc/pam.d/login
|
---|
[4fcf20a5] | 145 |
|
---|
| 146 | auth requisite pam_securetty.so
|
---|
| 147 | auth requisite pam_nologin.so
|
---|
| 148 | auth required pam_env.so
|
---|
| 149 | auth required pam_unix.so
|
---|
| 150 | account required pam_access.so
|
---|
| 151 | account required pam_unix.so
|
---|
| 152 | session required pam_motd.so
|
---|
| 153 | session required pam_limits.so
|
---|
| 154 | session optional pam_mail.so dir=/var/mail standard
|
---|
| 155 | session optional pam_lastlog.so
|
---|
| 156 | session required pam_unix.so
|
---|
| 157 | password required pam_cracklib.so retry=3 difok=8 minlen=5 \
|
---|
| 158 | dcredit=3 ocredit=3 \
|
---|
| 159 | ucredit=2 lcredit=2
|
---|
| 160 | password required pam_unix.so md5 shadow use_authtok
|
---|
| 161 |
|
---|
[322f172] | 162 | # End /etc/pam.d/login</literal>
|
---|
| 163 | EOF</userinput></screen>
|
---|
| 164 |
|
---|
| 165 | </sect4>
|
---|
[4fcf20a5] | 166 |
|
---|
[322f172] | 167 | <sect4>
|
---|
| 168 | <title>'login' (without Cracklib)</title>
|
---|
[4fcf20a5] | 169 |
|
---|
[322f172] | 170 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 171 | <literal># Begin /etc/pam.d/login
|
---|
[b4b71892] | 172 |
|
---|
| 173 | auth requisite pam_securetty.so
|
---|
| 174 | auth requisite pam_nologin.so
|
---|
| 175 | auth required pam_env.so
|
---|
| 176 | auth required pam_unix.so
|
---|
| 177 | account required pam_access.so
|
---|
| 178 | account required pam_unix.so
|
---|
| 179 | session required pam_motd.so
|
---|
| 180 | session required pam_limits.so
|
---|
[4fcf20a5] | 181 | session optional pam_mail.so dir=/var/mail standard
|
---|
[b4b71892] | 182 | session optional pam_lastlog.so
|
---|
| 183 | session required pam_unix.so
|
---|
[4fcf20a5] | 184 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 185 |
|
---|
[322f172] | 186 | # End /etc/pam.d/login</literal>
|
---|
| 187 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 188 |
|
---|
[322f172] | 189 | </sect4>
|
---|
[4fcf20a5] | 190 |
|
---|
[322f172] | 191 | <sect4>
|
---|
| 192 | <title>'passwd' (with Cracklib)</title>
|
---|
| 193 |
|
---|
| 194 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 195 | <literal># Begin /etc/pam.d/passwd
|
---|
[b4b71892] | 196 |
|
---|
[4fcf20a5] | 197 | password required pam_cracklib.so retry=3 difok=8 minlen=5 \
|
---|
| 198 | dcredit=3 ocredit=3 \
|
---|
| 199 | ucredit=2 lcredit=2
|
---|
| 200 | password required pam_unix.so md5 shadow use_authtok
|
---|
[b4b71892] | 201 |
|
---|
[322f172] | 202 | # End /etc/pam.d/passwd</literal>
|
---|
| 203 | EOF</userinput></screen>
|
---|
| 204 |
|
---|
| 205 | </sect4>
|
---|
[b4b71892] | 206 |
|
---|
[322f172] | 207 | <sect4>
|
---|
| 208 | <title>'passwd' (without Cracklib)</title>
|
---|
[4fcf20a5] | 209 |
|
---|
[322f172] | 210 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 211 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 212 |
|
---|
| 213 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 214 |
|
---|
[322f172] | 215 | # End /etc/pam.d/passwd</literal>
|
---|
| 216 | EOF</userinput></screen>
|
---|
| 217 |
|
---|
| 218 | </sect4>
|
---|
[4fcf20a5] | 219 |
|
---|
[322f172] | 220 | <sect4>
|
---|
| 221 | <title>'su'</title>
|
---|
[4fcf20a5] | 222 |
|
---|
[322f172] | 223 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 224 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 225 |
|
---|
| 226 | auth sufficient pam_rootok.so
|
---|
| 227 | auth required pam_unix.so
|
---|
| 228 | account required pam_unix.so
|
---|
[4fcf20a5] | 229 | session optional pam_mail.so dir=/var/mail standard
|
---|
[b4b71892] | 230 | session required pam_unix.so
|
---|
| 231 |
|
---|
[322f172] | 232 | # End /etc/pam.d/su</literal>
|
---|
| 233 | EOF</userinput></screen>
|
---|
[b4b71892] | 234 |
|
---|
[322f172] | 235 | </sect4>
|
---|
[b4b71892] | 236 |
|
---|
[322f172] | 237 | <sect4>
|
---|
| 238 | <title>'chage'</title>
|
---|
| 239 |
|
---|
| 240 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
| 241 | <literal># Begin /etc/pam.d/chage
|
---|
[b4b71892] | 242 |
|
---|
| 243 | auth sufficient pam_rootok.so
|
---|
| 244 | auth required pam_unix.so
|
---|
| 245 | account required pam_unix.so
|
---|
| 246 | session required pam_unix.so
|
---|
| 247 | password required pam_permit.so
|
---|
| 248 |
|
---|
[322f172] | 249 | # End /etc/pam.d/chage</literal>
|
---|
| 250 | EOF</userinput></screen>
|
---|
| 251 |
|
---|
| 252 | </sect4>
|
---|
[b4b71892] | 253 |
|
---|
[322f172] | 254 | <sect4>
|
---|
| 255 | <title>'chpasswd', 'newusers', 'groupadd', 'groupdel',
|
---|
| 256 | 'groupmod', 'useradd', 'userdel', and 'usermod'</title>
|
---|
[39975e9] | 257 |
|
---|
[322f172] | 258 | <screen role="root"><userinput>for PROGRAM in chpasswd newusers groupadd groupdel \
|
---|
[4fcf20a5] | 259 | groupmod useradd userdel usermod
|
---|
| 260 | do
|
---|
[904f31e2] | 261 | install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
|
---|
[4fcf20a5] | 262 | sed -i -e "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
|
---|
[322f172] | 263 | done</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 > /etc/pam.d/other << "EOF"
|
---|
| 293 | <literal># Begin /etc/pam.d/other
|
---|
[b4b71892] | 294 |
|
---|
| 295 | auth required pam_deny.so
|
---|
| 296 | auth required pam_warn.so
|
---|
| 297 | account required pam_deny.so
|
---|
| 298 | session required pam_deny.so
|
---|
| 299 | password required pam_deny.so
|
---|
| 300 | password required pam_warn.so
|
---|
| 301 |
|
---|
[322f172] | 302 | # End /etc/pam.d/other</literal>
|
---|
| 303 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 304 |
|
---|
[322f172] | 305 | </sect4>
|
---|
[4fcf20a5] | 306 |
|
---|
[322f172] | 307 | <sect4 id="pam-access">
|
---|
| 308 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 309 |
|
---|
[322f172] | 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
|
---|
[4fcf20a5] | 323 | mv -v /etc/login.access /etc/login.access.NOUSE
|
---|
[322f172] | 324 | fi</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
|
---|
[4fcf20a5] | 344 | mv -v /etc/limits /etc/limits.NOUSE
|
---|
[322f172] | 345 | fi</userinput></screen>
|
---|
| 346 |
|
---|
| 347 | </sect4>
|
---|
[4fcf20a5] | 348 |
|
---|
[322f172] | 349 | <sect4 id="pam-login-defs">
|
---|
| 350 | <title>Configuring /etc/login.defs</title>
|
---|
[4fcf20a5] | 351 |
|
---|
[322f172] | 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>
|
---|
[4fcf20a5] | 357 |
|
---|
[322f172] | 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 \
|
---|
[4fcf20a5] | 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
|
---|
| 367 | do
|
---|
| 368 | sed -i -e "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[322f172] | 369 | done</userinput></screen>
|
---|
[4fcf20a5] | 370 |
|
---|
[322f172] | 371 | <para>If you have <application>cracklib</application> installed,
|
---|
| 372 | also comment out four more lines using the following command:</para>
|
---|
[4fcf20a5] | 373 |
|
---|
[322f172] | 374 | <screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
[4fcf20a5] | 375 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN
|
---|
| 376 | do
|
---|
| 377 | sed -i -e "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[322f172] | 378 | done</userinput></screen>
|
---|
| 379 |
|
---|
| 380 | </sect4>
|
---|
[b4b71892] | 381 |
|
---|
[322f172] | 382 | </sect3>
|
---|
[b4b71892] | 383 |
|
---|
[322f172] | 384 | </sect2>
|
---|
[f45b1953] | 385 |
|
---|
[322f172] | 386 | <sect2 role="content">
|
---|
| 387 | <title>Contents</title>
|
---|
[17fb537e] | 388 |
|
---|
[322f172] | 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>
|
---|
[17fb537e] | 392 |
|
---|
[322f172] | 393 | </sect2>
|
---|
[17fb537e] | 394 |
|
---|
[f45b1953] | 395 | </sect1>
|
---|