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