Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25318

mysql_install_db.sh wrong instructions on how to set root password leading to passwordless root account.

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.2.37, 10.3.28
    • N/A
    • Scripts & Clients
    • None
    • Centos7 and other linux

    Description

      During MariaDB 10.2 or 10.3 installation mysql_install_db.sh provides following instructions how to reset root password:

      "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
      To do so, start the server, then issue the following commands:
       
      '/usr/bin/mysqladmin' -u root password 'new-password'
      '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'
       
      Alternatively you can run:
      '/usr/bin/mysql_secure_installation'
       
      which will also give you the option of removing the test
      databases and anonymous user created by default.  This is
      strongly recommended for production servers."
       
      While mysql_secure_installation works as expected and changes ALL passwords, commands:
      '/usr/bin/mysqladmin' -u root password 'new-password'
      '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'
       
      DO NOT change ALL root passwords. Mysql user table after running commands:
      MariaDB [(none)]> select Host,User,Password from mysql.user;
      +----------------+------+-------------------------------------------+
      | Host           | User | Password                                  |
      +----------------+------+-------------------------------------------+
      | localhost      | root | *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
      | server6.tst.lt | root | *4A82FDF1D80BA7470BA2E17FEEFD5A53D5D3B762 |
      | 127.0.0.1      | root |                                           |
      | ::1            | root |                                           |
      | localhost      |      |                                           |
      | server6.tst.lt |      |                                           |
      +----------------+------+-------------------------------------------+
      

      So even if user follows the provided instruction how to set root password, there is still unprotected root user and it is CRITICAL vulnerability. IMO it is an important and misleading message and must be fixed, by providing instructions that works as expected.

      Attachments

        Issue Links

          Activity

            wyckaoo Vytautas Bertasius created issue -

            Many years ago MySQL was creating only two root users(root@localhost, root@hostname), e.g.
            https://github.com/MariaDB/server/blob/307b7e85af741dd15af2a300b3344642dfa75d14/scripts/mysql_install_db.sh

            And had the same recommendations how to change password during installation and it was correct at that time. But at some point it started to add more user(root@127.0.0.1, root@::1,), e,g.: https://github.com/MariaDB/server/blob/10.3/scripts/mysql_system_tables_data.sql

            But recommendations on how to set root password during installation remained the same(https://github.com/MariaDB/server/blob/10.3/scripts/mysql_install_db.sh). And now it is misleading and dangerous. My suggestion is to remove recomendation set root password using these commands:
            '/usr/bin/mysqladmin' -u root password 'new-password'
            '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'

            wyckaoo Vytautas Bertasius added a comment - Many years ago MySQL was creating only two root users(root@localhost, root@hostname), e.g. https://github.com/MariaDB/server/blob/307b7e85af741dd15af2a300b3344642dfa75d14/scripts/mysql_install_db.sh And had the same recommendations how to change password during installation and it was correct at that time. But at some point it started to add more user(root@127.0.0.1, root@::1,), e,g.: https://github.com/MariaDB/server/blob/10.3/scripts/mysql_system_tables_data.sql But recommendations on how to set root password during installation remained the same( https://github.com/MariaDB/server/blob/10.3/scripts/mysql_install_db.sh ). And now it is misleading and dangerous. My suggestion is to remove recomendation set root password using these commands: '/usr/bin/mysqladmin' -u root password 'new-password' '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'
            wyckaoo Vytautas Bertasius made changes -
            Field Original Value New Value
            Priority Blocker [ 1 ] Major [ 3 ]
            serg Sergei Golubchik made changes -
            Description During MariaDB 10.2 or 10.3 installation mysql_install_db.sh provides following instructions how to reset root password:

            "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
            To do so, start the server, then issue the following commands:

            '/usr/bin/mysqladmin' -u root password 'new-password'
            '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'

            Alternatively you can run:
            '/usr/bin/mysql_secure_installation'

            which will also give you the option of removing the test
            databases and anonymous user created by default. This is
            strongly recommended for production servers."

            While mysql_secure_installation works as expected and changes ALL passwords, commands:
            '/usr/bin/mysqladmin' -u root password 'new-password'
            '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'

            DO NOT change ALL root passwords. Mysql user table after running commands:
            MariaDB [(none)]> select Host,User,Password from mysql.user;
            +----------------+------+-------------------------------------------+
            | Host | User | Password |
            +----------------+------+-------------------------------------------+
            | localhost | root | *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
            | server6.tst.lt | root | *4A82FDF1D80BA7470BA2E17FEEFD5A53D5D3B762 |
            | 127.0.0.1 | root | |
            | ::1 | root | |
            | localhost | | |
            | server6.tst.lt | | |
            +----------------+------+-------------------------------------------+

            So even if user follows the provided instruction how to set root password, there is still unprotected root user and it is CRITICAL vulnerability. IMO it is an important and misleading message and must be fixed, by providing instructions that works as expected.
            During MariaDB 10.2 or 10.3 installation mysql_install_db.sh provides following instructions how to reset root password:
            {noformat}
            "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
            To do so, start the server, then issue the following commands:

            '/usr/bin/mysqladmin' -u root password 'new-password'
            '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'

            Alternatively you can run:
            '/usr/bin/mysql_secure_installation'

            which will also give you the option of removing the test
            databases and anonymous user created by default. This is
            strongly recommended for production servers."

            While mysql_secure_installation works as expected and changes ALL passwords, commands:
            '/usr/bin/mysqladmin' -u root password 'new-password'
            '/usr/bin/mysqladmin' -u root -h hostname password 'new-password'

            DO NOT change ALL root passwords. Mysql user table after running commands:
            MariaDB [(none)]> select Host,User,Password from mysql.user;
            +----------------+------+-------------------------------------------+
            | Host | User | Password |
            +----------------+------+-------------------------------------------+
            | localhost | root | *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
            | server6.tst.lt | root | *4A82FDF1D80BA7470BA2E17FEEFD5A53D5D3B762 |
            | 127.0.0.1 | root | |
            | ::1 | root | |
            | localhost | | |
            | server6.tst.lt | | |
            +----------------+------+-------------------------------------------+
            {noformat}
            So even if user follows the provided instruction how to set root password, there is still unprotected root user and it is CRITICAL vulnerability. IMO it is an important and misleading message and must be fixed, by providing instructions that works as expected.

            Oh. Sorry. Following your email I've created an MDEV-25326 about it, I didn't know you've already done it.

            serg Sergei Golubchik added a comment - Oh. Sorry. Following your email I've created an MDEV-25326 about it, I didn't know you've already done it.
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s N/A [ 14700 ]
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 120679 ] MariaDB v4 [ 159106 ]

            People

              serg Sergei Golubchik
              wyckaoo Vytautas Bertasius
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.