r/PostgreSQL • • 2d ago

Tools Beta test of user account admin tool

Post image

This may be completely niche, so probably not of interest to EVERYONE... but I wish a tool like this existed for me. It didn't, as far as I could tell... so I wrote it :-)

In case there are any others who might benefit from it, I thought I'd share it as open source.

https://github.com/ppbrown/postgres-user-control

It's available both as a standalone app, or a container (build yourself, or use my helm chart to pull my image)

The problem:

While standard application creds are somewhat fixed and static, we had a situation where a semi-large group of people (20+) required different levels of access to different postgres instances.
Furthermore, we had a need to sometimes grant temporary access to certain people, at certain times. And then revoke it.

All while ensuring that these access changes got logged, and user actions get logged too.

Plus at the same time, I wanted to migrate humans over to using some kind of SSO type login to the database, rather than manually fed passwords.

---

In theory, I might have chosen some ansible or terraform approach, but thats not very readable at a glance. This is.

I welcome people's constructive comments. Even, "you could have just used [this other tool] instead"

0 Upvotes

6 comments sorted by

2

u/AutoModerator 2d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

-3

u/lostinspaz 2d ago

Umm.... not sure what this is trying to say about my post?

1

u/Discordbothost 1d ago

I'd test expiry for someone who already has permanent access to the same role. After the temporary grant ends, check that the cleanup leaves their permanent access intact.

1

u/lostinspaz 1d ago

I think it’s safe for that by design. The system works by using predefined roles, one at a time. “temporary” access works by temporarily changing to a different role. When it’s time to change them back, you change them to their original role. There is no layering.

0

u/MongooseWonderful198 2d ago

The failure case I’d test first is temporary access across downtime. Grant a role for 15 minutes, stop this service before expiry, wait, then restart it. PostgreSQL’s password VALID UNTIL does not expire role membership, so the tool needs an authoritative expiry record and a startup reconciliation that revokes overdue grants.

I’d also make the audit show both the requested expiry and the actual revoke time. That distinguishes “the grant was configured correctly” from “the scheduler was alive when it needed to act,” which is the part operators will care about during an incident.

0

u/lostinspaz 1d ago

oh, interesting. Thank you for bringing that up. I had forgotten that pg has that “valid until” feature.

I should have mentioned that it does not do scheduled temporary access. You have to manually change it back. It just makes it very easy to do so.

SSO into the admin tool. couple of clicks, and it’s done. No chance of screwing up sql, and it’s color coded as an additional measure of avoiding wrong selection.