2010-09-20 16:08:53 -04:00
|
|
|
<!-- doc/src/sgml/passwordcheck.sgml -->
|
2009-11-18 16:57:56 -05:00
|
|
|
|
2011-05-07 22:29:20 -04:00
|
|
|
<sect1 id="passwordcheck" xreflabel="passwordcheck">
|
2009-11-18 16:57:56 -05:00
|
|
|
<title>passwordcheck</title>
|
|
|
|
|
|
|
|
|
|
<indexterm zone="passwordcheck">
|
|
|
|
|
<primary>passwordcheck</primary>
|
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The <filename>passwordcheck</filename> module checks users' passwords
|
|
|
|
|
whenever they are set with
|
2017-11-23 09:39:47 -05:00
|
|
|
<xref linkend="sql-createrole"/> or
|
|
|
|
|
<xref linkend="sql-alterrole"/>.
|
2009-11-18 16:57:56 -05:00
|
|
|
If a password is considered too weak, it will be rejected and
|
|
|
|
|
the command will terminate with an error.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
To enable this module, add <literal>'$libdir/passwordcheck'</literal>
|
2017-11-23 09:39:47 -05:00
|
|
|
to <xref linkend="guc-shared-preload-libraries"/> in
|
2009-11-18 16:57:56 -05:00
|
|
|
<filename>postgresql.conf</filename>, then restart the server.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
You can adapt this module to your needs by changing the source code.
|
|
|
|
|
For example, you can use
|
2018-07-16 04:44:06 -04:00
|
|
|
<ulink url="https://sourceforge.net/projects/cracklib/">CrackLib</ulink>
|
2009-11-18 16:57:56 -05:00
|
|
|
to check passwords — this only requires uncommenting
|
|
|
|
|
two lines in the <filename>Makefile</filename> and rebuilding the
|
|
|
|
|
module. (We cannot include <productname>CrackLib</productname>
|
|
|
|
|
by default for license reasons.)
|
|
|
|
|
Without <productname>CrackLib</productname>, the module enforces a few
|
|
|
|
|
simple rules for password strength, which you can modify or extend
|
|
|
|
|
as you see fit.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<caution>
|
|
|
|
|
<para>
|
|
|
|
|
To prevent unencrypted passwords from being sent across the network,
|
|
|
|
|
written to the server log or otherwise stolen by a database administrator,
|
|
|
|
|
<productname>PostgreSQL</productname> allows the user to supply
|
|
|
|
|
pre-encrypted passwords. Many client programs make use of this
|
|
|
|
|
functionality and encrypt the password before sending it to the server.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
This limits the usefulness of the <filename>passwordcheck</filename>
|
|
|
|
|
module, because in that case it can only try to guess the password.
|
|
|
|
|
For this reason, <filename>passwordcheck</filename> is not
|
2012-08-14 12:36:35 -04:00
|
|
|
recommended if your security requirements are high.
|
2014-01-15 11:24:01 -05:00
|
|
|
It is more secure to use an external authentication method such as GSSAPI
|
2017-11-23 09:39:47 -05:00
|
|
|
(see <xref linkend="client-authentication"/>) than to rely on
|
2009-11-18 16:57:56 -05:00
|
|
|
passwords within the database.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
Alternatively, you could modify <filename>passwordcheck</filename>
|
|
|
|
|
to reject pre-encrypted passwords, but forcing users to set their
|
|
|
|
|
passwords in clear text carries its own security risks.
|
|
|
|
|
</para>
|
|
|
|
|
</caution>
|
|
|
|
|
|
|
|
|
|
</sect1>
|