postgres built-in user turned uses CLOUD_IAM_SERVICE_ACCOUNT authentication

957 views
Skip to first unread message

Julian Eberius

unread,
Nov 12, 2021, 1:19:23 PM11/12/21
to Google Cloud SQL discuss
Hi everyone,

the default user "postgres", which should always use the authentication type "BUILT-IN", suddenly changed into a user with authentication "CLOUD_IAM_SERVICE_ACCOUNT", see attached screenshot. Consequently, we cannot login using the postgres account anymore, login fails with:

FATAL:  Cloud SQL IAM service account authentication failed for user "postgres"

which makes sense, as there is no matching IAM service account, etc. 
How can such a situation happen without visible cause? How can it be remedied, i.e., how to turn the postgres user back into a "BUILT-IN" user? The API does not seem to provide a way to do this.

Best regards,
Julian Eberius

p.s.: I later created a new account in the Console, and it also turned into a "IAM (service account)" user after a connection via cloud_sql_proxy ( this is not visible in the screenshot). How to stop this effect?Screenshot-postgres-is-IAM-service-account.png

wokmou

unread,
Nov 12, 2021, 4:52:05 PM11/12/21
to Google Cloud SQL discuss
The behavior described is to expected. There is an ongoing feature request [1] for this functionality to be added. 

Note that there are no ETAs or guarantees of implementation for feature requests. All communication regarding this feature request is to be done here[1].

Julian Eberius

unread,
Nov 15, 2021, 3:36:41 AM11/15/21
to Google Cloud SQL discuss
I meanwhile found the cause for this. I was manually re-assigning ownerships in an existing database, and in this operation ran "GRANT <serviceAccount> TO postgres". This allows to reproduce the behaviour consistently. Grant a role that is configured for IAM to a role that is built-in, and the built-in role will turn into IAM-enabled role which cannot be used for login, as no corresponding service account can exist. Remove the grant via "REVOKE <serviceAccount> FROM postgres" and the postgres user will turn back to a "Built-in".

Not sure if this is a bug, or just me stretching the limits of this Postgres/GCP-IAM bridge?

Thanks anyway,
Julian

Reply all
Reply to author
Forward
0 new messages