Re: postgres_fdw, dblink, and CREATE SUBSCRIPTION security - Mailing list pgsql-hackers
From | Jacob Champion |
---|---|
Subject | Re: postgres_fdw, dblink, and CREATE SUBSCRIPTION security |
Date | |
Msg-id | cb43e26f-d897-447c-a795-b3954815f371@timescale.com Whole thread Raw |
In response to | Re: postgres_fdw, dblink, and CREATE SUBSCRIPTION security (Robert Haas <robertmhaas@gmail.com>) |
Responses |
Re: postgres_fdw, dblink, and CREATE SUBSCRIPTION security
|
List | pgsql-hackers |
On 2/6/23 08:22, Robert Haas wrote: > I don't think that's quite the right concept. It seems to me that the > client is responsible for informing the server of what the situation > is, and the server is responsible for deciding whether to allow the > connection. In your scenario, the client is not only communicating > information ("here's the password I have got") but also making demands > on the server ("DO NOT authenticate using anything else"). I like the > first part fine, but not the second part. For what it's worth, making a negative demand during authentication is pretty standard: if you visit example.com and it tells you "I need your OS login password and Social Security Number to authenticate you," you have the option of saying "no thanks" and closing the tab. It's not really about protecting the server at that point; the server can protect itself. It's about protecting *you*. Allowing the proxy to pin a specific set of authentication details to the connection is just a way for it to close the tab on a server that would otherwise pull some other piece of ambient authority out of it. In a hypothetical world where the server presented the client with a list of authentication options before allowing any access, this would maybe be a little less convoluted to solve. For example, a proxy seeing a SASL list of - ANONYMOUS - EXTERNAL could understand that both methods allow the client to assume the authority of the proxy itself. So if its client isn't allowed to do that, the proxy realizes something is wrong (either it, or its target server, has been misconfigured or is under attack), and it can close the connection *before* the server runs login triggers. > In this kind of scenario, the client has no business > demanding that the server authenticate using the password rather than > anything else. The server, not the client, is in charge of deciding > which connections to accept; the client's job is only to decide which > connections to proxy. This sounds like a reasonable separation of responsibilities on the surface, but I think it's subtly off. The entire confused-deputy problem space revolves around the proxy being unable to correctly decide which connections to allow unless it also knows why the connections are being authorized. You've constructed an example where that's not a concern: everything's symmetrical, all proxies operate with the same authority, and internal users are identical to external users. But the CVE that led to the password requirement, as far as I can tell, dealt with asymmetry. The proxy had the authority to connect locally to a user, and the clients had the authority to connect to other machines' users, but those users weren't the same and were not mutually trusting. > And the human being is responsible for making > sure that the combination of those two things implements the intended > security policy. Sure, but upthread it was illustrated how difficult it is for even the people implementing the protocol to reason through what's safe and what's not. The primitives we're providing in the protocol are, IMO, difficult to wield safely for more complex use cases. We can provide mitigations, and demand that the DBA reason through every combination, and tell them "don't do that" when they screw up or come across a situation that our mitigations can't paper over. But I think we can solve the root problem instead. > We > could do something that looks more like a series of if-then rules, > e.g. > > target-host 127.0.0.0/8 => reject > authentication-method scram => accept > reject Yeah, I think something based on allow/deny is going to be the most intuitive. > But it's only a hop, skip and a jump from there to something that > looks an awful lot like a full-blown programing language, and maybe > that's even the right idea, but, oh, the bike-shedding! Eh. Someone will demand Turing-completeness eventually, but you don't have to listen. :D --Jacob
pgsql-hackers by date: