Skip to content
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

Support IAM database authentication for Postgres datastore #659

Closed
jhalleeupgrade opened this issue Jun 22, 2022 · 8 comments · Fixed by #1858
Closed

Support IAM database authentication for Postgres datastore #659

jhalleeupgrade opened this issue Jun 22, 2022 · 8 comments · Fixed by #1858
Labels
area/datastore Affects the storage system priority/3 low This would be nice to have state/needs discussion This can't be worked on yet

Comments

@jhalleeupgrade
Copy link

As of now, there is only support for username:password in the connection string for Postgres. For those who use an AWS's hosted Postgres, it's preferable to use IAM database authentication.

@josephschorr
Copy link
Member

@jhalleeupgrade any pointers on documentation on how that is enabled?

@josephschorr josephschorr added priority/3 low This would be nice to have area/datastore Affects the storage system state/needs discussion This can't be worked on yet labels Jun 22, 2022
@jhalleeupgrade
Copy link
Author

@josephschorr Sure!
A good starting point for documentation would be: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.Connecting.Go.html

@jzelinskie
Copy link
Member

cc @ecordell who will probably have opinions on the UX of how this is configured

@jzelinskie
Copy link
Member

I'm not sure what the best CLI UX looks like for this feature.

Because it looks like the password field is overloaded to provide this functionality, there is an interesting workaround that could be done now: write a tiny program that prints the output of rdsutils.BuildAuthToken() and then just use that value for the password on the SpiceDB serve command: spicedb serve --datastore-engine postgres --datastore-uri "host=blahblah password=$(myProgram) ...".

@palacerteupgrade
Copy link

@jzelinskie I think we would need to provide a way to refresh at runtime, because the AWS Auth token has an expiration deadline.

@jzelinskie
Copy link
Member

You're totally right that the value actually is short-lived. There's a lot of good discussion on this issue for our Postgres library. It looks like we should decide the UX for this and then we can add a BeforeConnect hook for connections to inject the "password" into the config.

@theantirobot
Copy link

It looks like the postgres library supports an environment variable that specifies a password file whose value is read at connection time. If that's right then one way of using IAM database authentication today for a SpiceDB Postgres datastore is to run a script that re-writes the file at an interval appropriate for keeping credentials valid. Maybe some people might prefer the service file over the password file.

@elebiodaslingshot
Copy link

Any updates on this?

j-white added a commit to j-white/spicedb that referenced this issue Apr 6, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 6, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 6, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 6, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 6, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 7, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 11, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 11, 2024
j-white added a commit to j-white/spicedb that referenced this issue Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datastore Affects the storage system priority/3 low This would be nice to have state/needs discussion This can't be worked on yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants