]> granicus.if.org Git - postgresql/blob - doc/src/sgml/chkpass.sgml
Move most /contrib README files into SGML. Some still need conversion
[postgresql] / doc / src / sgml / chkpass.sgml
1 <sect1 id="chkpass">
2  <title>chkpass</title> 
3  
4  <!--
5  <indexterm zone="chkpass">
6   <primary>chkpass</primary>
7  </indexterm>
8  -->
9  <para>
10   chkpass is a password type that is automatically checked and converted upon
11   entry.  It is stored encrypted.  To compare, simply compare against a clear
12   text password and the comparison function will encrypt it before comparing.
13   It also returns an error if the code determines that the password is easily
14   crackable.  This is currently a stub that does nothing.
15  </para>
16
17  <para>
18   Note that the chkpass data type is not indexable.
19   <!--
20   I haven't worried about making this type indexable.  I doubt that anyone
21   would ever need to sort a file in order of encrypted password.
22   -->
23  </para>
24
25  <para>
26   If you precede the string with a colon, the encryption and checking are
27   skipped so that you can enter existing passwords into the field.
28  </para>
29
30  <para>
31   On output, a colon is prepended.  This makes it possible to dump and reload
32   passwords without re-encrypting them.  If you want the password (encrypted)
33   without the colon then use the raw() function.  This allows you to use the
34   type with things like Apache's Auth_PostgreSQL module.
35  </para>
36
37  <para>
38   The encryption uses the standard Unix function crypt(), and so it suffers
39   from all the usual limitations of that function; notably that only the
40   first eight characters of a password are considered.
41  </para>
42
43  <para>
44   Here is some sample usage:
45  </para>
46
47  <programlisting>
48 test=# create table test (p chkpass);
49 CREATE TABLE
50 test=# insert into test values ('hello');
51 INSERT 0 1
52 test=# select * from test;
53        p
54 ----------------
55  :dVGkpXdOrE3ko
56 (1 row)
57
58 test=# select raw(p) from test;
59       raw
60 ---------------
61  dVGkpXdOrE3ko
62 (1 row)
63
64 test=# select p = 'hello' from test;
65  ?column?
66 ----------
67  t
68 (1 row)
69
70 test=# select p = 'goodbye' from test;
71  ?column?
72 ----------
73  f
74 (1 row)
75  </programlisting>
76
77  <sect2>
78   <title>Author</title>
79   <para>
80    D'Arcy J.M. Cain <email>darcy@druid.net</email>
81   </para>
82  </sect2>
83 </sect1>
84