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

Secure installation with normal user fails to accept empty root password

Details

    Description

      When installing MariaDB as a normal user, mysql_secure_installation fails when attempting to authenticate the root user (with an empty password).

      This can be worked around by updating the make_config function to avoid writing the user and password lines if the provided root password is empty, as in the following alternate implementation (first if-statement added):

      make_config() {
          echo "# mysql_secure_installation config file" >$config
          echo "[mysql]" >>$config
          if [ ! -z "$rootpass" ]; then
              echo "user=root" >>$config
              esc_pass=`basic_single_escape "$rootpass"`
              echo "password='$esc_pass'" >>$config
          fi
          #sed 's,^,> ,' < $config  # Debugging
       
          if test -n "$defaults_file"
          then
              dfile=`parse_arg "$defaults_file"`
              cat "$dfile" >>$config
          fi
      }
      

      I'm not sure if this is the proper fix, but hopefully it at least highlights where the conflict is happening.

      Attachments

        Issue Links

          Activity

            groot-verde Andrew Groot created issue -
            groot-verde Andrew Groot made changes -
            Field Original Value New Value
            Description When installing MariaDB as a normal user, {{mysql_secure_installation}} fails when attempting to authentication the root user (with an empty password).

            This can be worked around by updating the {{make_config}} function to avoid writing the user and password lines if the provided root password is empty, as in the following alternate implementation (first if-statement added):

            {code:bash}
            make_config() {
                echo "# mysql_secure_installation config file" >$config
                echo "[mysql]" >>$config
                if [ ! -z "$rootpass" ]; then
                    echo "user=root" >>$config
                    esc_pass=`basic_single_escape "$rootpass"`
                    echo "password='$esc_pass'" >>$config
                fi
                #sed 's,^,> ,' < $config # Debugging

                if test -n "$defaults_file"
                then
                    dfile=`parse_arg "$defaults_file"`
                    cat "$dfile" >>$config
                fi
            }
            {code}

            I'm not sure if this is the proper fix, but hopefully it at least highlights where the conflict is happening.
            When installing MariaDB as a normal user, {{mysql_secure_installation}} fails when attempting to authenticate the root user (with an empty password).

            This can be worked around by updating the {{make_config}} function to avoid writing the user and password lines if the provided root password is empty, as in the following alternate implementation (first if-statement added):

            {code:bash}
            make_config() {
                echo "# mysql_secure_installation config file" >$config
                echo "[mysql]" >>$config
                if [ ! -z "$rootpass" ]; then
                    echo "user=root" >>$config
                    esc_pass=`basic_single_escape "$rootpass"`
                    echo "password='$esc_pass'" >>$config
                fi
                #sed 's,^,> ,' < $config # Debugging

                if test -n "$defaults_file"
                then
                    dfile=`parse_arg "$defaults_file"`
                    cat "$dfile" >>$config
                fi
            }
            {code}

            I'm not sure if this is the proper fix, but hopefully it at least highlights where the conflict is happening.
            serg Sergei Golubchik made changes -
            Assignee Anel Husakovic [ anel ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            anel Anel Husakovic made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            anel Anel Husakovic made changes -
            Assignee Anel Husakovic [ anel ] Sergei Golubchik [ serg ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Anel Husakovic [ anel ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            anel Anel Husakovic made changes -
            Fix Version/s 10.4.18 [ 25110 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Not a Bug [ 6 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            anel Anel Husakovic made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 120185 ] MariaDB v4 [ 159039 ]

            People

              anel Anel Husakovic
              groot-verde Andrew Groot
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.