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

pgwire/hba: enable filtering logins by role, not just username #51596

Open
knz opened this issue Jul 20, 2020 · 3 comments
Open

pgwire/hba: enable filtering logins by role, not just username #51596

knz opened this issue Jul 20, 2020 · 3 comments
Labels
A-authentication Pertains to authn subsystems A-security A-sql-pgwire pgwire protocol issues. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@knz
Copy link
Contributor

knz commented Jul 20, 2020

This is one of the requirements for #51453: we want to support a constraint on the role(s) of a user in the "username" constraint column of the HBA config, like postgres does.

The idea is that if the HBA rule says

host all admin all reject

then any login attempt by a user in the role admin should be rejected by this rule.

There are two foreseen uses for this:

  • restrict the CC backuper: prevent end-users from logging in as the CC management role (which is not full admin, just a subset) to launch backups.
  • restrict admin for CC end-users: prevent end-users from using an admin account to log in.

Jira issue: CRDB-4028

@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-pgwire pgwire protocol issues. A-security labels Jul 20, 2020
@knz knz added this to To do in DB Server & Security via automation Jul 20, 2020
@bdarnell
Copy link
Member

Our implementation of hba.conf has more DoS possibilities than postgresql's, because we store this configuration in the database, so you need to be able to log in to fix it if it's broken. host all admin all reject would lock out the root account too, leaving you with no way to get back in (and special-casing root would partially defeat the purpose of this feature). We need to be careful about the potential for misconfiguration and recovery paths if we build this feature.

@knz
Copy link
Contributor Author

knz commented Jul 21, 2020

and special-casing root would partially defeat the purpose of this feature

root is currently already special-cased. We could change the special case though, from a cert-password method to just cert, and say that the only way to log in is via a root cert (which presumably a good-minded CA will refuse to issue except to DBAs, and which will be closely guarded).

@knz knz moved this from To do to Linked issues (see roadmap) in DB Server & Security Jul 30, 2020
@jlinder jlinder added the T-server-and-security DB Server & Security label Jun 16, 2021
@knz knz added the A-authentication Pertains to authn subsystems label Jul 29, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) and removed T-server-and-security DB Server & Security no-issue-activity labels Sep 12, 2023
@blathers-crl blathers-crl bot added this to Triage in SQL Foundations Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-authentication Pertains to authn subsystems A-security A-sql-pgwire pgwire protocol issues. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
DB Server & Security
  
Linked issues (from the roadmap colum...
SQL Foundations
  
Triage
Development

No branches or pull requests

3 participants