Add "host" to startup packet

From: Lev Kokotov <lev(at)hyperparam(dot)ai>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add "host" to startup packet
Date: 2023-04-01 00:23:28
Message-ID: CANvSX4wUDWXs9LDqDdGMgOA+MR2s1VDsRT1GGrK4moGZgqAM6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

Patch attached below. TLDR, I'd like to add "host" to the startup packet.

I'm trying to run multiple Postgres servers in a multi-tenant environment
behind a pooler <https://github.com/postgresml/pgcat>. Currently, the only
way to differentiate Postgres databases is with the user/dbname combination
which are very often included in the startup packet by the client. However,
that's not sufficient if you have users that all want to have the user
"admin" and the database "production" :)

HTTP hosting providers solved this using the "Host" header, allowing the
server to identify which website the client wants. In the case of Postgres,
this is the DNS or IP address, depending on the client configuration.

Upon receiving a startup packet with user, dbname, and host, the pooler
(acting also as a proxy) can validate that the credentials exist for the
host and that they are valid, and authorize or decline the connection.

I have never submitted a patch for Postgres before, so I'm not entirely
sure how to test this change, although it seems pretty harmless. Any
feedback and help are appreciated!

Thank you!

Best,
Lev

Attachment Content-Type Size
host.patch application/octet-stream 585 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2023-04-01 00:24:35 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode
Previous Message Justin Pryzby 2023-04-01 00:13:38 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode