1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.24. passwordcheck — verify password strength</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pageinspect.html" title="F.23. pageinspect — low-level inspection of database pages" /><link rel="next" href="pgbuffercache.html" title="F.25. pg_buffercache — inspect PostgreSQL buffer cache state" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.24. passwordcheck — verify password strength</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pageinspect.html" title="F.23. pageinspect — low-level inspection of database pages">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pgbuffercache.html" title="F.25. pg_buffercache — inspect PostgreSQL buffer cache state">Next</a></td></tr></table><hr /></div><div class="sect1" id="PASSWORDCHECK"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.24. passwordcheck — verify password strength <a href="#PASSWORDCHECK" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="passwordcheck.html#PASSWORDCHECK-CONFIGURATION-PARAMETERS">F.24.1. Configuration Parameters</a></span></dt></dl></div><a id="id-1.11.7.34.2" class="indexterm"></a><p>
3 The <code class="filename">passwordcheck</code> module checks users' passwords
4 whenever they are set with
5 <a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a> or
6 <a class="xref" href="sql-alterrole.html" title="ALTER ROLE"><span class="refentrytitle">ALTER ROLE</span></a>.
7 If a password is considered too weak, it will be rejected and
8 the command will terminate with an error.
10 To enable this module, add <code class="literal">'$libdir/passwordcheck'</code>
11 to <a class="xref" href="runtime-config-client.html#GUC-SHARED-PRELOAD-LIBRARIES">shared_preload_libraries</a> in
12 <code class="filename">postgresql.conf</code>, then restart the server.
14 You can adapt this module to your needs by changing the source code.
15 For example, you can use
16 <a class="ulink" href="https://github.com/cracklib/cracklib" target="_top">CrackLib</a>
17 to check passwords — this only requires uncommenting
18 two lines in the <code class="filename">Makefile</code> and rebuilding the
19 module. (We cannot include <span class="productname">CrackLib</span>
20 by default for license reasons.)
21 Without <span class="productname">CrackLib</span>, the module enforces a few
22 simple rules for password strength, which you can modify or extend
24 </p><div class="caution"><h3 class="title">Caution</h3><p>
25 To prevent unencrypted passwords from being sent across the network,
26 written to the server log or otherwise stolen by a database administrator,
27 <span class="productname">PostgreSQL</span> allows the user to supply
28 pre-encrypted passwords. Many client programs make use of this
29 functionality and encrypt the password before sending it to the server.
31 This limits the usefulness of the <code class="filename">passwordcheck</code>
32 module, because in that case it can only try to guess the password.
33 For this reason, <code class="filename">passwordcheck</code> is not
34 recommended if your security requirements are high.
35 It is more secure to use an external authentication method such as GSSAPI
36 (see <a class="xref" href="client-authentication.html" title="Chapter 20. Client Authentication">Chapter 20</a>) than to rely on
37 passwords within the database.
39 Alternatively, you could modify <code class="filename">passwordcheck</code>
40 to reject pre-encrypted passwords, but forcing users to set their
41 passwords in clear text carries its own security risks.
42 </p></div><div class="sect2" id="PASSWORDCHECK-CONFIGURATION-PARAMETERS"><div class="titlepage"><div><div><h3 class="title">F.24.1. Configuration Parameters <a href="#PASSWORDCHECK-CONFIGURATION-PARAMETERS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
43 <code class="varname">passwordcheck.min_password_length</code> (<code class="type">integer</code>)
44 <a id="id-1.11.7.34.7.2.1.1.3" class="indexterm"></a>
46 The minimum acceptable password length in bytes. The default is 8. Only
47 superusers can change this setting.
48 </p><div class="note"><h3 class="title">Note</h3><p>
49 This parameter has no effect if a user supplies a pre-encrypted
51 </p></div></dd></dl></div><p>
52 In ordinary usage, this parameter is set in
53 <code class="filename">postgresql.conf</code>, but superusers can alter it on-the-fly
54 within their own sessions. Typical usage might be:
55 </p><pre class="programlisting">
57 passwordcheck.min_password_length = 12
58 </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pageinspect.html" title="F.23. pageinspect — low-level inspection of database pages">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pgbuffercache.html" title="F.25. pg_buffercache — inspect PostgreSQL buffer cache state">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.23. pageinspect — low-level inspection of database pages </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.25. pg_buffercache — inspect <span class="productname">PostgreSQL</span>
59 buffer cache state</td></tr></table></div></body></html>