From: Nathan Bossart <nathandbossart@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Should we remove db_user_namespace?
Date: Wed, 5 Jul 2023 14:29:27 -0700
Message-ID: <20230705212927.GA3518200@nathanxps13> (raw)
In-Reply-To: <ZKJ2xwbI1onh5hHB@paquier.xyz>
References: <20230630200509.GA2830328@nathanxps13>
<ZKJ2xwbI1onh5hHB@paquier.xyz>
On Mon, Jul 03, 2023 at 04:20:39PM +0900, Michael Paquier wrote:
> I am on the side of +1'ing for the removal.
Here is a rebased version of the patch. So far no one has responded to the
pgsql-general thread [0], and no one here has argued for keeping this
parameter. I'm planning to bump the pgsql-general thread next week to give
folks one more opportunity to object.
[0] https://postgr.es/m/20230630215608.GD2941194%40nathanxps13
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.comAttachments:v3-0001-remove-db_user_namespace.patch (text/x-diff, 8.0K) download
From 3d46751ec7fa55d2ab776a9cb47533fe77ab0739 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <nathan@postgresql.org>
Date: Fri, 30 Jun 2023 12:46:08 -0700
Subject: [PATCH v3 1/1] remove db_user_namespace
---
doc/src/sgml/client-auth.sgml | 5 --
doc/src/sgml/config.sgml | 52 -------------------
src/backend/libpq/auth.c | 5 --
src/backend/libpq/hba.c | 12 -----
src/backend/postmaster/postmaster.c | 19 -------
src/backend/utils/misc/guc_tables.c | 9 ----
src/backend/utils/misc/postgresql.conf.sample | 1 -
src/include/libpq/pqcomm.h | 2 -
8 files changed, 105 deletions(-)
diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgmlindex 204d09df67..6c95f0df1e 100644--- a/doc/src/sgml/client-auth.sgml+++ b/doc/src/sgml/client-auth.sgml@@ -1253,11 +1253,6 @@ omicron bryanh guest1
attacks.
</para>
- <para>- The <literal>md5</literal> method cannot be used with- the <xref linkend="guc-db-user-namespace"/> feature.- </para>-
<para>
To ease transition from the <literal>md5</literal> method to the newer
SCRAM method, if <literal>md5</literal> is specified as a method
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgmlindex 6262cb7bb2..e6cea8ddfc 100644--- a/doc/src/sgml/config.sgml+++ b/doc/src/sgml/config.sgml@@ -1188,58 +1188,6 @@ include_dir 'conf.d'
</para>
</listitem>
</varlistentry>
-- <varlistentry id="guc-db-user-namespace" xreflabel="db_user_namespace">- <term><varname>db_user_namespace</varname> (<type>boolean</type>)- <indexterm>- <primary><varname>db_user_namespace</varname> configuration parameter</primary>- </indexterm>- </term>- <listitem>- <para>- This parameter enables per-database user names. It is off by default.- This parameter can only be set in the <filename>postgresql.conf</filename>- file or on the server command line.- </para>-- <para>- If this is on, you should create users as <replaceable>username@dbname</replaceable>.- When <replaceable>username</replaceable> is passed by a connecting client,- <literal>@</literal> and the database name are appended to the user- name and that database-specific user name is looked up by the- server. Note that when you create users with names containing- <literal>@</literal> within the SQL environment, you will need to- quote the user name.- </para>-- <para>- With this parameter enabled, you can still create ordinary global- users. Simply append <literal>@</literal> when specifying the user- name in the client, e.g., <literal>joe@</literal>. The <literal>@</literal>- will be stripped off before the user name is looked up by the- server.- </para>-- <para>- <varname>db_user_namespace</varname> causes the client's and- server's user name representation to differ.- Authentication checks are always done with the server's user name- so authentication methods must be configured for the- server's user name, not the client's. Because- <literal>md5</literal> uses the user name as salt on both the- client and server, <literal>md5</literal> cannot be used with- <varname>db_user_namespace</varname>.- </para>-- <note>- <para>- This feature is intended as a temporary measure until a- complete solution is found. At that time, this option will- be removed.- </para>- </note>- </listitem>- </varlistentry>
</variablelist>
</sect2>
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.cindex a98b934a8e..65d452f099 100644--- a/src/backend/libpq/auth.c+++ b/src/backend/libpq/auth.c@@ -873,11 +873,6 @@ CheckMD5Auth(Port *port, char *shadow_pass, const char **logdetail)
char *passwd;
int result;
- if (Db_user_namespace)- ereport(FATAL,- (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),- errmsg("MD5 authentication is not supported when \"db_user_namespace\" is enabled")));-
/* include the salt to use for computing the response */
if (!pg_strong_random(md5Salt, 4))
{
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.cindex f89f138f3c..5d4ddbb04d 100644--- a/src/backend/libpq/hba.c+++ b/src/backend/libpq/hba.c@@ -1741,19 +1741,7 @@ parse_hba_line(TokenizedAuthLine *tok_line, int elevel)
else if (strcmp(token->string, "reject") == 0)
parsedline->auth_method = uaReject;
else if (strcmp(token->string, "md5") == 0)
- {- if (Db_user_namespace)- {- ereport(elevel,- (errcode(ERRCODE_CONFIG_FILE_ERROR),- errmsg("MD5 authentication is not supported when \"db_user_namespace\" is enabled"),- errcontext("line %d of configuration file \"%s\"",- line_num, file_name)));- *err_msg = "MD5 authentication is not supported when \"db_user_namespace\" is enabled";- return NULL;- }
parsedline->auth_method = uaMD5;
- }
else if (strcmp(token->string, "scram-sha-256") == 0)
parsedline->auth_method = uaSCRAM;
else if (strcmp(token->string, "pam") == 0)
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.cindex 0b1de9efb2..9c8ec779f9 100644--- a/src/backend/postmaster/postmaster.c+++ b/src/backend/postmaster/postmaster.c@@ -236,7 +236,6 @@ int AuthenticationTimeout = 60;
bool log_hostname; /* for ps display and logging */
bool Log_connections = false;
-bool Db_user_namespace = false;
bool enable_bonjour = false;
char *bonjour_name;
@@ -2272,24 +2271,6 @@ retry1:
if (port->database_name == NULL || port->database_name[0] == '\0')
port->database_name = pstrdup(port->user_name);
- if (Db_user_namespace)- {- /*- * If user@, it is a global user, remove '@'. We only want to do this- * if there is an '@' at the end and no earlier in the user string or- * they may fake as a local user of another database attaching to this- * database.- */- if (strchr(port->user_name, '@') ==- port->user_name + strlen(port->user_name) - 1)- *strchr(port->user_name, '@') = '\0';- else- {- /* Append '@' and dbname */- port->user_name = psprintf("%s@%s", port->user_name, port->database_name);- }- }-
if (am_walsender)
MyBackendType = B_WAL_SENDER;
else
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.cindex f8ef87d26d..0c38af3f69 100644--- a/src/backend/utils/misc/guc_tables.c+++ b/src/backend/utils/misc/guc_tables.c@@ -1534,15 +1534,6 @@ struct config_bool ConfigureNamesBool[] =
false,
NULL, NULL, NULL
},
- {- {"db_user_namespace", PGC_SIGHUP, CONN_AUTH_AUTH,- gettext_noop("Enables per-database user names."),- NULL- },- &Db_user_namespace,- false,- NULL, NULL, NULL- },
{
{"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
gettext_noop("Sets the default read-only status of new transactions."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sampleindex e4c0269fa3..c768af9a73 100644--- a/src/backend/utils/misc/postgresql.conf.sample+++ b/src/backend/utils/misc/postgresql.conf.sample@@ -96,7 +96,6 @@
#authentication_timeout = 1min # 1s-600s
#password_encryption = scram-sha-256 # scram-sha-256 or md5
#scram_iterations = 4096
-#db_user_namespace = off
# GSSAPI using Kerberos
#krb_server_keyfile = 'FILE:${sysconfdir}/krb5.keytab'
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.hindex c85090259d..3da00f7983 100644--- a/src/include/libpq/pqcomm.h+++ b/src/include/libpq/pqcomm.h@@ -103,8 +103,6 @@ typedef ProtocolVersion MsgType;
typedef uint32 PacketLen;
-extern PGDLLIMPORT bool Db_user_namespace;-
/*
* In protocol 3.0 and later, the startup packet length is not fixed, but
* we set an arbitrary limit on it anyway. This is just to prevent simple
--
2.25.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, michael@paquier.xyz
Subject: Re: Should we remove db_user_namespace?
In-Reply-To: <20230705212927.GA3518200@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox