This message was deleted.
# general
m
This message was deleted.
t
We're moving away from password based account to IAM Authentication, and Ory is the last service in our infrastructure to be moved, but it seems like it might not be possible
s
how does IAM based auth work there? do you not need some kind of credential?
t
behind the scenes it uses an access token, which in GCP's case offloaded to Cloud SQL Auth proxy. The service (eg Hydra) has an IAM Role attached to the instance (or Kubernetes Pod), and Cloud SQL authenticates against that IAM Role. More context on how it all works here: https://cloud.google.com/sql/docs/postgres/authentication. AWS has a similar ability too. So for example, the DSN would just be something like
<postgresql://auth-hydra>%40{gcp_project}.iam@localhost:5432/auth-hydra
localhost
in this case is the cloud SQL auth proxy, the auth proxy then authenticates using the IAM Service Account.
It's generally a best practice for GCP now, and it's something we use across the board. Cloud SQL Auth Proxy also does things like encryption to and from the database etc too. Ory is the only tooling we use that we don't have this enabled on yet
s
ok makes sense, so we just have to drop the requirement for passwords? not sure if that is on our side or upstream lib though...
t
Yeah that's right - from what I could see it looks like it's on Ory's side. We had a similar behaviour to you originally where we constructed/validated the DSN and had the assumption that we'd always set a password. For example, here's one place I noticed it where it matches on an assumption of a password existing;
%s://*:*@%s
`https://github.com/ory/x/blob/master/sqlcon/connector.go#L55
I could be wrong though, I only had a quick scan through GitHub
Hey @steep-lamp-91158 If this is something that can be implemented, will there be a public issue/ticket I can track, so that I can stay in the loop of when we can move over to IAM Auth?
s
Please create one, I didn't have time yet
Contributions always welcome, maybe it is enough to lax the validation you found