Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4297

columnstore-docker-cluster: wrong sed parsing of '&' character for cmapi key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4.1
    • Component/s: Docker
    • Labels:
    • Environment:
      mariadb/skysql-enterprise-columnstore-handoff sky-1.5.4-1

      Description

      Custom cmapi keys that contain the '&' character might not be parsed correctly by sed in scripts/columnstore-init (line 57) causing the ColumnStore cluster to not be initializable.

      Failure example:

      jens@ubuntu18:~/hi$ CMAPI_KEY='Uuq!=6NZ.x?&6RlS!YsU=0mo=g6g-144'
      jens@ubuntu18:~/hi$ cat <<EOF > cmapi_server.conf
      > [global]
      > server.socket_host = '0.0.0.0'
      > server.socket_port = 8640
      > server.ssl_module = 'builtin'
      > server.ssl_certificate = './cmapi_server/self-signed.crt'
      > server.ssl_private_key = './cmapi_server/self-signed.key'
      > engine.autoreload.on = False
      > log.access_file = ''
      > log.error_file = ''
      >
      > [Authentication]
      > x-api-key =
      >
      > #[Privileges]
      > #use_sudo = True
      >
      > [Dispatcher]
      > name = 'container'
      > path = '/opt/cmapi/mcs_node_control/custom_dispatchers/container.sh'
      > EOF
      jens@ubuntu18:~/hi$ sed -i "s|^x-api-key.*|x-api-key = '$CMAPI_KEY'|" cmapi_server.conf
      jens@ubuntu18:~/hi$ cat cmapi_server.conf | grep x-api-key
      x-api-key = 'Uuq!=6NZ.x?x-api-key =6RlS!YsU=0mo=g6g-144'
      jens@ubuntu18:~/hi$
      

      #!/bin/bash
      CMAPI_KEY='Uuq!=6NZ.x?&6RlS!YsU=0mo=g6g-144'
      cat <<EOF > cmapi_server.conf
      [global]
      server.socket_host = '0.0.0.0'
      server.socket_port = 8640
      server.ssl_module = 'builtin'
      server.ssl_certificate = './cmapi_server/self-signed.crt'
      server.ssl_private_key = './cmapi_server/self-signed.key'
      engine.autoreload.on = False
      log.access_file = ''
      log.error_file = ''
       
      [Authentication]
      x-api-key =
       
      #[Privileges]
      #use_sudo = True
       
      [Dispatcher]
      name = 'container'
      path = '/opt/cmapi/mcs_node_control/custom_dispatchers/container.sh'
      EOF
      sed -i "s|^x-api-key.*|x-api-key = '$CMAPI_KEY'|" cmapi_server.conf
      cat cmapi_server.conf | grep x-api-key
      

      Proposed fix:
      Use

      sed -i "s|^x-api-key.*|x-api-key = '${CMAPI_KEY//&/\\&}'|" /etc/columnstore/cmapi_server.conf
      

      instead.

      Success example:

      jens@ubuntu18:~/hi$ CMAPI_KEY='Uuq!=6NZ.x?&6RlS!YsU=0mo=g6g-144'
      jens@ubuntu18:~/hi$ cat <<EOF > cmapi_server.conf
      > [global]
      > server.socket_host = '0.0.0.0'
      > server.socket_port = 8640
      > server.ssl_module = 'builtin'
      > server.ssl_certificate = './cmapi_server/self-signed.crt'
      > server.ssl_private_key = './cmapi_server/self-signed.key'
      > engine.autoreload.on = False
      > log.access_file = ''
      > log.error_file = ''
      >
      > [Authentication]
      > x-api-key =
      >
      > #[Privileges]
      > #use_sudo = True
      >
      > [Dispatcher]
      > name = 'container'
      > path = '/opt/cmapi/mcs_node_control/custom_dispatchers/container.sh'
      > EOF
      jens@ubuntu18:~/hi$ sed -i "s|^x-api-key.*|x-api-key = '${CMAPI_KEY//&/\\&}'|" cmapi_server.conf
      jens@ubuntu18:~/hi$ cat cmapi_server.conf | grep x-api-key
      x-api-key = 'Uuq!=6NZ.x?&6RlS!YsU=0mo=g6g-144'
      jens@ubuntu18:~/hi$
      

      #!/bin/bash
      CMAPI_KEY='Uuq!=6NZ.x?&6RlS!YsU=0mo=g6g-144'
      cat <<EOF > cmapi_server.conf
      [global]
      server.socket_host = '0.0.0.0'
      server.socket_port = 8640
      server.ssl_module = 'builtin'
      server.ssl_certificate = './cmapi_server/self-signed.crt'
      server.ssl_private_key = './cmapi_server/self-signed.key'
      engine.autoreload.on = False
      log.access_file = ''
      log.error_file = ''
       
      [Authentication]
      x-api-key =
       
      #[Privileges]
      #use_sudo = True
       
      [Dispatcher]
      name = 'container'
      path = '/opt/cmapi/mcs_node_control/custom_dispatchers/container.sh'
      EOF
      sed -i "s|^x-api-key.*|x-api-key = '${CMAPI_KEY//&/\\&}'|" cmapi_server.conf
      cat cmapi_server.conf | grep x-api-key
      

        Attachments

          Activity

            People

            Assignee:
            toddstoffel Todd Stoffel
            Reporter:
            jens.rowekamp Jens Röwekamp (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration