You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm currently generating unique hostnames (with separate IP addresses) on a common port for customers to connect to my architecture. I'd like to consolidate all of this to a single hostname (with the same common port), but be able to route customers to specific databases based on the username they are authenticating with. Is this possible?
You can alias any database name to any database or server using database in the config (e.g. https://github.com/postgresml/pgcat/blob/main/pgcat.toml#L309). So as long as your client can provide both the username and a database name, which can be the same as the username, you can route them to the appropriate pool, which in turn will connect to the right server and Postgres database.
For client authentication, we only support MD5. For server authentication,we support MD5 and SCRAM (SASL). If you want to add cleartext for either, a PR is welcome!
In terms of difficulty, clear text is the simplest one, so it should be pretty much like how you described. Just make sure the payload is correct. Client code is very dependent of md5, so it needs to be refactored a bit and maybe a config option to indicate which auth method we want the pooler to use. For the server, it's just another algorithm, which should be pretty simple.
Activity
levkk commentedon Jul 14, 2023
Hi,
Currently we route by username and database name, see
get_pool(e.g. https://github.com/postgresml/pgcat/blob/main/src/client.rs#L528). Routing by username only is not specific enough when dealing with multiple databases proxied by the same pooler.You can alias any database name to any database or server using
databasein the config (e.g. https://github.com/postgresml/pgcat/blob/main/pgcat.toml#L309). So as long as your client can provide both the username and a database name, which can be the same as the username, you can route them to the appropriate pool, which in turn will connect to the right server and Postgres database.jplock commentedon Jul 14, 2023
Thank you, I'll test that out
jplock commentedon Jul 14, 2023
How difficult would it be to support
AuthenticationCleartextPassword(auth_code3) from https://www.postgresql.org/docs/12/protocol-message-formats.html ?I'm trying to use pgcat against a PostgreSQL-compatible SaaS service that says its wire compatible, but was receiving these messages while debugging:
I've never coded in Rust before, but I think if we define a
CLEARTEXT_PASSWORDconstant ofin
constants.rsthen match on it here https://github.com/postgresml/pgcat/blob/main/src/server.rs#L398, we could send in the password in cleartext.which I don't think this is correctly sending the password to the server because the logs end up printing:
levkk commentedon Jul 14, 2023
For client authentication, we only support MD5. For server authentication,we support MD5 and SCRAM (SASL). If you want to add cleartext for either, a PR is welcome!
In terms of difficulty, clear text is the simplest one, so it should be pretty much like how you described. Just make sure the payload is correct. Client code is very dependent of md5, so it needs to be refactored a bit and maybe a config option to indicate which auth method we want the pooler to use. For the server, it's just another algorithm, which should be pretty simple.
jplock commentedon Jul 14, 2023
Looks like I’m running into what has already been reported. #487
The system I’m connecting to is using TLS and clear text as others have mentioned. Will look into creating a PR.