mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Remove support for password_encryption='off' / 'plain'.
Storing passwords in plaintext hasn't been a good idea for a very long time, if ever. Now seems like a good time to finally forbid it, since we're messing with this in PostgreSQL 10 anyway. Remove the CREATE/ALTER USER UNENCRYPTED PASSSWORD 'foo' syntax, since storing passwords unencrypted is no longer supported. ENCRYPTED PASSWORD 'foo' is still accepted, but ENCRYPTED is now just a noise-word, it does the same as just PASSWORD 'foo'. Likewise, remove the --unencrypted option from createuser, but accept --encrypted as a no-op for backward compatibility. AFAICS, --encrypted was a no-op even before this patch, because createuser encrypted the password before sending it to the server even if --encrypted was not specified. It added the ENCRYPTED keyword to the SQL command, but since the password was already in encrypted form, it didn't make any difference. The documentation was not clear on whether that was intended or not, but it's moot now. Also, while password_encryption='on' is still accepted as an alias for 'md5', it is now marked as hidden, so that it is not listed as an accepted value in error hints, for example. That's not directly related to removing 'plain', but it seems better this way. Reviewed by Michael Paquier Discussion: https://www.postgresql.org/message-id/16e9b768-fd78-0b12-cfc1-7b6b7f238fde@iki.fi
This commit is contained in:
@@ -1188,14 +1188,16 @@ include_dir 'conf.d'
|
||||
<listitem>
|
||||
<para>
|
||||
When a password is specified in <xref linkend="sql-createrole"> or
|
||||
<xref linkend="sql-alterrole"> without writing either <literal>ENCRYPTED</>
|
||||
or <literal>UNENCRYPTED</>, this parameter determines whether the
|
||||
password is to be encrypted. The default value is <literal>md5</>, which
|
||||
stores the password as an MD5 hash. Setting this to <literal>plain</> stores
|
||||
it in plaintext. <literal>on</> and <literal>off</> are also accepted, as
|
||||
aliases for <literal>md5</> and <literal>plain</>, respectively. Setting
|
||||
this parameter to <literal>scram-sha-256</> will encrypt the password
|
||||
with SCRAM-SHA-256.
|
||||
<xref linkend="sql-alterrole">, this parameter determines the algorithm
|
||||
to use to encrypt the password. The default value is <literal>md5</>,
|
||||
which stores the password as an MD5 hash (<literal>on</> is also
|
||||
accepted, as alias for <literal>md5</>). Setting this parameter to
|
||||
<literal>scram-sha-256</> will encrypt the password with SCRAM-SHA-256.
|
||||
</para>
|
||||
<para>
|
||||
Note that older clients might lack support for the SCRAM authentication
|
||||
mechanism, and hence not work with passwords encrypted with
|
||||
SCRAM-SHA-256.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@@ -33,7 +33,7 @@ ALTER ROLE <replaceable class="PARAMETER">role_specification</replaceable> [ WIT
|
||||
| REPLICATION | NOREPLICATION
|
||||
| BYPASSRLS | NOBYPASSRLS
|
||||
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
|
||||
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| [ ENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
|
||||
|
||||
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
@@ -168,9 +168,7 @@ ALTER ROLE { <replaceable class="PARAMETER">role_specification</replaceable> | A
|
||||
<term><literal>BYPASSRLS</literal></term>
|
||||
<term><literal>NOBYPASSRLS</literal></term>
|
||||
<term><literal>CONNECTION LIMIT</literal> <replaceable class="parameter">connlimit</replaceable></term>
|
||||
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
|
||||
<term><literal>ENCRYPTED</></term>
|
||||
<term><literal>UNENCRYPTED</></term>
|
||||
<term>[ <literal>ENCRYPTED</> ] <literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
|
||||
<term><literal>VALID UNTIL</literal> '<replaceable class="parameter">timestamp</replaceable>'</term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@@ -33,7 +33,7 @@ ALTER USER <replaceable class="PARAMETER">role_specification</replaceable> [ WIT
|
||||
| REPLICATION | NOREPLICATION
|
||||
| BYPASSRLS | NOBYPASSRLS
|
||||
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
|
||||
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| [ ENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
|
||||
|
||||
ALTER USER <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
|
@@ -30,7 +30,7 @@ CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <repla
|
||||
| CREATEROLE | NOCREATEROLE
|
||||
| INHERIT | NOINHERIT
|
||||
| LOGIN | NOLOGIN
|
||||
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| [ ENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
|
||||
| IN ROLE <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
| IN GROUP <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
|
@@ -33,7 +33,7 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
|
||||
| REPLICATION | NOREPLICATION
|
||||
| BYPASSRLS | NOBYPASSRLS
|
||||
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
|
||||
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| [ ENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
|
||||
| IN ROLE <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
| IN GROUP <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
@@ -207,7 +207,7 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
|
||||
<term>[ <literal>ENCRYPTED</> ] <literal>PASSWORD</> <replaceable class="parameter">password</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the role's password. (A password is only of use for
|
||||
@@ -219,30 +219,18 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
|
||||
user. A null password can optionally be written explicitly as
|
||||
<literal>PASSWORD NULL</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>ENCRYPTED</></term>
|
||||
<term><literal>UNENCRYPTED</></term>
|
||||
<listitem>
|
||||
<para>
|
||||
These key words control whether the password is stored
|
||||
encrypted in the system catalogs. (If neither is specified,
|
||||
the default behavior is determined by the configuration
|
||||
parameter <xref linkend="guc-password-encryption">.) If the
|
||||
presented password string is already in MD5-encrypted or
|
||||
SCRAM-encrypted format, then it is stored encrypted as-is,
|
||||
regardless of whether <literal>ENCRYPTED</> or <literal>UNENCRYPTED</>
|
||||
is specified (since the system cannot decrypt the specified encrypted
|
||||
password string). This allows reloading of encrypted passwords
|
||||
The password is always stored encrypted in the system catalogs. The
|
||||
<literal>ENCRYPTED</> keyword has no effect, but is accepted for
|
||||
backwards compatibility. The method of encryption is determined
|
||||
by the configuration parameter <xref linkend="guc-password-encryption">.
|
||||
If the presented password string is already in MD5-encrypted or
|
||||
SCRAM-encrypted format, then it is stored as-is regardless of
|
||||
<varname>password_encryption</> (since the system cannot decrypt
|
||||
the specified encrypted password string, to encrypt it in a
|
||||
different format). This allows reloading of encrypted passwords
|
||||
during dump/restore.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that older clients might lack support for the SCRAM
|
||||
authentication mechanism.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -33,7 +33,7 @@ CREATE USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
|
||||
| REPLICATION | NOREPLICATION
|
||||
| BYPASSRLS | NOBYPASSRLS
|
||||
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
|
||||
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| [ ENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
||||
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
|
||||
| IN ROLE <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
| IN GROUP <replaceable class="PARAMETER">role_name</replaceable> [, ...]
|
||||
|
@@ -124,8 +124,8 @@ PostgreSQL documentation
|
||||
<term><option>--encrypted</></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Encrypts the user's password stored in the database. If not
|
||||
specified, the default password behavior is used.
|
||||
This option is obsolete but still accepted for backward
|
||||
compatibility.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -204,17 +204,6 @@ PostgreSQL documentation
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-N</></term>
|
||||
<term><option>--unencrypted</></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Does not encrypt the user's password stored in the database. If
|
||||
not specified, the default password behavior is used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-P</></term>
|
||||
<term><option>--pwprompt</></term>
|
||||
@@ -481,11 +470,7 @@ PostgreSQL documentation
|
||||
</screen>
|
||||
In the above example, the new password isn't actually echoed when typed,
|
||||
but we show what was typed for clarity. As you see, the password is
|
||||
encrypted before it is sent to the client. If the option <option>--unencrypted</option>
|
||||
is used, the password <emphasis>will</> appear in the echoed command
|
||||
(and possibly also in the server log and elsewhere),
|
||||
so you don't want to use <option>-e</> in that case, if
|
||||
anyone else can see your screen.
|
||||
encrypted before it is sent to the client.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
Reference in New Issue
Block a user