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

Resolve relative paths for --ssl-* options in the client

Details

    Description

      The client programs don't resolve relative paths for -ssl* options. This means that if a relative path is provided to one of the options when the = character is specified, then an error is thrown.

      For example, specifying --ssl-ca=~/test_chain.pem doesn't work:

      $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
      ERROR 2026 (HY000): SSL connection error: No such file or directory
      

      But specifying --ssl-ca ~/test_chain.pem with no = character does work, because the shell resolves the path:

      $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 4047
      Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]>
      

      In contrast, if you specify the full path with the = character, then it also work as well:

      $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 4871
      Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]>
      

      So this specifically seems to be related to providing a relative path with the = character.

      According to strace, when the = character is provided with the relative path, the client is calling open() on the relative path:

      $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
      execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
      open("~/test_chain.pem", O_RDONLY)      = -1 ENOENT (No such file or directory)
      

      And when the = character is not provided, the shell has resolved the path to the absolute path for the client:

      $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
      execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
      open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
      

      This is a documented limitation:

      --ssl-ca=name
      Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for TLS. This option requires that you use the absolute path, not a relative path. See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option implies the --ssl option.

      https://mariadb.com/kb/en/mysql-command-line-client/#options

      However, this behavior is not very user friendly.

      Is there any reason that clients shouldn't resolve relative paths automatically?

      Attachments

        Activity

          GeoffMontee Geoff Montee (Inactive) created issue -
          GeoffMontee Geoff Montee (Inactive) made changes -
          Field Original Value New Value
          GeoffMontee Geoff Montee (Inactive) made changes -
          Description The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the equal sign is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}
          The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the equal sign is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the {{~}} character in the path, and the usage of the {{=}} character.
          GeoffMontee Geoff Montee (Inactive) made changes -
          Description The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the equal sign is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the {{~}} character in the path, and the usage of the {{=}} character.
          The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the equal sign is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the {{~}} character in the path, and the usage of the {{=}} character. According to {{strace}}, in the former case, the client is calling {{open}} on the path that contains {{~}}:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And in the latter case, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}
          GeoffMontee Geoff Montee (Inactive) made changes -
          Description The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the equal sign is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the {{~}} character in the path, and the usage of the {{=}} character. According to {{strace}}, in the former case, the client is calling {{open}} on the path that contains {{~}}:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And in the latter case, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}
          The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the {{=}} character is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the ~ character in the path, and the usage of the {{=}} character. According to {{strace}}, in the former case, the client is calling {{open()}} on the path that contains {{~}}:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And in the latter case, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}
          GeoffMontee Geoff Montee (Inactive) made changes -
          Summary Clients can't handle ~ character in --ssl-* option paths when = is specified Clients rely on the shell to resolve relative paths for --ssl-* options
          GeoffMontee Geoff Montee (Inactive) made changes -
          Description The client programs seem to get confused about the ~ character in paths provided to --ssl-* options when the {{=}} character is specified.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to the combination of the ~ character in the path, and the usage of the {{=}} character. According to {{strace}}, in the former case, the client is calling {{open()}} on the path that contains {{~}}:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And in the latter case, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}
          The client programs don't resolve relative paths for --ssl-* options. This means that if a relative path is provided to one of the options when the {{=}} character is specified, then an error is thrown.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work, because the shell resolves the path:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to providing a relative path with the {{=}} character.

          According to {{strace}}, when the {{=}} character is provided with the relative path, the client is calling {{open()}} on the relative path:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And when the {{=}} character is *not* provided, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}

          Is there any reason that clients shouldn't resolve relative paths automatically?
          GeoffMontee Geoff Montee (Inactive) made changes -
          Description The client programs don't resolve relative paths for --ssl-* options. This means that if a relative path is provided to one of the options when the {{=}} character is specified, then an error is thrown.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work, because the shell resolves the path:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to providing a relative path with the {{=}} character.

          According to {{strace}}, when the {{=}} character is provided with the relative path, the client is calling {{open()}} on the relative path:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And when the {{=}} character is *not* provided, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}

          Is there any reason that clients shouldn't resolve relative paths automatically?
          The client programs don't resolve relative paths for --ssl-* options. This means that if a relative path is provided to one of the options when the {{=}} character is specified, then an error is thrown.

          For example, specifying {{--ssl-ca=~/test_chain.pem}} doesn't work:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw'
          ERROR 2026 (HY000): SSL connection error: No such file or directory
          {code}

          But specifying {{--ssl-ca ~/test_chain.pem}} with no {{=}} character does work, because the shell resolves the path:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4047
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          In contrast, if you specify the full path with the {{=}} character, then it also work as well:

          {code:sh}
          $ mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=/home/ec2-user/test_chain.pem --password='secretpw'
          Welcome to the MariaDB monitor. Commands end with ; or \g.
          Your MariaDB connection id is 4871
          Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server

          Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

          MariaDB [(none)]>
          {code}

          So this specifically seems to be related to providing a relative path with the {{=}} character.

          According to {{strace}}, when the {{=}} character is provided with the relative path, the client is calling {{open()}} on the relative path:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca=~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca=~/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("~/test_chain.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
          {code}

          And when the {{=}} character is *not* provided, the shell has resolved the path to the absolute path for the client:

          {code:sh}
          $ strace mariadb --host sky0001585.mdb0001419.test.skysql.net --port 5001 --user DB00003004 --ssl-ca ~/test_chain.pem --password='secretpw' 2>&1 | grep "test_chain.pem"
          execve("/usr/bin/mariadb", ["mariadb", "--host", "sky0001585.mdb0001419.test.skysq"..., "--port", "5001", "--user", "DB00003004", "--ssl-ca", "/home/ec2-user/test_chain.pem", "--password=secretpw"...], [/* 24 vars */]) = 0
          open("/home/ec2-user/test_chain.pem", O_RDONLY) = 4
          {code}

          This is a documented limitation:

          {quote}
          --ssl-ca=name
          Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for TLS. *This option requires that you use the absolute path, not a relative path.* See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option implies the --ssl option.
          {quote}

          https://mariadb.com/kb/en/mysql-command-line-client/#options

          However, this behavior is not very user friendly.

          Is there any reason that clients shouldn't resolve relative paths automatically?
          GeoffMontee Geoff Montee (Inactive) made changes -
          Assignee Sergei Golubchik [ serg ]
          GeoffMontee Geoff Montee (Inactive) made changes -
          Component/s SSL [ 10112 ]
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ] Oleksandr Byelkin [ sanja ]
          serg Sergei Golubchik made changes -
          Labels beginner-friendly
          serg Sergei Golubchik made changes -
          Priority Major [ 3 ] Minor [ 4 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 104659 ] MariaDB v4 [ 141823 ]
          ralf.gebhardt Ralf Gebhardt made changes -
          Fix Version/s 10.2 [ 14601 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.3 [ 22126 ]
          serg Sergei Golubchik made changes -
          Affects Version/s 10.2.31 [ 24017 ]
          Affects Version/s 10.3.22 [ 24018 ]
          Affects Version/s 10.4.12 [ 24019 ]
          Issue Type Bug [ 1 ] New Feature [ 2 ]
          serg Sergei Golubchik made changes -
          Summary Clients rely on the shell to resolve relative paths for --ssl-* options Resolve relative paths for --ssl-* options in the client

          obviously, not a bug. even the description says "this is a documented limitation"

          serg Sergei Golubchik added a comment - obviously, not a bug. even the description says "this is a documented limitation"

          People

            sanja Oleksandr Byelkin
            GeoffMontee Geoff Montee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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