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