-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use --auto-iam-authn in my deployment.flile and also getting Access denied for user <user_iam>@'cloudsqlproxy~ip' #2341
Comments
@Levi-coder07 Thanks for raising an issue on the Cloud SQL Proxy! TLDR; Only the SA used to start the Cloud SQL Proxy can login to the database with IAM AuthN For Cloud SQL IAM Database AuthN to work correctly the IAM principal used to invoke/start the Proxy must match that of the IAM principal being used as the IAM database user.
If you are starting the Proxy with a Kubernetes service account impersonating an IAM service account, only this SA will be able to login via the Proxy with IAM database authN. There are two potential solutions to this issue:
How to use the Proxy with SA impersonationn: Lines 193 to 218 in 9cb444c
Let me know if you need any further clarification or assistance, happy to help more 😄 |
@jackwotherspoon So u mean , if I run proxy using my service account , like this : and when try to connect using my IAM user and face the the error: psql: error: connection to server at "127.0.0.1", port 5432 failed: FATAL: Cloud SQL IAM user authentication failed for user "[email protected]" It is expected behaviour , because my IAM user is not equal to sa which I use to run the proxy ? |
@fragile-ds This is exactly correct, it is expected behaviour. In the example you provided you will only be able to login using IAM service account principal from The IAM Principal (SA or User) used to invoke/start the Proxy must equal the IAM Principal used to login to the database with IAM database AuthN. |
Going to close this out for the time being, if required feel free to re-open 😄 |
@jackwotherspoon U saved my evening , best of us, thx a lot) |
Question
How to use --auto-iam-authn correctly and ensure that it works?
Code
Additional Details
The proxy works like a charm with the KSA binded with GSA but when i want to enter with the sa-backend-iam with --auto-iam-authn i get the error
Access denied for user 'sa-backend-iam'@'cloudsqlproxy~179.63.4.243' (using password: YES)
The text was updated successfully, but these errors were encountered: