[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 |
|
---|
[e807ae1d] | 7 | <!-- <!ENTITY shadow-download-http "http://ftp.pld.org.pl/software/shadow/old/shadow-&shadow-version;.tar.bz2"> -->
|
---|
[62c36738] | 8 | <!-- <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2"> -->
|
---|
[e807ae1d] | 9 | <!ENTITY shadow-download-http "http://cross-lfs.org/files/packages/svn/shadow-&shadow-version;.tar.bz2">
|
---|
[62c36738] | 10 | <!ENTITY shadow-download-ftp " ">
|
---|
[e807ae1d] | 11 | <!ENTITY shadow-md5sum "e7751d46ecf219c07ae0b028ab3335c6">
|
---|
| 12 | <!ENTITY shadow-size "1.5 MB">
|
---|
| 13 | <!ENTITY shadow-buildsize "18 MB">
|
---|
[349b53dd] | 14 | <!ENTITY shadow-time "0.3 SBU">
|
---|
[b4b71892] | 15 | ]>
|
---|
| 16 |
|
---|
[17fb537e] | 17 | <sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
|
---|
[322f172] | 18 | <?dbhtml filename="shadow.html"?>
|
---|
| 19 |
|
---|
| 20 | <sect1info>
|
---|
| 21 | <othername>$LastChangedBy$</othername>
|
---|
| 22 | <date>$Date$</date>
|
---|
| 23 | </sect1info>
|
---|
| 24 |
|
---|
| 25 | <title>Shadow-&shadow-version;</title>
|
---|
| 26 |
|
---|
| 27 | <indexterm zone="shadow">
|
---|
| 28 | <primary sortas="a-Shadow">Shadow</primary>
|
---|
| 29 | </indexterm>
|
---|
| 30 |
|
---|
| 31 | <sect2 role="package">
|
---|
| 32 | <title>Introduction to Shadow</title>
|
---|
| 33 |
|
---|
| 34 | <para><application>Shadow</application> was indeed installed in LFS and
|
---|
| 35 | there is no reason to reinstall it unless you installed
|
---|
[c6bdcb0] | 36 | <application>CrackLib</application> or
|
---|
| 37 | <application>Linux-PAM</application> after your LFS system was completed.
|
---|
| 38 | If you have installed <application>CrackLib</application> after LFS, then
|
---|
| 39 | reinstalling <application>Shadow</application> will enable strong password
|
---|
| 40 | support. If you have installed <application>Linux-PAM</application>,
|
---|
| 41 | reinstalling <application>Shadow</application> will allow programs such as
|
---|
[d8684cbc] | 42 | <command>login</command> and <command>su</command> to utilize PAM.</para>
|
---|
[322f172] | 43 |
|
---|
| 44 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 45 | <itemizedlist spacing="compact">
|
---|
| 46 | <listitem>
|
---|
| 47 | <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
|
---|
| 48 | </listitem>
|
---|
| 49 | <listitem>
|
---|
| 50 | <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
|
---|
| 51 | </listitem>
|
---|
| 52 | <listitem>
|
---|
| 53 | <para>Download MD5 sum: &shadow-md5sum;</para>
|
---|
| 54 | </listitem>
|
---|
| 55 | <listitem>
|
---|
| 56 | <para>Download size: &shadow-size;</para>
|
---|
| 57 | </listitem>
|
---|
| 58 | <listitem>
|
---|
| 59 | <para>Estimated disk space required: &shadow-buildsize;</para>
|
---|
| 60 | </listitem>
|
---|
| 61 | <listitem>
|
---|
| 62 | <para>Estimated build time: &shadow-time;</para>
|
---|
| 63 | </listitem>
|
---|
| 64 | </itemizedlist>
|
---|
| 65 |
|
---|
| 66 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 67 | <itemizedlist spacing='compact'>
|
---|
| 68 | <listitem>
|
---|
[d8684cbc] | 69 | <para>Required patch: <ulink
|
---|
[e807ae1d] | 70 | url="&patch-root;/shadow-&shadow-version;-useradd_fix-2.patch"/></para>
|
---|
[322f172] | 71 | </listitem>
|
---|
| 72 | </itemizedlist>
|
---|
| 73 |
|
---|
| 74 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
| 75 |
|
---|
| 76 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[c6bdcb0] | 77 | <para role="required"><xref linkend="linux-pam"/> and/or
|
---|
| 78 | <xref linkend="cracklib"/></para>
|
---|
[322f172] | 79 |
|
---|
[3597eb6] | 80 | <para condition="html" role="usernotes">User Notes:
|
---|
| 81 | <ulink url="&blfs-wiki;/shadow"/></para>
|
---|
| 82 |
|
---|
[322f172] | 83 | </sect2>
|
---|
| 84 |
|
---|
| 85 | <sect2 role="installation">
|
---|
| 86 | <title>Installation of Shadow</title>
|
---|
| 87 |
|
---|
[c6bdcb0] | 88 | <important>
|
---|
| 89 | <para>The installation shown below is for a situation where
|
---|
| 90 | <application>Linux-PAM</application> has been installed (with or
|
---|
| 91 | without a <application>CrackLib</application> installation) and
|
---|
| 92 | <application>Shadow</application> is being reinstalled to support the
|
---|
| 93 | <application>Linux-PAM</application> installation. If you are
|
---|
| 94 | reinstalling <application>Shadow</application> to provide strong
|
---|
| 95 | password support via the <application>CrackLib</application> library
|
---|
| 96 | and you have not installed <application>Linux-PAM</application>, ensure
|
---|
[8f68b03] | 97 | you add the <parameter>--with-libcrack</parameter> parameter to the
|
---|
| 98 | <command>configure</command> script below.</para>
|
---|
[c6bdcb0] | 99 | </important>
|
---|
| 100 |
|
---|
[322f172] | 101 | <para>Reinstall <application>Shadow</application> by running the following
|
---|
| 102 | commands:</para>
|
---|
| 103 |
|
---|
[e807ae1d] | 104 | <screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-useradd_fix-2.patch &&
|
---|
| 105 |
|
---|
| 106 | ./configure --libdir=/lib \
|
---|
[71e9f62] | 107 | --sysconfdir=/etc \
|
---|
[8f68b03] | 108 | --enable-shared \
|
---|
| 109 | --without-selinux &&
|
---|
[e807ae1d] | 110 |
|
---|
[4fcf20a5] | 111 | sed -i 's/groups$(EXEEXT) //' src/Makefile &&
|
---|
[e807ae1d] | 112 | find man -name Makefile -exec sed -i 's/groups\.1 / /' {} \; &&
|
---|
[71e9f62] | 113 | sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile &&
|
---|
[8f68b03] | 114 |
|
---|
| 115 | for i in de es fi fr id it pt_BR; do
|
---|
| 116 | convert-mans UTF-8 ISO-8859-1 man/${i}/*.?
|
---|
| 117 | done &&
|
---|
| 118 |
|
---|
| 119 | for i in cs hu pl; do
|
---|
| 120 | convert-mans UTF-8 ISO-8859-2 man/${i}/*.?
|
---|
| 121 | done &&
|
---|
| 122 |
|
---|
| 123 | convert-mans UTF-8 EUC-JP man/ja/*.? &&
|
---|
| 124 | convert-mans UTF-8 KOI8-R man/ru/*.? &&
|
---|
| 125 | convert-mans UTF-8 ISO-8859-9 man/tr/*.? &&
|
---|
| 126 |
|
---|
[322f172] | 127 | make</userinput></screen>
|
---|
[17fb537e] | 128 |
|
---|
[31f3a57] | 129 | <para>This package does not come with a test suite.</para>
|
---|
| 130 |
|
---|
[322f172] | 131 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[17fb537e] | 132 |
|
---|
[322f172] | 133 | <screen role="root"><userinput>make install &&
|
---|
[4fcf20a5] | 134 | mv -v /usr/bin/passwd /bin &&
|
---|
| 135 | mv -v /lib/libshadow.*a /usr/lib &&
|
---|
| 136 | rm -v /lib/libshadow.so &&
|
---|
[322f172] | 137 | ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
|
---|
[b4b71892] | 138 |
|
---|
[322f172] | 139 | </sect2>
|
---|
[b4b71892] | 140 |
|
---|
[322f172] | 141 | <sect2 role="commands">
|
---|
| 142 | <title>Command Explanations</title>
|
---|
[b4b71892] | 143 |
|
---|
[8f68b03] | 144 | <!-- Removed the -with-libpam and -without-libcrack options from the
|
---|
| 145 | default as these are the defaults. Pam will automatically be picked
|
---|
| 146 | up if it is installed, and CrackLib won't be used unless specifically
|
---|
| 147 | requested via -with-libcrack
|
---|
| 148 | <para><parameter>-without-libcrack</parameter>: This switch tells
|
---|
[322f172] | 149 | <application>Shadow</application> not to use
|
---|
| 150 | <filename class='libraryfile'>libcrack</filename>. This is desired as
|
---|
[d8684cbc] | 151 | <application>Linux-PAM</application> will provide
|
---|
| 152 | <filename class='libraryfile'>libcrack</filename> functionality.</para>
|
---|
[8f68b03] | 153 | -->
|
---|
| 154 |
|
---|
| 155 | <para><parameter>--without-selinux</parameter>: Support for selinux is
|
---|
| 156 | enabled by default, but selinux is not built in a base LFS system. The
|
---|
| 157 | <command>configure</command> script will fail if this option is not
|
---|
| 158 | used.</para>
|
---|
| 159 |
|
---|
| 160 | <para><command>sed -i 's/groups$(EXEEXT) //' src/Makefile</command>: This
|
---|
| 161 | command is used to suppress the installation of the
|
---|
| 162 | <command>groups</command> program as the version from the
|
---|
| 163 | <application>Coreutils</application> package installed during LFS is
|
---|
| 164 | preferred.</para>
|
---|
| 165 |
|
---|
| 166 | <para><command>find man -name Makefile -exec ... {} \;</command>: This
|
---|
| 167 | command is used to suppress the installation of the
|
---|
| 168 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 169 | the <application>Coreutils</application> package are not replaced.</para>
|
---|
| 170 |
|
---|
| 171 | <para><command>sed -i -e '...' -e '...' man/Makefile</command>: This
|
---|
| 172 | command disables the installation of Chinese and Korean manual pages, since
|
---|
| 173 | <application>Man-DB</application> cannot format them properly.</para>
|
---|
| 174 |
|
---|
| 175 | <para><command>convert-mans ...</command>: These commands are used to
|
---|
| 176 | convert some of the man pages so that <application>Man-DB</application>
|
---|
[98fa7cc0] | 177 | will display them in the expected encodings.</para>
|
---|
[8f68b03] | 178 |
|
---|
| 179 | <para><command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 180 | <command>passwd</command> program may be needed during times when the
|
---|
| 181 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 182 | it is moved into the root partition.</para>
|
---|
| 183 |
|
---|
| 184 | <para><command>mv -v ...; rm -v ...; ln -v ...</command>: These commands
|
---|
| 185 | are used to move the <filename class='libraryfile'>libshadow</filename>
|
---|
| 186 | library to the root partition to support the moving of the
|
---|
| 187 | <command>passwd</command> program earlier.</para>
|
---|
[39975e9] | 188 |
|
---|
[322f172] | 189 | </sect2>
|
---|
[b4b71892] | 190 |
|
---|
[e807ae1d] | 191 | <sect2 role="configuration">
|
---|
| 192 | <title>Configuring Shadow</title>
|
---|
| 193 |
|
---|
| 194 | <para><application>Shadow</application>'s stock configuration for the
|
---|
| 195 | <command>useradd</command> utility is not suitable for LFS systems. Use the
|
---|
| 196 | following commands as the <systemitem class="username">root</systemitem>
|
---|
| 197 | user to change the default home directory for new users and prevent the
|
---|
| 198 | creation of mail spool files:</para>
|
---|
| 199 |
|
---|
| 200 | <screen role="root"><userinput>useradd -D -b /home &&
|
---|
| 201 | sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
| 202 |
|
---|
| 203 | </sect2>
|
---|
| 204 |
|
---|
[322f172] | 205 | <sect2 role="configuration">
|
---|
| 206 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 207 |
|
---|
[8f68b03] | 208 | <note>
|
---|
[eb2eccc] | 209 | <para>The rest of this page is devoted to configuring
|
---|
[8f68b03] | 210 | <application>Shadow</application> to work properly with
|
---|
| 211 | <application>Linux-PAM</application>. If you do not have
|
---|
| 212 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 213 | <application>Shadow</application> to support strong passwords via
|
---|
| 214 | the <application>CrackLib</application> library, no further configuration
|
---|
| 215 | is required.</para>
|
---|
| 216 | </note>
|
---|
| 217 |
|
---|
[322f172] | 218 | <sect3 id="pam.d">
|
---|
| 219 | <title>Config Files</title>
|
---|
[b4b71892] | 220 |
|
---|
[1ba671c] | 221 | <para><filename>/etc/pam.d/*</filename> or alternatively
|
---|
| 222 | <filename>/etc/pam.conf, /etc/login.defs and
|
---|
| 223 | /etc/security/*</filename></para>
|
---|
[b4b71892] | 224 |
|
---|
[322f172] | 225 | <indexterm zone="shadow pam.d">
|
---|
| 226 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 227 | </indexterm>
|
---|
[2197589] | 228 |
|
---|
[322f172] | 229 | <indexterm zone="shadow pam.d">
|
---|
| 230 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 231 | </indexterm>
|
---|
[4fcf20a5] | 232 |
|
---|
[1ba671c] | 233 | <indexterm zone="shadow pam.d">
|
---|
| 234 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 235 | </indexterm>
|
---|
| 236 |
|
---|
| 237 | <indexterm zone="shadow pam.d">
|
---|
| 238 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 239 | </indexterm>
|
---|
| 240 |
|
---|
[322f172] | 241 | </sect3>
|
---|
| 242 |
|
---|
| 243 | <sect3>
|
---|
| 244 | <title>Configuration Information</title>
|
---|
| 245 |
|
---|
[8f68b03] | 246 | <para>Configuring your system to use <application>Linux-PAM</application>
|
---|
| 247 | can be a complex task. The information below will provide a basic setup
|
---|
| 248 | so that <application>Shadow</application>'s login and password
|
---|
| 249 | functionality will work effectively with
|
---|
| 250 | <application>Linux-PAM</application>. Review the information and links on
|
---|
| 251 | the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 252 | information. For information specific to integrating
|
---|
| 253 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 254 | and <application>CrackLib</application>, you can visit the following
|
---|
| 255 | links:</para>
|
---|
| 256 |
|
---|
| 257 | <itemizedlist spacing="compact">
|
---|
| 258 | <listitem>
|
---|
| 259 | <para><ulink
|
---|
| 260 | url="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.3"/></para>
|
---|
| 261 | </listitem>
|
---|
| 262 | <listitem>
|
---|
| 263 | <para><ulink
|
---|
| 264 | url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/></para>
|
---|
| 265 | </listitem>
|
---|
| 266 | </itemizedlist>
|
---|
| 267 |
|
---|
[1ba671c] | 268 | <sect4 id="pam-login-defs">
|
---|
| 269 | <title>Configuring /etc/login.defs</title>
|
---|
| 270 |
|
---|
| 271 | <para>The <command>login</command> program currently performs many
|
---|
| 272 | functions which <application>Linux-PAM</application> modules should
|
---|
| 273 | now handle. The following <command>sed</command> command will comment
|
---|
| 274 | out the appropriate lines in <filename>/etc/login.defs</filename>, and
|
---|
| 275 | stop <command>login</command> from performing these functions (a backup
|
---|
| 276 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
[d8684cbc] | 277 | to preserve the original file's contents). Issue the following commands
|
---|
| 278 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[1ba671c] | 279 |
|
---|
| 280 | <indexterm zone="shadow pam-login-defs">
|
---|
| 281 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 282 | </indexterm>
|
---|
| 283 |
|
---|
| 284 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
| 285 | for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
|
---|
| 286 | PORTTIME_CHECKS_ENAB CONSOLE \
|
---|
| 287 | MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
|
---|
| 288 | SU_WHEEL_ONLY MD5_CRYPT_ENAB \
|
---|
| 289 | CONSOLE_GROUPS ENVIRON_FILE \
|
---|
| 290 | ULIMIT ENV_TZ ENV_HZ ENV_SUPATH \
|
---|
| 291 | ENV_PATH QMAIL_DIR MAIL_DIR MAIL_FILE \
|
---|
[8f68b03] | 292 | CHFN_AUTH FAILLOG_ENAB QUOTAS_ENAB FTMP_FILE \
|
---|
| 293 | OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
[71e9f62] | 294 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN ISSUE_FILE
|
---|
[1ba671c] | 295 | do
|
---|
[d8684cbc] | 296 | sed -i "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[1ba671c] | 297 | done</userinput></screen>
|
---|
| 298 |
|
---|
[8f68b03] | 299 | <!-- Moved the commenting of these four parameters into the section
|
---|
| 300 | above. If PAM is installed, it complains if these are not commented
|
---|
| 301 | regardless if CrackLib is installed.
|
---|
| 302 |
|
---|
[1ba671c] | 303 | <para>If you have <application>CrackLib</application> installed,
|
---|
[d8684cbc] | 304 | also comment out four more lines using the following command as the
|
---|
| 305 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[1ba671c] | 306 |
|
---|
| 307 | <screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
| 308 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN
|
---|
| 309 | do
|
---|
[d8684cbc] | 310 | sed -i "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[1ba671c] | 311 | done</userinput></screen>
|
---|
| 312 |
|
---|
[8f68b03] | 313 | -->
|
---|
| 314 |
|
---|
[1ba671c] | 315 | </sect4>
|
---|
| 316 |
|
---|
| 317 | <sect4>
|
---|
| 318 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 319 |
|
---|
[29f80ebc] | 320 | <para>As mentioned previously in the
|
---|
| 321 | <application>Linux-PAM</application> instructions,
|
---|
| 322 | <application>Linux-PAM</application> has two supported methods for
|
---|
| 323 | configuration. The commands below assume that you've chosen to use
|
---|
| 324 | a directory based configuration, where each program has its own
|
---|
[eb2eccc] | 325 | configuration file. You can optionally use a single
|
---|
[29f80ebc] | 326 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 327 | text from the files below, and supplying the program name as an
|
---|
[eb2eccc] | 328 | additional first field for each line.</para>
|
---|
| 329 |
|
---|
| 330 | <para>As the <systemitem class="username">root</systemitem> user,
|
---|
| 331 | create the <filename class="directory">/etc/pam.d</filename>
|
---|
| 332 | directory with the following command:</para>
|
---|
| 333 |
|
---|
[4c31e6de] | 334 | <screen role="root"><userinput>install -v -d -m755 /etc/pam.d</userinput></screen>
|
---|
[eb2eccc] | 335 |
|
---|
[29f80ebc] | 336 | <para>While still the <systemitem class="username">root</systemitem>
|
---|
| 337 | user, add the following <application>Linux-PAM</application>
|
---|
[eb2eccc] | 338 | configuration files to the
|
---|
[29f80ebc] | 339 | <filename class="directory">/etc/pam.d/</filename> directory (or
|
---|
| 340 | add the contents to the <filename>/etc/pam.conf</filename> file) with
|
---|
[eb2eccc] | 341 | the following commands:</para>
|
---|
[1ba671c] | 342 |
|
---|
| 343 | </sect4>
|
---|
[322f172] | 344 |
|
---|
| 345 | <sect4>
|
---|
[974951c] | 346 | <title>'login' (with CrackLib)</title>
|
---|
[322f172] | 347 |
|
---|
| 348 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 349 | <literal># Begin /etc/pam.d/login
|
---|
[4fcf20a5] | 350 |
|
---|
| 351 | auth requisite pam_nologin.so
|
---|
[e807ae1d] | 352 | auth required pam_securetty.so
|
---|
[4fcf20a5] | 353 | auth required pam_unix.so
|
---|
| 354 | account required pam_access.so
|
---|
| 355 | account required pam_unix.so
|
---|
[7fb0e285] | 356 | session required pam_env.so
|
---|
[4fcf20a5] | 357 | session required pam_motd.so
|
---|
| 358 | session required pam_limits.so
|
---|
| 359 | session optional pam_mail.so dir=/var/mail standard
|
---|
| 360 | session optional pam_lastlog.so
|
---|
| 361 | session required pam_unix.so
|
---|
[c0c33269] | 362 | password required pam_cracklib.so retry=3
|
---|
[4fcf20a5] | 363 | password required pam_unix.so md5 shadow use_authtok
|
---|
| 364 |
|
---|
[322f172] | 365 | # End /etc/pam.d/login</literal>
|
---|
| 366 | EOF</userinput></screen>
|
---|
| 367 |
|
---|
| 368 | </sect4>
|
---|
[4fcf20a5] | 369 |
|
---|
[322f172] | 370 | <sect4>
|
---|
[974951c] | 371 | <title>'login' (without CrackLib)</title>
|
---|
[4fcf20a5] | 372 |
|
---|
[322f172] | 373 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 374 | <literal># Begin /etc/pam.d/login
|
---|
[b4b71892] | 375 |
|
---|
| 376 | auth requisite pam_nologin.so
|
---|
[e807ae1d] | 377 | auth required pam_securetty.so
|
---|
[b4b71892] | 378 | auth required pam_env.so
|
---|
| 379 | auth required pam_unix.so
|
---|
| 380 | account required pam_access.so
|
---|
| 381 | account required pam_unix.so
|
---|
| 382 | session required pam_motd.so
|
---|
| 383 | session required pam_limits.so
|
---|
[4fcf20a5] | 384 | session optional pam_mail.so dir=/var/mail standard
|
---|
[b4b71892] | 385 | session optional pam_lastlog.so
|
---|
| 386 | session required pam_unix.so
|
---|
[4fcf20a5] | 387 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 388 |
|
---|
[322f172] | 389 | # End /etc/pam.d/login</literal>
|
---|
| 390 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 391 |
|
---|
[322f172] | 392 | </sect4>
|
---|
[4fcf20a5] | 393 |
|
---|
[322f172] | 394 | <sect4>
|
---|
[974951c] | 395 | <title>'passwd' (with CrackLib)</title>
|
---|
[322f172] | 396 |
|
---|
| 397 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 398 | <literal># Begin /etc/pam.d/passwd
|
---|
[b4b71892] | 399 |
|
---|
[c0c33269] | 400 | password required pam_cracklib.so type=Linux retry=1 \
|
---|
| 401 | difok=5 diffignore=23 minlen=9 \
|
---|
| 402 | dcredit=1 ucredit=1 lcredit=1 \
|
---|
| 403 | ocredit=1 \
|
---|
| 404 | dictpath=/lib/cracklib/pw_dict
|
---|
[4fcf20a5] | 405 | password required pam_unix.so md5 shadow use_authtok
|
---|
[b4b71892] | 406 |
|
---|
[322f172] | 407 | # End /etc/pam.d/passwd</literal>
|
---|
| 408 | EOF</userinput></screen>
|
---|
| 409 |
|
---|
[c0c33269] | 410 | <note><para>In its default configuration, owing to credits,
|
---|
| 411 | pam_cracklib will allow multiple case passwords as short as 6
|
---|
| 412 | characters, even with the <parameter>minlen</parameter> value
|
---|
| 413 | set to 11. You should review the pam_cracklib(8) man page and
|
---|
| 414 | determine if these default values are acceptable for the security
|
---|
| 415 | of your system.</para></note>
|
---|
| 416 |
|
---|
[322f172] | 417 | </sect4>
|
---|
[b4b71892] | 418 |
|
---|
[322f172] | 419 | <sect4>
|
---|
[974951c] | 420 | <title>'passwd' (without CrackLib)</title>
|
---|
[4fcf20a5] | 421 |
|
---|
[322f172] | 422 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 423 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 424 |
|
---|
| 425 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 426 |
|
---|
[322f172] | 427 | # End /etc/pam.d/passwd</literal>
|
---|
| 428 | EOF</userinput></screen>
|
---|
| 429 |
|
---|
| 430 | </sect4>
|
---|
[4fcf20a5] | 431 |
|
---|
[322f172] | 432 | <sect4>
|
---|
| 433 | <title>'su'</title>
|
---|
[4fcf20a5] | 434 |
|
---|
[322f172] | 435 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 436 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 437 |
|
---|
| 438 | auth sufficient pam_rootok.so
|
---|
| 439 | auth required pam_unix.so
|
---|
| 440 | account required pam_unix.so
|
---|
[4fcf20a5] | 441 | session optional pam_mail.so dir=/var/mail standard
|
---|
[7fb0e285] | 442 | session required pam_env.so
|
---|
[b4b71892] | 443 | session required pam_unix.so
|
---|
| 444 |
|
---|
[322f172] | 445 | # End /etc/pam.d/su</literal>
|
---|
| 446 | EOF</userinput></screen>
|
---|
[b4b71892] | 447 |
|
---|
[322f172] | 448 | </sect4>
|
---|
[b4b71892] | 449 |
|
---|
[322f172] | 450 | <sect4>
|
---|
| 451 | <title>'chage'</title>
|
---|
| 452 |
|
---|
| 453 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
| 454 | <literal># Begin /etc/pam.d/chage
|
---|
[b4b71892] | 455 |
|
---|
| 456 | auth sufficient pam_rootok.so
|
---|
| 457 | auth required pam_unix.so
|
---|
| 458 | account required pam_unix.so
|
---|
| 459 | session required pam_unix.so
|
---|
| 460 | password required pam_permit.so
|
---|
| 461 |
|
---|
[322f172] | 462 | # End /etc/pam.d/chage</literal>
|
---|
| 463 | EOF</userinput></screen>
|
---|
| 464 |
|
---|
| 465 | </sect4>
|
---|
[b4b71892] | 466 |
|
---|
[322f172] | 467 | <sect4>
|
---|
[e807ae1d] | 468 | <title>'chpasswd', 'chgpasswd', 'groupadd', 'groupdel', 'groupmems',
|
---|
| 469 | 'groupmod', 'newusers', 'useradd', 'userdel', and 'usermod'</title>
|
---|
[39975e9] | 470 |
|
---|
[e807ae1d] | 471 | <screen role="root"><userinput>for PROGRAM in chpasswd chgpasswd groupadd groupdel groupmems \
|
---|
| 472 | groupmod newusers useradd userdel usermod
|
---|
[4fcf20a5] | 473 | do
|
---|
[904f31e2] | 474 | install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
|
---|
[d8684cbc] | 475 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
|
---|
[322f172] | 476 | done</userinput></screen>
|
---|
| 477 |
|
---|
| 478 | <warning>
|
---|
| 479 | <para>At this point, you should do a simple test to see if
|
---|
| 480 | <application>Shadow</application> is working as expected. Open
|
---|
[1ba671c] | 481 | another terminal and log in as a user, then <command>su</command> to
|
---|
[974951c] | 482 | <systemitem class="username">root</systemitem>. If you do not see any
|
---|
| 483 | errors, then all is well and you should proceed with the rest of the
|
---|
[322f172] | 484 | configuration. If you did receive errors, stop now and double check
|
---|
[b65246b] | 485 | the above configuration files manually. You can also run the test
|
---|
| 486 | suite from the <application>Linux-PAM</application> package to assist
|
---|
| 487 | you in determining the problem. If you cannot find and
|
---|
[322f172] | 488 | fix the error, you should recompile <application>Shadow</application>
|
---|
| 489 | replacing <option>--with-libpam</option> with
|
---|
[1ba671c] | 490 | <option>--without-libpam</option> in the above instructions (also move
|
---|
| 491 | the <filename>/etc/login.defs.orig</filename> backup file to
|
---|
| 492 | <filename>/etc/login.defs</filename>). If you
|
---|
[322f172] | 493 | fail to do this and the errors remain, you will be unable to log into
|
---|
| 494 | your system.</para>
|
---|
| 495 | </warning>
|
---|
| 496 |
|
---|
[349b53dd] | 497 | </sect4>
|
---|
| 498 |
|
---|
| 499 | <sect4>
|
---|
| 500 | <title>Other</title>
|
---|
| 501 |
|
---|
[322f172] | 502 | <para>Currently, <filename>/etc/pam.d/other</filename> is configured
|
---|
| 503 | to allow anyone with an account on the machine to use PAM-aware
|
---|
| 504 | programs without a configuration file for that program. After testing
|
---|
| 505 | <application>Linux-PAM</application> for proper configuration, install
|
---|
| 506 | a more restrictive <filename>other</filename> file so that
|
---|
| 507 | program-specific configuration files are required:</para>
|
---|
| 508 |
|
---|
| 509 | <screen role="root"><userinput>cat > /etc/pam.d/other << "EOF"
|
---|
| 510 | <literal># Begin /etc/pam.d/other
|
---|
[b4b71892] | 511 |
|
---|
| 512 | auth required pam_deny.so
|
---|
| 513 | auth required pam_warn.so
|
---|
| 514 | account required pam_deny.so
|
---|
| 515 | session required pam_deny.so
|
---|
| 516 | password required pam_deny.so
|
---|
| 517 | password required pam_warn.so
|
---|
| 518 |
|
---|
[322f172] | 519 | # End /etc/pam.d/other</literal>
|
---|
| 520 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 521 |
|
---|
[b65246b] | 522 | <para>If you preserved the source tree from the
|
---|
| 523 | <application>Linux-PAM</application> package (or you feel like unpacking
|
---|
| 524 | that tarball, then running <command>configure</command> and
|
---|
| 525 | <command>make</command>), now would be a good time to run the test
|
---|
| 526 | suite from this package. This test suite will use the configuration you
|
---|
| 527 | just finished during the tests. All the tests should pass.</para>
|
---|
| 528 |
|
---|
[322f172] | 529 | </sect4>
|
---|
[4fcf20a5] | 530 |
|
---|
[322f172] | 531 | <sect4 id="pam-access">
|
---|
| 532 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 533 |
|
---|
[322f172] | 534 | <para>Instead of using the <filename>/etc/login.access</filename>
|
---|
| 535 | file for controlling access to the system,
|
---|
| 536 | <application>Linux-PAM</application> uses the
|
---|
| 537 | <filename class='libraryfile'>pam_access.so</filename> module along
|
---|
| 538 | with the <filename>/etc/security/access.conf</filename> file. Rename
|
---|
| 539 | the <filename>/etc/login.access</filename> file using the following
|
---|
| 540 | command:</para>
|
---|
| 541 |
|
---|
| 542 | <indexterm zone="shadow pam-access">
|
---|
| 543 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
| 544 | </indexterm>
|
---|
| 545 |
|
---|
| 546 | <screen role="root"><userinput>if [ -f /etc/login.access ]; then
|
---|
[4fcf20a5] | 547 | mv -v /etc/login.access /etc/login.access.NOUSE
|
---|
[322f172] | 548 | fi</userinput></screen>
|
---|
| 549 |
|
---|
| 550 | </sect4>
|
---|
| 551 |
|
---|
| 552 | <sect4 id="pam-limits">
|
---|
| 553 | <title>Configuring Resource Limits</title>
|
---|
| 554 |
|
---|
| 555 | <para>Instead of using the <filename>/etc/limits</filename> file
|
---|
| 556 | for limiting usage of system resources,
|
---|
| 557 | <application>Linux-PAM</application> uses the
|
---|
| 558 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
| 559 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
| 560 | the <filename>/etc/limits</filename> file using the following
|
---|
| 561 | command:</para>
|
---|
| 562 |
|
---|
| 563 | <indexterm zone="shadow pam-limits">
|
---|
| 564 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
| 565 | </indexterm>
|
---|
| 566 |
|
---|
| 567 | <screen role="root"><userinput>if [ -f /etc/limits ]; then
|
---|
[4fcf20a5] | 568 | mv -v /etc/limits /etc/limits.NOUSE
|
---|
[322f172] | 569 | fi</userinput></screen>
|
---|
| 570 |
|
---|
| 571 | </sect4>
|
---|
[4fcf20a5] | 572 |
|
---|
[7fb0e285] | 573 | <sect4 id="pam-env">
|
---|
| 574 | <title>Configuring Default Environment</title>
|
---|
| 575 |
|
---|
[bccbdaea] | 576 | <para>During previous configuration, several items were removed from
|
---|
[7fb0e285] | 577 | <filename>/etc/login.defs</filename>. Some of these items are now
|
---|
[bccbdaea] | 578 | controlled by the <filename class='libraryfile'>pam_env.so</filename>
|
---|
| 579 | module and the <filename>/etc/security/pam_env.conf</filename>
|
---|
| 580 | configuration file. In particular, the default path has been
|
---|
| 581 | changed. To recover your default path, execute the following
|
---|
[7fb0e285] | 582 | commands:</para>
|
---|
| 583 |
|
---|
[d8684cbc] | 584 | <screen role="root"><userinput>ENV_PATH=`grep '^ENV_PATH' /etc/login.defs.orig | \
|
---|
[7fb0e285] | 585 | awk '{ print $2 }' | sed 's/PATH=//'` &&
|
---|
[d8684cbc] | 586 | echo 'PATH DEFAULT='`echo "${ENV_PATH}"`\
|
---|
| 587 | ' OVERRIDE=${PATH}' \
|
---|
[7fb0e285] | 588 | >> /etc/security/pam_env.conf &&
|
---|
[d8684cbc] | 589 | unset ENV_PATH</userinput></screen>
|
---|
[7fb0e285] | 590 |
|
---|
[d8684cbc] | 591 | <note>
|
---|
[bccbdaea] | 592 | <para>ENV_SUPATH is no longer supported. You must create
|
---|
| 593 | a valid <filename>/root/.bashrc</filename> file to provide a
|
---|
[d8684cbc] | 594 | modified path for the super-user.</para>
|
---|
| 595 | </note>
|
---|
[7fb0e285] | 596 |
|
---|
| 597 | </sect4>
|
---|
| 598 |
|
---|
[322f172] | 599 | </sect3>
|
---|
[b4b71892] | 600 |
|
---|
[322f172] | 601 | </sect2>
|
---|
[f45b1953] | 602 |
|
---|
[322f172] | 603 | <sect2 role="content">
|
---|
| 604 | <title>Contents</title>
|
---|
[17fb537e] | 605 |
|
---|
[322f172] | 606 | <para>A list of the installed files, along with their short descriptions
|
---|
| 607 | can be found at
|
---|
| 608 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
|
---|
[17fb537e] | 609 |
|
---|
[322f172] | 610 | </sect2>
|
---|
[17fb537e] | 611 |
|
---|
[f45b1953] | 612 | </sect1>
|
---|