[MDEV-19650] Privilege bug on MariaDB 10.4 Created: 2019-05-30 Updated: 2023-11-27 Resolved: 2020-05-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Affects Version/s: | 10.4.5 |
| Fix Version/s: | 10.4.13 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Mathieu REHO | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | definer, permissions, privileges, root | ||
| Environment: |
Ubuntu 18.04.2 Server (amd64) |
||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
When changing the "root" username to another value for more security, I'm loosing ability to see any users on my phpMyAdmin. When trying to access to the "mysql.user" table, I get the error "#1449 - The user specified as a definer ('root'@'localhost') does not exist" that was NOT appearing on MariaDB 10.3. This bug is appearing when changing the "root" username after a fresh install, or after an upgrade from a previous version. |
| Comments |
| Comment by Elena Stepanova [ 2019-05-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
That's right. In 10.4 mysql.user has been converted into a view, which has root@localhost for a definer. So, if you renamed root@localhost, the definer no longer exists. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pramod Mahto [ 2019-07-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Manjot Singh (Inactive) [ 2019-07-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
IMO, this view should be moved to sys schema in future versions. (if and when we get sys schema) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-08-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Since 10.4, a root@localhost user must exist for mysql.user to be readable. If you've renamed root@localhost for more security, you can create a new root@localhost user, for example, like this:
That is you'll have an account that can only select from mysql.global_priv and that nobody can login into. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Keremidarski [ 2019-12-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
That root@localhust must exist is incompatible change in 10.4, but is not documented as such. In fact it does not seem to be documented anywhere at all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-12-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re-opened for documenting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Keremidarski [ 2019-12-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Serg's explanation is wrong. With such minimal privileges for root@localhost mysql_upgrade fails with errors when running mysql_fix_privilege_tables like: ... Phase 4/7: Running 'mysql_fix_privilege_tables' So root@localhost also needs UPDATE_priv on mysql.global_priv table because there are several
statements in mysql_fix_privilege_tables. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mathieu REHO [ 2019-12-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@Alexander Keremidarski The fact that we dont't use the "root" username anymore in his original functions, an other user who have every privilege would be used to make the upgrade, like this :
So I think that "root" doesn't need more privileges, since we can't login with it using @Sergei Golubchik's solution : `ACCOUNT LOCK`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-12-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If it's a question of upgrades, perhaps mysql_upgrade can automatically create a minimal root@localhost if there isn't one? salle, will that work for you? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Manjot Singh (Inactive) [ 2019-12-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Could a system user that can never be logged in (account lock) or have its grants changed fixed this? perhaps something like "dbo@localhost". This would solve this problem going forward and allow flexibility for system defined views, triggers, routines etc for future features, such as sys_schema etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-01-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
yes, it can be a solution (scripts should correctly remove root user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-01-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
May be it could be easier to create a dummy root@localhost user as I described above | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-02-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
salle If one remove root, it is natural, that scripts where root is hardcoded, fails. IMHO if one remove something important one should imagine what he is doing. IMHO serg way is the best, we can detect absence right of root for some views/tables, but can not (or it is very difficult and I have not found universal way) to detect that single user (could be many) which user replaced root with, to repair the view and 2 geo-data related procedures. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am trying to implement solution very similar to mysql one (with special user), so one will need to just run upgrade script to fix problem of absent root. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-05-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
commit 15a750f2501b5ea8a5bc09c7047b8cef7e92d6ab (HEAD Also fixes: Add user mariadb.sys to be definer of user view Also changed definer of gis functions in case of creation, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-05-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ok to push | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-05-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For documentation sake : A new user was added : mariadb.sys (script of creation new database or upgrade will create it). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-05-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
main.upgrade_
|