[MDEV-11340] Allow multiple alternative authentication methods for the same user Created: 2016-11-23 Updated: 2020-03-12 Resolved: 2019-02-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Fix Version/s: | 10.4.3 |
| Type: | Task | Priority: | Critical |
| Reporter: | Anders Karlsson | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | gsoc17 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.4.0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
In some cases there is a need to authenticate the same user in different means, more specifically multiple different authentications methods, or IDENTIFIED BY clauses for the same user. The adjusted CREATE USER syntax would allow multiple IDENTIFIED BY sections for one single user. Questions:
|
| Comments |
| Comment by Jabbar Memon [ 2017-03-13 ] | ||||||||||||||||||||||||||||
|
hello sir, Thank You | ||||||||||||||||||||||||||||
| Comment by Liam Keller [ 2017-03-14 ] | ||||||||||||||||||||||||||||
|
Hi, I am Liam Keller a SE student and I wish to work on this project for GSoC 2017. I think this feature is supported in Oracle from my findings and it will be great for MariaDB to have it too. I have been going through the grammar of SQL used by MariaDB especially for CREATE USER ... statement. My initial thoughts on the new syntax should allow us preserve the current syntax but extend it to support enumerating authentication methods. Something like should work for the new syntax.
I will be working on a draft proposal for this project and I will share it with the Mailing list for review. | ||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2017-03-23 ] | ||||||||||||||||||||||||||||
|
Good start - submissions are open now on https://summerofcode.withgoogle.com | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-15 ] | ||||||||||||||||||||||||||||
Assorted thoughts1.We could try to stick everything into the existing API and protocol, by creating AND and OR authentication plugins. Or one META (or, say, MULTI, or POLICY) plugin. Like
2.The opposite, fully native built-in support. The syntax can look like
Or even
Plugins (or policies) are stored in a separate table mysql.policy, and mysql.user just stores a policy id. 3.Something in the middle, no policies, still stored in a mysql.user table, but a dedicated syntax. 4.May be, PAM semantics?
5.Our main use case seems to be really just unix_socket OR mysql_native_password, so we could limit the scope and only implement OR, not AND or parentheses. This wouldn’t simplify much and wouldn’t avoid the implementation question (1. Plugins 2. Native 3. Middle ground) | ||||||||||||||||||||||||||||
| Comment by Andrii Nikitin (Inactive) [ 2017-05-15 ] | ||||||||||||||||||||||||||||
|
We can consider using existing table mysql.roles_mapping for authentication | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-15 ] | ||||||||||||||||||||||||||||
|
In some cases the client wants to be able to choose. As the extension of the above idea, for a case of IDENTIFIED WITH A OR B OR C a client can choose to force plugin B, and the server will automatically consider A and C as failed. | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-15 ] | ||||||||||||||||||||||||||||
|
Because 1) a password shouldn't be part of a policy, but 2) the server doesn't know what plugin parameters are passwords, a possible solution can be
Or even
Note that in both cases 'mariadb_local' was still hard-coded in the policy This syntax becomes rather problematic if one wants to prepare CREATE POLICY statement. Alternatively, one can do named parameters:
but that looks like an overkill | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-16 ] | ||||||||||||||||||||||||||||
|
About protocol changes: current protocol already supports server telling client what plugin to switch to. Perhaps this can be used to avoid any protocol changes? | ||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2017-05-16 ] | ||||||||||||||||||||||||||||
|
Protocol also supports client telling server which plugin to use. I do not think it works, but the field is there. | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-22 ] | ||||||||||||||||||||||||||||
|
On the other hand, if the policy is strictly a way to simplify user administration, a way to give some name to a set of user settings, then everything a policy can do, should be doable without. In that case, this should work too:
and the concept of "policy" could be moved to a separate independent project. | ||||||||||||||||||||||||||||
| Comment by Andrii Nikitin (Inactive) [ 2017-05-22 ] | ||||||||||||||||||||||||||||
|
My concern is that it will be quite headache to parse/build these AND / OR expressions, e.g. for external tools or to build some advanced analytics from these expressions. Therefore I'd stick to Codd's rule #1 "All information in a relational data base is represented explicitly at the logical level and in exactly one way – by values in tables." and rule #4 "The data base description is represented at the logical level in the same way as ordinary data, so that authorized users can apply the same relational language to its interrogation as they apply to the regular data."
Of course one can say that after all that information will be stored in relational tables and tools could use such SQL commands to avoid parsing AND / OR . But that would mean that we will have to support two notations and always try to make sure that these notations interact in consistent way. Thus I prefer to have single notation where we define / retrieve info with (simple) INSERT / DELETE / UPDATE / SELECT commands and should design syntax basing on that. | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-05-22 ] | ||||||||||||||||||||||||||||
|
Right, sorry. I had this in mind but forgot to write. If we do this AND/OR syntax (and, perhaps, if we don't) there should be some INFORMATION_SCHEMA tables presenting current authentication rules to users. Nobody should need to parse SHOW CREATE USER to understand how to authentication is configured. but if you want to suggest some other notation, please, feel free to. | ||||||||||||||||||||||||||||
| Comment by Andrii Nikitin (Inactive) [ 2017-05-22 ] | ||||||||||||||||||||||||||||
|
Reading from I_S will solve part of problem, but it still will be problematic to modify methods, e.g. revoke 'unix_socket' from those who can connect trough 'pam'. Below is one of ways to implement the suggestion with roles_mapping:
Now, to define 'optional vs forced' unix_socket authentication, we can either reuse some column from 'user' table, or add new column to either 'user' or 'roles_mapping'. If we have strong reasons to not abuse roles with authentication methods, we can probably define new table 'authentication_role' or 'authentication_group' and try to use the same way as suggestion above | ||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2018-05-30 ] | ||||||||||||||||||||||||||||
|
I read all this and for me it is still not clear even which syntax to use. | ||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2019-01-22 ] | ||||||||||||||||||||||||||||
|
commented on the https://github.com/MariaDB/server/commit/1e4d7ba29ed19f8edfdcc97f408ac1d5d07956e6 |