A bit scary. Was able to connect to my instance using google cloud sql proxy after deleting my service role account

310 views
Skip to first unread message

wob...@yblew.com

unread,
Mar 31, 2016, 12:49:47 PM3/31/16
to Google Cloud SQL discuss
A bit scary. Was able to connect to my instance using google cloud sql proxy after deleting my service role account

1. Created a service account under editor role

2. Was able to access my server using:

/usr/local/bin/cloud_sql_proxy -dir=/cloudsql -instances=my-project:us-central1:sql-instance=tcp:3306 -credential_file=/prod.json &

3. Deleted my service account

4. Was able to access my instance after deletion of service account using:

/usr/local/bin/cloud_sql_proxy -dir=/cloudsql -instances=my-project:us-central1:sql-instance=tcp:3306 -credential_file=/prod.json &

wob...@yblew.com

unread,
Mar 31, 2016, 1:55:15 PM3/31/16
to Google Cloud SQL discuss
after an hour, now i'm getting


Response: {
  "error" : "invalid_client",
  "error_description" : "The OAuth client was not found."
}


Does it take a while for google cloud sql proxy to sync up with changes to permissions?

paynen

unread,
Apr 4, 2016, 4:56:02 PM4/4/16
to Google Cloud SQL discuss
Hey wobeng@,

This is expected behaviour. The Service Account's credentials are used to get an access token via OAuth2. If that token isn't revoked, it will continue to work for the default 3600 seconds. I hope this helps clear up the behaviour you saw!

Cheers,

Nick
Cloud Platform Community Support

paynen

unread,
Apr 4, 2016, 4:57:29 PM4/4/16
to Google Cloud SQL discuss

Kevin Malachowski

unread,
Apr 4, 2016, 6:06:36 PM4/4/16
to Google Cloud SQL discuss
Another note: after removing an account's access, existing connections to the database will continue to work (even after the hour expiration you noticed). To break old connections (to combat this in the case a service account is compromised) you can restart your database or reset the SSL certificates on your database instance via our API.
Reply all
Reply to author
Forward
0 new messages