-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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,sql: user account expiration #41396
Comments
cc @BramGruneir |
Discussed this with @bdarnell today: we can add a column on |
#29633 also mentions disabling users.
After the last login event, or after the last logged-in session ends? Should this imply that any existing sessions are terminated at that point?
CPut still works like a write for contention purposes. To get any reduction in contention, we need to do our own reads before writing. |
After the last login (regardless of how long the session was)
The user understand they can use CANCEL SESSIONS (with a suitable filter on users) to preempt existing sessions
ok thanks for clarifying |
The standard postgres way is a combination of:
The former disables the password (not sure if that applies to other authentication methods) at the specified time. The latter prevents the user from logging in at all. The only odd case in the ones mentioned in the original message is "disable |
Zendesk ticket #3849 has been linked to this issue. |
@ajwerner made me realize we already have a form of user expiration: the expiration field in the client TLS certificate. Customers can use that already. |
@RichardJCai when you have some idea of what's to be done here, can you explain it to me? I'm tasked with adding some audit logging on a separate area and the two things need to combine gracefully. |
@knz Sure thing, I'll message you on Slack once I have a plan. |
@solongordon Here is postgres' documentation for valid until VALID UNTIL 'timestamp' (From what I understand, if Postgres has password required - then all users must have a password to login. If no password is required, the password is ignored - this means even if the password is "expired" then the user can still login see here for more) To copy postgres' behavior, users must have a "password" in order to be disabled. |
Good finding. I had not expected that pgs expiry was a property of the password and not of the account.
I wonder if this is a misdesign or a good feature which we were not trained to fully appreciate.
Both pg and crdb allow other authn methods than password checks.
On the one hand, Pgs behavior suggests that it doesn't support user account expiration across all authn methods. This would suggest an unwanted assymetry and thus a misdesign.
However OTOH maybe the idea is to delegate to the authn method the responsibility to decide account validity. This is meaningful : TLS has cert expiry, kerberos has its own expiry, AD too etc.
I have a vague feeling we may want to copy pgs behavior because there is probably more history and motivation in their choices compared to our relative collective inexperience.
That said I also appreciate that our customers want an answer.
What about this :
- make passwords work like pg;
- make gss delegate to kerberos ( it already does) ;
- make a new something for cert authn. The new something is something we're missing anyway and eventually needed to support : revocation lists for client certs.
@aaron-crl what do you think?
…--
Verstuurd vanaf mijn Android apparaat met K-9 Mail. Excuseer mijn beknoptheid.
|
Following the pg design pattern has the advantage of behaving as other users may be accustomed and it potentially backed by perspectives we have not captured here. As a security admin, if I seek to functionally disabled user's access to a system, I'd like to have user level security controls and not have to know all the ways that a user might have been granted access to the system. I'm pretty sure setting "NOLOGIN" does this, though doesn't trigger based on last login. So I can see reasons to do both standard pg behavior for expired passwords, but also have a user activity trigger to lock login.
I think this feature should exist as a base access control regardless. This is a use case where many of the traditional security challenges related to revocation lists don't apply. TL;DR: My gut feeling is that we:
|
For point 2, terminating existing sessions can be tricky (and expensive) since we would have to check before any action. I think for the first pass for this ticket, we should look to copy pg's password expiry unless the customer specifies otherwise. |
For point 2 we have a mechanism for this already. The operator who wants to kick user X out would:
and then they get what they want. |
Hi team, one other point re: If we don't have the bandwidth to support |
Release note (sql feature): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) SHOW USERS now shows all roles/users that have LOGIN enabled. SHOW ROLES shows every role/user (now that roles=users). Fixes cockroachdb#41396
Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) SHOW USERS now shows all roles/users that have LOGIN enabled. SHOW ROLES shows every role/user (now that roles=users). Fixes cockroachdb#41396
Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) SHOW USERS now shows all roles/users that have LOGIN enabled. SHOW ROLES shows every role/user (now that roles=users). Fixes cockroachdb#41396
Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Release note (sql change): Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) Release note (sql change): SHOW USERS now shows all roles/users that have LOGIN enabled. Release note (security update): User and role principals can now be prevented from logging in using the NOLOGIN attribute which can be set using ALTER USER/ROLE. Release note (security update): The password field (used exclusively for password-based authentication) can now be configured to have an expiry date using the VALID UNTIL attribute, which can be set with ALTER USER/ROLE. Note that the attribute sets an expiry date for the password, not the user account. This is consistent with PostgreSQL. Fixes cockroachdb#41396
Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Release note (sql change): Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) Release note (sql change): SHOW USERS now shows all roles/users that have LOGIN enabled. Release note (security update): User and role principals can now be prevented from logging in using the NOLOGIN attribute which can be set using ALTER USER/ROLE. Release note (security update): The password field (used exclusively for password-based authentication) can now be configured to have an expiry date using the VALID UNTIL attribute, which can be set with ALTER USER/ROLE. Note that the attribute sets an expiry date for the password, not the user account. This is consistent with PostgreSQL. Release note (security update): Any role created prior to 20.1 will be able to log in into clusters started with --insecure, unless/until they are granted the NOLOGIN privilege. Fixes cockroachdb#41396
Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Release note (sql change): Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) Release note (sql change): SHOW USERS now shows all roles/users that have LOGIN enabled. Release note (security update): User and role principals can now be prevented from logging in using the NOLOGIN attribute which can be set using ALTER USER/ROLE. Release note (security update): The password field (used exclusively for password-based authentication) can now be configured to have an expiry date using the VALID UNTIL attribute, which can be set with ALTER USER/ROLE. Note that the attribute sets an expiry date for the password, not the user account. This is consistent with PostgreSQL. Release note (security update): Any role created prior to 20.1 will be able to log in into clusters started with --insecure, unless/until they are granted the NOLOGIN privilege. For secure clusters, roles cannot log in by virtue of not having a password nor a client certificate. Fixes cockroachdb#41396
Fixes cockroachdb#41396 Release note (sql change): Added LOGIN option to enable login for roles/users. When using CREATE USER syntax, LOGIN is enabled by default whereas when using CREATE ROLE, LOGIN is not enabled by default. Release note (sql change): Added VALID UNTIL option to indicate passwords are only valid until a given timestamp. VALID UNTIL only affects PASSWORDS - if passwords are disabled, VALID UNTIL has no effect. (Can login even with expired password if passwords are not required to login - same as PG) Release note (sql change): SHOW USERS now shows all roles/users that have LOGIN enabled. Release note (security update): User and role principals can now be prevented from logging in using the NOLOGIN attribute which can be set using ALTER USER/ROLE. Release note (security update): The password field (used exclusively for password-based authentication) can now be configured to have an expiry date using the VALID UNTIL attribute, which can be set with ALTER USER/ROLE. Note that the attribute sets an expiry date for the password, not the user account. This is consistent with PostgreSQL. Release note (security update): Any role created prior to 20.1 will be able to log in into clusters started with --insecure, unless/until they are granted the NOLOGIN privilege. For secure clusters, roles cannot log in by virtue of not having a password nor a client certificate.
Requested by large customer account:
The first two points are equivalent, the last is separate.
The text was updated successfully, but these errors were encountered: