[ SEA-GHOST MINI SHELL]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>6.2. pam_cracklib - checks the password against dictionary words</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="Linux-PAM_SAG.html" title="The Linux-PAM System Administrators' Guide"><link rel="up" href="sag-module-reference.html" title="Chapter 6. A reference guide for available modules"><link rel="prev" href="sag-pam_access.html" title="6.1. pam_access - logdaemon style login access control"><link rel="next" href="sag-pam_debug.html" title="6.3. pam_debug - debug the PAM stack"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6.2. pam_cracklib - checks the password against dictionary words</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sag-pam_access.html">Prev</a> </td><th width="60%" align="center">Chapter 6. A reference guide for available modules</th><td width="20%" align="right"> <a accesskey="n" href="sag-pam_debug.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sag-pam_cracklib"></a>6.2. pam_cracklib - checks the password against dictionary words</h2></div></div></div><div class="cmdsynopsis"><p><code class="command">pam_cracklib.so</code> [
<em class="replaceable"><code>...</code></em>
]</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-description"></a>6.2.1. DESCRIPTION</h3></div></div></div><p>
This module can be plugged into the <span class="emphasis"><em>password</em></span> stack of
a given application to provide some plug-in strength-checking for passwords.
</p><p>
The action of this module is to prompt the user for a password and
check its strength against a system dictionary and a set of rules for
identifying poor choices.
</p><p>
The first action is to prompt for a single password, check its
strength and then, if it is considered strong, prompt for the password
a second time (to verify that it was typed correctly on the first
occasion). All being well, the password is passed on to subsequent
modules to be installed as the new authentication token.
</p><p>
The strength checks works in the following manner: at first the
<code class="function">Cracklib</code> routine is called to check if the password
is part of a dictionary; if this is not the case an additional set of
strength checks is done. These checks are:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Palindrome</span></dt><dd><p>
Is the new password a palindrome?
</p></dd><dt><span class="term">Case Change Only</span></dt><dd><p>
Is the new password the the old one with only a change of case?
</p></dd><dt><span class="term">Similar</span></dt><dd><p>
Is the new password too much like the old one?
This is primarily controlled by one argument,
<code class="option">difok</code> which is a number of character changes
(inserts, removals, or replacements) between the old and new
password that are enough to accept the new password.
This defaults to 5 changes.
</p></dd><dt><span class="term">Simple</span></dt><dd><p>
Is the new password too small?
This is controlled by 6 arguments <code class="option">minlen</code>,
<code class="option">maxclassrepeat</code>,
<code class="option">dcredit</code>, <code class="option">ucredit</code>,
<code class="option">lcredit</code>, and <code class="option">ocredit</code>. See the section
on the arguments for the details of how these work and there defaults.
</p></dd><dt><span class="term">Rotated</span></dt><dd><p>
Is the new password a rotated version of the old password?
</p></dd><dt><span class="term">Same consecutive characters</span></dt><dd><p>
Optional check for same consecutive characters.
</p></dd><dt><span class="term">Too long monotonic character sequence</span></dt><dd><p>
Optional check for too long monotonic character sequence.
</p></dd><dt><span class="term">Contains user name</span></dt><dd><p>
Optional check whether the password contains the user's name
in some form.
</p></dd></dl></div><p>
This module with no arguments will work well for standard unix
password encryption. With md5 encryption, passwords can be longer
than 8 characters and the default settings for this module can make it
hard for the user to choose a satisfactory new password. Notably, the
requirement that the new password contain no more than 1/2 of the
characters in the old password becomes a non-trivial constraint. For
example, an old password of the form "the quick brown fox jumped over
the lazy dogs" would be difficult to change... In addition, the
default action is to allow passwords as small as 5 characters in
length. For a md5 systems it can be a good idea to increase the
required minimum size of a password. One can then allow more credit
for different kinds of characters but accept that the new password may
share most of these characters with the old password.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-options"></a>6.2.2. OPTIONS</h3></div></div></div><p>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<code class="option">debug</code>
</span></dt><dd><p>
This option makes the module write information to
<span class="citerefentry"><span class="refentrytitle">syslog</span>(3)</span>
indicating the behavior of the module (this option does
not write password information to the log file).
</p></dd><dt><span class="term">
<code class="option">authtok_type=<em class="replaceable"><code>XXX</code></em></code>
</span></dt><dd><p>
The default action is for the module to use the
following prompts when requesting passwords:
"New UNIX password: " and "Retype UNIX password: ".
The example word <span class="emphasis"><em>UNIX</em></span> can
be replaced with this option, by default it is empty.
</p></dd><dt><span class="term">
<code class="option">retry=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
Prompt user at most <em class="replaceable"><code>N</code></em> times
before returning with error. The default is
<span class="emphasis"><em>1</em></span>.
</p></dd><dt><span class="term">
<code class="option">difok=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
This argument will change the default of
<span class="emphasis"><em>5</em></span> for the number of character
changes in the new password that differentiate it
from the old password.
</p></dd><dt><span class="term">
<code class="option">minlen=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
The minimum acceptable size for the new password (plus
one if credits are not disabled which is the default).
In addition to the number of characters in the new password,
credit (of +1 in length) is given for each different kind
of character (<span class="emphasis"><em>other</em></span>,
<span class="emphasis"><em>upper</em></span>, <span class="emphasis"><em>lower</em></span> and
<span class="emphasis"><em>digit</em></span>). The default for this parameter
is <span class="emphasis"><em>9</em></span> which is good for a old style UNIX
password all of the same type of character but may be too low
to exploit the added security of a md5 system. Note that
there is a pair of length limits in
<span class="emphasis"><em>Cracklib</em></span> itself, a "way too short" limit
of 4 which is hard coded in and a defined limit (6) that will
be checked without reference to <code class="option">minlen</code>.
If you want to allow passwords as short as 5 characters you
should not use this module.
</p></dd><dt><span class="term">
<code class="option">dcredit=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
(N >= 0) This is the maximum credit for having digits in
the new password. If you have less than or
<em class="replaceable"><code>N</code></em>
digits, each digit will count +1 towards meeting the current
<code class="option">minlen</code> value. The default for
<code class="option">dcredit</code> is 1 which is the recommended
value for <code class="option">minlen</code> less than 10.
</p><p>
(N < 0) This is the minimum number of digits that must
be met for a new password.
</p></dd><dt><span class="term">
<code class="option">ucredit=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
(N >= 0) This is the maximum credit for having upper
case letters in the new password. If you have less than
or <em class="replaceable"><code>N</code></em> upper case letters each
letter will count +1 towards meeting the current
<code class="option">minlen</code> value. The default for
<code class="option">ucredit</code> is <span class="emphasis"><em>1</em></span> which
is the recommended value for <code class="option">minlen</code> less
than 10.
</p><p>
(N < 0) This is the minimum number of upper
case letters that must be met for a new password.
</p></dd><dt><span class="term">
<code class="option">lcredit=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
(N >= 0) This is the maximum credit for having
lower case letters in the new password. If you have
less than or <em class="replaceable"><code>N</code></em> lower case
letters, each letter will count +1 towards meeting the
current <code class="option">minlen</code> value. The default for
<code class="option">lcredit</code> is 1 which is the recommended
value for <code class="option">minlen</code> less than 10.
</p><p>
(N < 0) This is the minimum number of lower
case letters that must be met for a new password.
</p></dd><dt><span class="term">
<code class="option">ocredit=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
(N >= 0) This is the maximum credit for having other
characters in the new password. If you have less than or
<em class="replaceable"><code>N</code></em> other characters, each
character will count +1 towards meeting the current
<code class="option">minlen</code> value. The default for
<code class="option">ocredit</code> is 1 which is the recommended
value for <code class="option">minlen</code> less than 10.
</p><p>
(N < 0) This is the minimum number of other
characters that must be met for a new password.
</p></dd><dt><span class="term">
<code class="option">minclass=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
The minimum number of required classes of characters for
the new password. The default number is zero. The four
classes are digits, upper and lower letters and other
characters.
The difference to the <code class="option">credit</code> check is
that a specific class if of characters is not required.
Instead <em class="replaceable"><code>N</code></em> out of four of the
classes are required.
</p></dd><dt><span class="term">
<code class="option">maxrepeat=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
Reject passwords which contain more than N same consecutive
characters. The default is 0 which means that this check
is disabled.
</p></dd><dt><span class="term">
<code class="option">maxsequence=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
Reject passwords which contain monotonic character sequences
longer than N. The default is 0 which means that this check
is disabled. Examples of such sequence are '12345' or 'fedcb'.
Note that most such passwords will not pass the simplicity
check unless the sequence is only a minor part of the password.
</p></dd><dt><span class="term">
<code class="option">maxclassrepeat=<em class="replaceable"><code>N</code></em></code>
</span></dt><dd><p>
Reject passwords which contain more than N consecutive
characters of the same class. The default is 0 which means
that this check is disabled.
</p></dd><dt><span class="term">
<code class="option">reject_username</code>
</span></dt><dd><p>
Check whether the name of the user in straight or reversed
form is contained in the new password. If it is found the
new password is rejected.
</p></dd><dt><span class="term">
<code class="option">gecoscheck</code>
</span></dt><dd><p>
Check whether the words from the GECOS field (usualy full name
of the user) longer than 3 characters in straight or reversed
form are contained in the new password. If any such word is
found the new password is rejected.
</p></dd><dt><span class="term">
<code class="option">enforce_for_root</code>
</span></dt><dd><p>
The module will return error on failed check also if the user
changing the password is root. This option is off by default
which means that just the message about the failed check is
printed but root can change the password anyway.
Note that root is not asked for an old password so the checks
that compare the old and new password are not performed.
</p></dd><dt><span class="term">
<code class="option">use_authtok</code>
</span></dt><dd><p>
This argument is used to <span class="emphasis"><em>force</em></span> the
module to not prompt the user for a new password but use
the one provided by the previously stacked
<span class="emphasis"><em>password</em></span> module.
</p></dd><dt><span class="term">
<code class="option">dictpath=<em class="replaceable"><code>/path/to/dict</code></em></code>
</span></dt><dd><p>
Path to the cracklib dictionaries.
</p></dd></dl></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-types"></a>6.2.3. MODULE TYPES PROVIDED</h3></div></div></div><p>
Only the <code class="option">password</code> module type is provided.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-return_values"></a>6.2.4. RETURN VALUES</h3></div></div></div><p>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">PAM_SUCCESS</span></dt><dd><p>
The new password passes all checks.
</p></dd><dt><span class="term">PAM_AUTHTOK_ERR</span></dt><dd><p>
No new password was entered,
the username could not be determined or the new
password fails the strength checks.
</p></dd><dt><span class="term">PAM_AUTHTOK_RECOVERY_ERR</span></dt><dd><p>
The old password was not supplied by a previous stacked
module or got not requested from the user.
The first error can happen if <code class="option">use_authtok</code>
is specified.
</p></dd><dt><span class="term">PAM_SERVICE_ERR</span></dt><dd><p>
A internal error occurred.
</p></dd></dl></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-examples"></a>6.2.5. EXAMPLES</h3></div></div></div><p>
For an example of the use of this module, we show how it may be
stacked with the password component of
<span class="citerefentry"><span class="refentrytitle">pam_unix</span>(8)</span>
</p><pre class="programlisting">
#
# These lines stack two password type modules. In this example the
# user is given 3 opportunities to enter a strong password. The
# "use_authtok" argument ensures that the pam_unix module does not
# prompt for a password, but instead uses the one provided by
# pam_cracklib.
#
passwd password required pam_cracklib.so retry=3
passwd password required pam_unix.so use_authtok
</pre><p>
</p><p>
Another example (in the <code class="filename">/etc/pam.d/passwd</code> format)
is for the case that you want to use md5 password encryption:
</p><pre class="programlisting">
#%PAM-1.0
#
# These lines allow a md5 systems to support passwords of at least 14
# bytes with extra credit of 2 for digits and 2 for others the new
# password must have at least three bytes that are not present in the
# old password
#
password required pam_cracklib.so \
difok=3 minlen=15 dcredit= 2 ocredit=2
password required pam_unix.so use_authtok nullok md5
</pre><p>
</p><p>
And here is another example in case you don't want to use credits:
</p><pre class="programlisting">
#%PAM-1.0
#
# These lines require the user to select a password with a minimum
# length of 8 and with at least 1 digit number, 1 upper case letter,
# and 1 other character
#
password required pam_cracklib.so \
dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8
password required pam_unix.so use_authtok nullok md5
</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="sag-pam_cracklib-author"></a>6.2.6. AUTHOR</h3></div></div></div><p>
pam_cracklib was written by Cristian Gafton <gafton@redhat.com>
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sag-pam_access.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sag-module-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sag-pam_debug.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.1. pam_access - logdaemon style login access control </td><td width="20%" align="center"><a accesskey="h" href="Linux-PAM_SAG.html">Home</a></td><td width="40%" align="right" valign="top"> 6.3. pam_debug - debug the PAM stack</td></tr></table></div></body></html>
SEA-GHOST - SHELL CODING BY SEA-GHOST