[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 |
|
---|
[fb89293] | 7 | <!ENTITY shadow-download-http "http://pkg-shadow.alioth.debian.org/releases/shadow-&shadow-version;.tar.bz2 ">
|
---|
| 8 | <!ENTITY shadow-download-ftp " ">
|
---|
[5443006d] | 9 | <!ENTITY shadow-md5sum "d5f7a588fadb79faeb4b08b1eee82e9a">
|
---|
| 10 | <!ENTITY shadow-size "2.1 MB">
|
---|
| 11 | <!ENTITY shadow-buildsize "35 MB">
|
---|
[f4797d2] | 12 | <!ENTITY shadow-time "0.3 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
|
---|
[c6bdcb0] | 34 | <application>CrackLib</application> or
|
---|
| 35 | <application>Linux-PAM</application> after your LFS system was completed.
|
---|
| 36 | If you have installed <application>CrackLib</application> after LFS, then
|
---|
| 37 | reinstalling <application>Shadow</application> will enable strong password
|
---|
| 38 | support. If you have installed <application>Linux-PAM</application>,
|
---|
| 39 | reinstalling <application>Shadow</application> will allow programs such as
|
---|
[d8684cbc] | 40 | <command>login</command> and <command>su</command> to utilize PAM.</para>
|
---|
[322f172] | 41 |
|
---|
[a9af283] | 42 | &lfs70_checked;
|
---|
[f4797d2] | 43 |
|
---|
[322f172] | 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>
|
---|
[29d1c248] | 49 | <listitem>
|
---|
[322f172] | 50 | <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
|
---|
[29d1c248] | 51 | </listitem>
|
---|
[322f172] | 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 |
|
---|
[5443006d] | 66 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
[322f172] | 67 | <itemizedlist spacing='compact'>
|
---|
| 68 | <listitem>
|
---|
[d8684cbc] | 69 | <para>Required patch: <ulink
|
---|
[5443006d] | 70 | url="http://www.&lfs-domainname;/patches/lfs/development/shadow-&shadow-version;-nscd-1.patch"/>
|
---|
| 71 | </para>
|
---|
[322f172] | 72 | </listitem>
|
---|
[5443006d] | 73 | </itemizedlist>
|
---|
[322f172] | 74 |
|
---|
| 75 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
| 76 |
|
---|
| 77 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[5443006d] | 78 | <para role="required"><xref linkend="linux-pam"/> or
|
---|
[c6bdcb0] | 79 | <xref linkend="cracklib"/></para>
|
---|
[322f172] | 80 |
|
---|
[3597eb6] | 81 | <para condition="html" role="usernotes">User Notes:
|
---|
| 82 | <ulink url="&blfs-wiki;/shadow"/></para>
|
---|
| 83 |
|
---|
[322f172] | 84 | </sect2>
|
---|
| 85 |
|
---|
| 86 | <sect2 role="installation">
|
---|
| 87 | <title>Installation of Shadow</title>
|
---|
| 88 |
|
---|
[c6bdcb0] | 89 | <important>
|
---|
[bca744f] | 90 | <para>The installation commands shown below are for installations where
|
---|
[c6bdcb0] | 91 | <application>Linux-PAM</application> has been installed (with or
|
---|
| 92 | without a <application>CrackLib</application> installation) and
|
---|
| 93 | <application>Shadow</application> is being reinstalled to support the
|
---|
[bca744f] | 94 | <application>Linux-PAM</application> installation.</para>
|
---|
| 95 |
|
---|
| 96 | <para> If you are reinstalling <application>Shadow</application> to
|
---|
| 97 | provide strong password support using the
|
---|
| 98 | <application>CrackLib</application> library without using
|
---|
| 99 | <application>Linux-PAM</application>, ensure you add the
|
---|
| 100 | <parameter>--with-libcrack</parameter> parameter to the
|
---|
| 101 | <command>configure</command> script below and also issue the following
|
---|
| 102 | command:</para>
|
---|
| 103 |
|
---|
| 104 | <screen><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
|
---|
[c6bdcb0] | 105 | </important>
|
---|
| 106 |
|
---|
[322f172] | 107 | <para>Reinstall <application>Shadow</application> by running the following
|
---|
| 108 | commands:</para>
|
---|
| 109 |
|
---|
[5443006d] | 110 | <screen><userinput>sed -i 's/groups$(EXEEXT) //' src/Makefile.in &&
|
---|
[bca744f] | 111 | find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; &&
|
---|
[5443006d] | 112 | sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in &&
|
---|
[8f68b03] | 113 |
|
---|
[a9af283] | 114 | sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
|
---|
[5443006d] | 115 | -e 's@/var/spool/mail@/var/mail@' etc/login.defs &&
|
---|
| 116 |
|
---|
| 117 | sed -i -e 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@' \
|
---|
| 118 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs &&
|
---|
[8f68b03] | 119 |
|
---|
[5443006d] | 120 | patch -Np1 -i ../shadow-&shadow-version;-nscd-1.patch &&
|
---|
| 121 |
|
---|
| 122 | ./configure --prefix=/usr --sysconfdir=/etc \
|
---|
| 123 | --without-acl --without-attr &&
|
---|
[322f172] | 124 | make</userinput></screen>
|
---|
[17fb537e] | 125 |
|
---|
[31f3a57] | 126 | <para>This package does not come with a test suite.</para>
|
---|
| 127 |
|
---|
[322f172] | 128 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[17fb537e] | 129 |
|
---|
[322f172] | 130 | <screen role="root"><userinput>make install &&
|
---|
[bca744f] | 131 | mv -v /usr/bin/passwd /bin</userinput></screen>
|
---|
[b4b71892] | 132 |
|
---|
[322f172] | 133 | </sect2>
|
---|
[b4b71892] | 134 |
|
---|
[322f172] | 135 | <sect2 role="commands">
|
---|
| 136 | <title>Command Explanations</title>
|
---|
[b4b71892] | 137 |
|
---|
[bca744f] | 138 | <para><command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>:
|
---|
| 139 | This command is used to suppress the installation of the
|
---|
[8f68b03] | 140 | <command>groups</command> program as the version from the
|
---|
| 141 | <application>Coreutils</application> package installed during LFS is
|
---|
| 142 | preferred.</para>
|
---|
| 143 |
|
---|
[bca744f] | 144 | <para><command>find man -name Makefile.in -exec ... {} \;</command>: This
|
---|
[8f68b03] | 145 | command is used to suppress the installation of the
|
---|
| 146 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 147 | the <application>Coreutils</application> package are not replaced.</para>
|
---|
| 148 |
|
---|
[bca744f] | 149 | <para><command>sed -i -e '...' -e '...' man/Makefile.in</command>: This
|
---|
[8f68b03] | 150 | command disables the installation of Chinese and Korean manual pages, since
|
---|
| 151 | <application>Man-DB</application> cannot format them properly.</para>
|
---|
| 152 |
|
---|
[5443006d] | 153 | <para><command>sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@'
|
---|
[bca744f] | 154 | -e 's@/var/spool/mail@/var/mail@' etc/login.defs</command>:
|
---|
[5443006d] | 155 | Instead of using the default 'DES' method, this command modifies the
|
---|
[bbffefa5] | 156 | installation to use the more secure 'SHA512' method of hashing passwords,
|
---|
[bca744f] | 157 | which also allows passwords longer than eight characters. It also changes
|
---|
| 158 | the obsolete <filename class="directory">/var/spool/mail</filename>
|
---|
| 159 | location for user mailboxes that <application>Shadow</application> uses by
|
---|
| 160 | default to the <filename class="directory">/var/mail</filename>
|
---|
| 161 | location.</para>
|
---|
| 162 |
|
---|
[5443006d] | 163 | <para><command>sed -i -e
|
---|
| 164 | 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@'
|
---|
| 165 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs</command>:
|
---|
| 166 | This sed expands PATH to <filename class="directory">/usr/local/bin</filename>
|
---|
| 167 | for normal and <systemitem class="username">root</systemitem> user and to
|
---|
| 168 | <filename class="directory">/usr/local/sbin</filename> for
|
---|
| 169 | <systemitem class="username">root</systemitem> user only.</para>
|
---|
| 170 |
|
---|
| 171 | <para><command>--without-acl</command>: Disables linking with <xref linkend="acl"/>
|
---|
| 172 | since <application>Shadow</application> fails to compile if it is present.</para>
|
---|
| 173 |
|
---|
| 174 | <para><command>--without-attr</command>: Disables linking with <xref linkend="attr"/>
|
---|
| 175 | since <application>Shadow</application> fails to compile if it is present.</para>
|
---|
| 176 |
|
---|
[8f68b03] | 177 | <para><command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 178 | <command>passwd</command> program may be needed during times when the
|
---|
| 179 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 180 | it is moved into the root partition.</para>
|
---|
| 181 |
|
---|
[322f172] | 182 | </sect2>
|
---|
[b4b71892] | 183 |
|
---|
[e807ae1d] | 184 | <sect2 role="configuration">
|
---|
| 185 | <title>Configuring Shadow</title>
|
---|
| 186 |
|
---|
| 187 | <para><application>Shadow</application>'s stock configuration for the
|
---|
[8c9e2f6e] | 188 | <command>useradd</command> utility may not be desirable for your
|
---|
[bca744f] | 189 | installation. One default parameter causes <command>useradd</command> to
|
---|
| 190 | create a mailbox file for any newly created user.
|
---|
| 191 | <command>useradd</command> will make the group ownership of this file to
|
---|
| 192 | the <systemitem class="groupname">mail</systemitem> group with 0660
|
---|
| 193 | permissions. If you would prefer that these mailbox files are not created
|
---|
| 194 | by <command>useradd</command>, issue the
|
---|
| 195 | following command as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[e807ae1d] | 196 |
|
---|
[bca744f] | 197 | <screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
[e807ae1d] | 198 |
|
---|
| 199 | </sect2>
|
---|
| 200 |
|
---|
[322f172] | 201 | <sect2 role="configuration">
|
---|
| 202 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 203 |
|
---|
[8f68b03] | 204 | <note>
|
---|
[eb2eccc] | 205 | <para>The rest of this page is devoted to configuring
|
---|
[8f68b03] | 206 | <application>Shadow</application> to work properly with
|
---|
| 207 | <application>Linux-PAM</application>. If you do not have
|
---|
| 208 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 209 | <application>Shadow</application> to support strong passwords via
|
---|
| 210 | the <application>CrackLib</application> library, no further configuration
|
---|
| 211 | is required.</para>
|
---|
| 212 | </note>
|
---|
| 213 |
|
---|
[322f172] | 214 | <sect3 id="pam.d">
|
---|
| 215 | <title>Config Files</title>
|
---|
[b4b71892] | 216 |
|
---|
[1ba671c] | 217 | <para><filename>/etc/pam.d/*</filename> or alternatively
|
---|
[bca744f] | 218 | <filename>/etc/pam.conf, /etc/login.defs, and
|
---|
[1ba671c] | 219 | /etc/security/*</filename></para>
|
---|
[b4b71892] | 220 |
|
---|
[322f172] | 221 | <indexterm zone="shadow pam.d">
|
---|
| 222 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 223 | </indexterm>
|
---|
[2197589] | 224 |
|
---|
[322f172] | 225 | <indexterm zone="shadow pam.d">
|
---|
| 226 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 227 | </indexterm>
|
---|
[4fcf20a5] | 228 |
|
---|
[1ba671c] | 229 | <indexterm zone="shadow pam.d">
|
---|
| 230 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 231 | </indexterm>
|
---|
| 232 |
|
---|
| 233 | <indexterm zone="shadow pam.d">
|
---|
| 234 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 235 | </indexterm>
|
---|
| 236 |
|
---|
[322f172] | 237 | </sect3>
|
---|
| 238 |
|
---|
| 239 | <sect3>
|
---|
| 240 | <title>Configuration Information</title>
|
---|
| 241 |
|
---|
[8f68b03] | 242 | <para>Configuring your system to use <application>Linux-PAM</application>
|
---|
| 243 | can be a complex task. The information below will provide a basic setup
|
---|
| 244 | so that <application>Shadow</application>'s login and password
|
---|
| 245 | functionality will work effectively with
|
---|
| 246 | <application>Linux-PAM</application>. Review the information and links on
|
---|
| 247 | the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 248 | information. For information specific to integrating
|
---|
| 249 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 250 | and <application>CrackLib</application>, you can visit the following
|
---|
[5443006d] | 251 | link:</para>
|
---|
[8f68b03] | 252 |
|
---|
| 253 | <itemizedlist spacing="compact">
|
---|
| 254 | <listitem>
|
---|
| 255 | <para><ulink
|
---|
| 256 | url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/></para>
|
---|
| 257 | </listitem>
|
---|
| 258 | </itemizedlist>
|
---|
| 259 |
|
---|
[1ba671c] | 260 | <sect4 id="pam-login-defs">
|
---|
| 261 | <title>Configuring /etc/login.defs</title>
|
---|
| 262 |
|
---|
| 263 | <para>The <command>login</command> program currently performs many
|
---|
| 264 | functions which <application>Linux-PAM</application> modules should
|
---|
| 265 | now handle. The following <command>sed</command> command will comment
|
---|
| 266 | out the appropriate lines in <filename>/etc/login.defs</filename>, and
|
---|
| 267 | stop <command>login</command> from performing these functions (a backup
|
---|
| 268 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
[d8684cbc] | 269 | to preserve the original file's contents). Issue the following commands
|
---|
| 270 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[1ba671c] | 271 |
|
---|
| 272 | <indexterm zone="shadow pam-login-defs">
|
---|
| 273 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 274 | </indexterm>
|
---|
| 275 |
|
---|
| 276 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
[5443006d] | 277 | for FUNCTION in FAIL_DELAY LASTLOG_ENAB \
|
---|
| 278 | MAIL_CHECK_ENAB \
|
---|
| 279 | OBSCURE_CHECKS_ENAB \
|
---|
| 280 | PORTTIME_CHECKS_ENAB \
|
---|
| 281 | CONSOLE MOTD_FILE \
|
---|
| 282 | NOLOGINS_FILE ENV_HZ \
|
---|
| 283 | SU_WHEEL_ONLY \
|
---|
| 284 | CRACKLIB_DICTPATH \
|
---|
| 285 | SYS_UID_MIN SYS_UID_MAX \
|
---|
| 286 | SYS_GID_MIN SYS_GID_MAX \
|
---|
| 287 | PASS_CHANGE_TRIES \
|
---|
| 288 | PASS_ALWAYS_WARN \
|
---|
| 289 | CHFN_AUTH ENVIRON_FILE
|
---|
[1ba671c] | 290 | do
|
---|
[d8684cbc] | 291 | sed -i "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[1ba671c] | 292 | done</userinput></screen>
|
---|
| 293 |
|
---|
| 294 | </sect4>
|
---|
| 295 |
|
---|
| 296 | <sect4>
|
---|
| 297 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 298 |
|
---|
[29f80ebc] | 299 | <para>As mentioned previously in the
|
---|
| 300 | <application>Linux-PAM</application> instructions,
|
---|
| 301 | <application>Linux-PAM</application> has two supported methods for
|
---|
| 302 | configuration. The commands below assume that you've chosen to use
|
---|
| 303 | a directory based configuration, where each program has its own
|
---|
[eb2eccc] | 304 | configuration file. You can optionally use a single
|
---|
[29f80ebc] | 305 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 306 | text from the files below, and supplying the program name as an
|
---|
[eb2eccc] | 307 | additional first field for each line.</para>
|
---|
| 308 |
|
---|
| 309 | <para>As the <systemitem class="username">root</systemitem> user,
|
---|
[bca744f] | 310 | replace the following <application>Linux-PAM</application>
|
---|
| 311 | configuration files in the
|
---|
[29f80ebc] | 312 | <filename class="directory">/etc/pam.d/</filename> directory (or
|
---|
[bca744f] | 313 | add the contents to the <filename>/etc/pam.conf</filename> file) using
|
---|
[eb2eccc] | 314 | the following commands:</para>
|
---|
[1ba671c] | 315 |
|
---|
| 316 | </sect4>
|
---|
[322f172] | 317 |
|
---|
| 318 | <sect4>
|
---|
[3e8fb4c] | 319 | <title>'system-account'</title>
|
---|
[322f172] | 320 |
|
---|
[3e8fb4c] | 321 | <screen role="root"><userinput>cat > /etc/pam.d/system-account << "EOF"
|
---|
| 322 | <literal># Begin /etc/pam.d/system-account
|
---|
[4fcf20a5] | 323 |
|
---|
[3e8fb4c] | 324 | account required pam_unix.so
|
---|
[4fcf20a5] | 325 |
|
---|
[3e8fb4c] | 326 | # End /etc/pam.d/system-account</literal>
|
---|
[322f172] | 327 | EOF</userinput></screen>
|
---|
| 328 |
|
---|
| 329 | </sect4>
|
---|
[4fcf20a5] | 330 |
|
---|
[322f172] | 331 | <sect4>
|
---|
[3e8fb4c] | 332 | <title>'system-auth'</title>
|
---|
[4fcf20a5] | 333 |
|
---|
[3e8fb4c] | 334 | <screen role="root"><userinput>cat > /etc/pam.d/system-auth << "EOF"
|
---|
| 335 | <literal># Begin /etc/pam.d/system-auth
|
---|
[b4b71892] | 336 |
|
---|
[3e8fb4c] | 337 | auth required pam_unix.so
|
---|
[b4b71892] | 338 |
|
---|
[3e8fb4c] | 339 | # End /etc/pam.d/system-auth</literal>
|
---|
[322f172] | 340 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 341 |
|
---|
[322f172] | 342 | </sect4>
|
---|
[4fcf20a5] | 343 |
|
---|
[322f172] | 344 | <sect4>
|
---|
[3e8fb4c] | 345 | <title>'system-passwd' (with cracklib)</title>
|
---|
| 346 |
|
---|
| 347 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
| 348 | <literal># Begin /etc/pam.d/system-password
|
---|
| 349 |
|
---|
| 350 | # check new passwords for strength (man pam_cracklib)
|
---|
| 351 | password required pam_cracklib.so type=Linux retry=3 difok=5 \
|
---|
| 352 | difignore=23 minlen=9 dcredit=1 \
|
---|
| 353 | ucredit=1 lcredit=1 ocredit=1 \
|
---|
| 354 | dictpath=/lib/cracklib/pw_dict
|
---|
| 355 | # use sha512 hash for encryption, use shadow, and use the
|
---|
| 356 | # authentication token (chosen password) set by pam_cracklib
|
---|
| 357 | # above (or any previous modules)
|
---|
| 358 | password required pam_unix.so sha512 shadow use_authtok
|
---|
| 359 |
|
---|
| 360 | # End /etc/pam.d/system-password</literal>
|
---|
[322f172] | 361 | EOF</userinput></screen>
|
---|
| 362 |
|
---|
[c0c33269] | 363 | <note><para>In its default configuration, owing to credits,
|
---|
| 364 | pam_cracklib will allow multiple case passwords as short as 6
|
---|
| 365 | characters, even with the <parameter>minlen</parameter> value
|
---|
| 366 | set to 11. You should review the pam_cracklib(8) man page and
|
---|
| 367 | determine if these default values are acceptable for the security
|
---|
| 368 | of your system.</para></note>
|
---|
| 369 |
|
---|
[322f172] | 370 | </sect4>
|
---|
[3e8fb4c] | 371 |
|
---|
| 372 | <sect4>
|
---|
| 373 | <title>'system-passwd' (without cracklib)</title>
|
---|
| 374 |
|
---|
| 375 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
| 376 | <literal># Begin /etc/pam.d/system-password
|
---|
| 377 |
|
---|
[a6bd736] | 378 | # use sha512 hash for encryption, use shadow, and try to use any previously
|
---|
[3e8fb4c] | 379 | # defined authentication token (chosen password) set by any prior module
|
---|
| 380 | password required pam_unix.so sha512 shadow try_first_pass
|
---|
| 381 |
|
---|
| 382 | # End /etc/pam.d/system-password</literal>
|
---|
| 383 | EOF</userinput></screen>
|
---|
| 384 |
|
---|
| 385 | </sect4>
|
---|
| 386 |
|
---|
| 387 | <sect4>
|
---|
| 388 | <title>'system-session'</title>
|
---|
| 389 |
|
---|
| 390 | <screen role="root"><userinput>cat > /etc/pam.d/system-session << "EOF"
|
---|
| 391 | <literal># Begin /etc/pam.d/system-session
|
---|
| 392 |
|
---|
| 393 | session required pam_unix.so
|
---|
| 394 |
|
---|
| 395 | # End /etc/pam.d/system-session</literal>
|
---|
| 396 | EOF</userinput></screen>
|
---|
| 397 |
|
---|
| 398 | </sect4>
|
---|
[b4b71892] | 399 |
|
---|
[322f172] | 400 | <sect4>
|
---|
[3e8fb4c] | 401 | <title>'login'</title>
|
---|
| 402 |
|
---|
| 403 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 404 | <literal># Begin /etc/pam.d/login
|
---|
| 405 |
|
---|
| 406 | # Set failure delay before next prompt to 3 seconds
|
---|
| 407 | auth optional pam_faildelay.so delay=3000000
|
---|
| 408 |
|
---|
| 409 | # Check to make sure that the user is allowed to login
|
---|
| 410 | auth requisite pam_nologin.so
|
---|
| 411 |
|
---|
[d265d4c] | 412 | # Check to make sure that root is allowed to login
|
---|
| 413 | # Disabled by default. You will need to create /etc/securetty
|
---|
| 414 | # file for this module to function. See man 5 securetty.
|
---|
| 415 | #auth required pam_securetty.so
|
---|
[3e8fb4c] | 416 |
|
---|
| 417 | # Additional group memberships - disabled by default
|
---|
| 418 | #auth optional pam_group.so
|
---|
| 419 |
|
---|
| 420 | # include the default auth settings
|
---|
| 421 | auth include system-auth
|
---|
| 422 |
|
---|
| 423 | # check access for the user
|
---|
| 424 | account required pam_access.so
|
---|
| 425 |
|
---|
| 426 | # include the default account settings
|
---|
| 427 | account include system-account
|
---|
| 428 |
|
---|
| 429 | # Set default environment variables for the user
|
---|
| 430 | session required pam_env.so
|
---|
| 431 |
|
---|
| 432 | # Set resource limits for the user
|
---|
| 433 | session required pam_limits.so
|
---|
| 434 |
|
---|
| 435 | # Display date of last login - Disabled by default
|
---|
| 436 | #session optional pam_lastlog.so
|
---|
| 437 |
|
---|
| 438 | # Display the message of the day - Disabled by default
|
---|
| 439 | #session optional pam_motd.so
|
---|
| 440 |
|
---|
| 441 | # Check user's mail - Disabled by default
|
---|
| 442 | #session optional pam_mail.so standard quiet
|
---|
| 443 |
|
---|
| 444 | # include the default session and password settings
|
---|
| 445 | session include system-session
|
---|
| 446 | password include system-password
|
---|
| 447 |
|
---|
| 448 | # End /etc/pam.d/login</literal>
|
---|
| 449 | EOF</userinput></screen>
|
---|
| 450 |
|
---|
| 451 | </sect4>
|
---|
| 452 |
|
---|
| 453 | <sect4>
|
---|
| 454 | <title>'passwd'</title>
|
---|
[4fcf20a5] | 455 |
|
---|
[322f172] | 456 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 457 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 458 |
|
---|
[3e8fb4c] | 459 | password include system-password
|
---|
[b4b71892] | 460 |
|
---|
[322f172] | 461 | # End /etc/pam.d/passwd</literal>
|
---|
| 462 | EOF</userinput></screen>
|
---|
| 463 |
|
---|
| 464 | </sect4>
|
---|
[4fcf20a5] | 465 |
|
---|
[322f172] | 466 | <sect4>
|
---|
| 467 | <title>'su'</title>
|
---|
[4fcf20a5] | 468 |
|
---|
[322f172] | 469 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 470 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 471 |
|
---|
[3e8fb4c] | 472 | # always allow root
|
---|
| 473 | auth sufficient pam_rootok.so
|
---|
[55e18620] | 474 | auth include system-auth
|
---|
[3e8fb4c] | 475 |
|
---|
| 476 | # include the default account settings
|
---|
| 477 | account include system-account
|
---|
| 478 |
|
---|
| 479 | # Set default environment variables for the service user
|
---|
| 480 | session required pam_env.so
|
---|
| 481 |
|
---|
| 482 | # include system session defaults
|
---|
| 483 | session include system-session
|
---|
[b4b71892] | 484 |
|
---|
[322f172] | 485 | # End /etc/pam.d/su</literal>
|
---|
| 486 | EOF</userinput></screen>
|
---|
[b4b71892] | 487 |
|
---|
[322f172] | 488 | </sect4>
|
---|
[b4b71892] | 489 |
|
---|
[322f172] | 490 | <sect4>
|
---|
| 491 | <title>'chage'</title>
|
---|
| 492 |
|
---|
| 493 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
[3e8fb4c] | 494 | <literal>#Begin /etc/pam.d/chage
|
---|
| 495 |
|
---|
| 496 | # always allow root
|
---|
| 497 | auth sufficient pam_rootok.so
|
---|
| 498 |
|
---|
| 499 | # include system defaults for auth account and session
|
---|
| 500 | auth include system-auth
|
---|
| 501 | account include system-account
|
---|
| 502 | session include system-session
|
---|
[b4b71892] | 503 |
|
---|
[3e8fb4c] | 504 | # Always permit for authentication updates
|
---|
| 505 | password required pam_permit.so
|
---|
[b4b71892] | 506 |
|
---|
[322f172] | 507 | # End /etc/pam.d/chage</literal>
|
---|
| 508 | EOF</userinput></screen>
|
---|
| 509 |
|
---|
| 510 | </sect4>
|
---|
[b4b71892] | 511 |
|
---|
[322f172] | 512 | <sect4>
|
---|
[bca744f] | 513 | <title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd',
|
---|
| 514 | 'groupdel', 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel'
|
---|
| 515 | and 'usermod'</title>
|
---|
[39975e9] | 516 |
|
---|
[bca744f] | 517 | <screen role="root"><userinput>for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
|
---|
| 518 | groupmems groupmod newusers useradd userdel usermod
|
---|
[4fcf20a5] | 519 | do
|
---|
[904f31e2] | 520 | install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
|
---|
[d8684cbc] | 521 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
|
---|
[322f172] | 522 | done</userinput></screen>
|
---|
| 523 |
|
---|
| 524 | <warning>
|
---|
| 525 | <para>At this point, you should do a simple test to see if
|
---|
| 526 | <application>Shadow</application> is working as expected. Open
|
---|
[1ba671c] | 527 | another terminal and log in as a user, then <command>su</command> to
|
---|
[974951c] | 528 | <systemitem class="username">root</systemitem>. If you do not see any
|
---|
| 529 | errors, then all is well and you should proceed with the rest of the
|
---|
[322f172] | 530 | configuration. If you did receive errors, stop now and double check
|
---|
[b65246b] | 531 | the above configuration files manually. You can also run the test
|
---|
| 532 | suite from the <application>Linux-PAM</application> package to assist
|
---|
| 533 | you in determining the problem. If you cannot find and
|
---|
[322f172] | 534 | fix the error, you should recompile <application>Shadow</application>
|
---|
[3e13cd9] | 535 | adding the <option>--without-libpam</option> switch to the
|
---|
| 536 | <command>configure</command> command in the above instructions
|
---|
| 537 | (also move the <filename>/etc/login.defs.orig</filename> backup
|
---|
| 538 | file to <filename>/etc/login.defs</filename>). If you
|
---|
[322f172] | 539 | fail to do this and the errors remain, you will be unable to log into
|
---|
| 540 | your system.</para>
|
---|
| 541 | </warning>
|
---|
| 542 |
|
---|
[349b53dd] | 543 | </sect4>
|
---|
| 544 |
|
---|
| 545 | <sect4>
|
---|
| 546 | <title>Other</title>
|
---|
| 547 |
|
---|
[322f172] | 548 | <para>Currently, <filename>/etc/pam.d/other</filename> is configured
|
---|
| 549 | to allow anyone with an account on the machine to use PAM-aware
|
---|
| 550 | programs without a configuration file for that program. After testing
|
---|
| 551 | <application>Linux-PAM</application> for proper configuration, install
|
---|
| 552 | a more restrictive <filename>other</filename> file so that
|
---|
| 553 | program-specific configuration files are required:</para>
|
---|
| 554 |
|
---|
| 555 | <screen role="root"><userinput>cat > /etc/pam.d/other << "EOF"
|
---|
| 556 | <literal># Begin /etc/pam.d/other
|
---|
[b4b71892] | 557 |
|
---|
| 558 | auth required pam_warn.so
|
---|
[3e8fb4c] | 559 | auth required pam_deny.so
|
---|
[bca744f] | 560 | account required pam_warn.so
|
---|
[3e8fb4c] | 561 | account required pam_deny.so
|
---|
[b4b71892] | 562 | password required pam_warn.so
|
---|
[3e8fb4c] | 563 | password required pam_deny.so
|
---|
[bca744f] | 564 | session required pam_warn.so
|
---|
[3e8fb4c] | 565 | session required pam_deny.so
|
---|
[b4b71892] | 566 |
|
---|
[322f172] | 567 | # End /etc/pam.d/other</literal>
|
---|
| 568 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 569 |
|
---|
[322f172] | 570 | </sect4>
|
---|
[4fcf20a5] | 571 |
|
---|
[322f172] | 572 | <sect4 id="pam-access">
|
---|
| 573 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 574 |
|
---|
[322f172] | 575 | <para>Instead of using the <filename>/etc/login.access</filename>
|
---|
| 576 | file for controlling access to the system,
|
---|
| 577 | <application>Linux-PAM</application> uses the
|
---|
| 578 | <filename class='libraryfile'>pam_access.so</filename> module along
|
---|
| 579 | with the <filename>/etc/security/access.conf</filename> file. Rename
|
---|
| 580 | the <filename>/etc/login.access</filename> file using the following
|
---|
| 581 | command:</para>
|
---|
| 582 |
|
---|
| 583 | <indexterm zone="shadow pam-access">
|
---|
| 584 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
| 585 | </indexterm>
|
---|
| 586 |
|
---|
| 587 | <screen role="root"><userinput>if [ -f /etc/login.access ]; then
|
---|
[4fcf20a5] | 588 | mv -v /etc/login.access /etc/login.access.NOUSE
|
---|
[322f172] | 589 | fi</userinput></screen>
|
---|
| 590 |
|
---|
| 591 | </sect4>
|
---|
| 592 |
|
---|
| 593 | <sect4 id="pam-limits">
|
---|
| 594 | <title>Configuring Resource Limits</title>
|
---|
| 595 |
|
---|
| 596 | <para>Instead of using the <filename>/etc/limits</filename> file
|
---|
| 597 | for limiting usage of system resources,
|
---|
| 598 | <application>Linux-PAM</application> uses the
|
---|
| 599 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
| 600 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
| 601 | the <filename>/etc/limits</filename> file using the following
|
---|
| 602 | command:</para>
|
---|
| 603 |
|
---|
| 604 | <indexterm zone="shadow pam-limits">
|
---|
| 605 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
| 606 | </indexterm>
|
---|
| 607 |
|
---|
| 608 | <screen role="root"><userinput>if [ -f /etc/limits ]; then
|
---|
[4fcf20a5] | 609 | mv -v /etc/limits /etc/limits.NOUSE
|
---|
[322f172] | 610 | fi</userinput></screen>
|
---|
| 611 |
|
---|
| 612 | </sect4>
|
---|
[4fcf20a5] | 613 |
|
---|
[322f172] | 614 | </sect3>
|
---|
[b4b71892] | 615 |
|
---|
[322f172] | 616 | </sect2>
|
---|
[f45b1953] | 617 |
|
---|
[322f172] | 618 | <sect2 role="content">
|
---|
| 619 | <title>Contents</title>
|
---|
[17fb537e] | 620 |
|
---|
[322f172] | 621 | <para>A list of the installed files, along with their short descriptions
|
---|
| 622 | can be found at
|
---|
| 623 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
|
---|
[17fb537e] | 624 |
|
---|
[322f172] | 625 | </sect2>
|
---|
[17fb537e] | 626 |
|
---|
[f45b1953] | 627 | </sect1>
|
---|