【问题标题】:Apache Guacamole under docker with an external database requires SSL database connectiondocker下带有外部数据库的Apache Guacamole需要SSL数据库连接
【发布时间】:2020-06-13 20:52:23
【问题描述】:

背景

  • Apache guacamole 使用默认的 guacamole 映像在 docker 下运行。
  • 外部 Microsoft Azure 管理的 MySQL 数据库。
  • Azure 默认需要 SSL 连接到托管数据库服务。
  • 可以禁用此功能,但这不是此环境的选项。

设置

Docker-compose.yml 有以下部分:

 environment:
      - "GUACD_HOSTNAME=127.0.0.1"
      - "GUACD_PORT=4822"
      - "MYSQL_PORT=3306"
      - "MYSQL_DATABASE=guacamole"
      - "GUACAMOLE_HOME=/data"
      - "MYSQL_USER=******************"
      - "MYSQL_PASSWORD=******************"
      - "MYSQL_HOSTNAME=******************"

问题

在 Azure 中启用它后,我得到以下信息:

guacamole    | 09:34:53.998 [http-nio-8080-exec-5] WARN  o.a.g.e.AuthenticationProviderFacade - The "mysql" authentication provider has encountered an internal error which will halt the authentication process. If this is unexpected or you are the developer of this authentication provider, you may wish to enable debug-level logging. If this is expected and you wish to ignore such failures in the future, please set "skip-if-unavailable: mysql" within your guacamole.properties.
guacamole    | 09:34:53.999 [http-nio-8080-exec-5] ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error:
guacamole    | ### Error querying database.  Cause: java.sql.SQLException: SSL connection is required. Please specify SSL options and retry.
guacamole    | ### The error may exist in org/apache/guacamole/auth/jdbc/user/UserMapper.xml
guacamole    | ### The error may involve org.apache.guacamole.auth.jdbc.user.UserMapper.selectOne
guacamole    | ### The error occurred while executing a query
guacamole    | ### Cause: java.sql.SQLException: SSL connection is required. Please specify SSL options and retry.

我知道(在 docker 之外)如果我进行 mysql 客户端命令行连接,我可以使用选项 --ssl 然后一切正常。

但由于我对 docker 很陌生,我不知道如何在我的 docker-compose 文件中设置该选项。

我的 google fu 让我失望了,让我陷入了关于 TLS 访问 docker 容器或为网站设置 https 的问题。

如何在 docker-compose.yml 中启用 mysql 连接以使用 ssl?

【问题讨论】:

    标签: mysql docker ssl docker-compose guacamole


    【解决方案1】:

    制作一个包含相关证书的 Java 密钥库:

    keytool -import -alias mySQLServerCACert -file /path/to/server-ca.pem -keystore /path/to/jks/truststore.jks
    

    将其添加为卷挂载:

    volumes:
      - /path/to/jks:/etc/jks
    

    传递附加到数据库名称的 MySQL 配置参数:

    MYSQL_DATABASE=guacamole-db?verifyServerCertificate=true&useSSL=true&requireSSL=true&trustCertificateKeyStoreUrl=file:/etc/jks/truststore.jks&trustCertificateKeyStorePassword=password
    

    【讨论】:

      猜你喜欢
      • 2023-04-02
      • 2010-10-21
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 2012-04-02
      • 2021-11-27
      • 2012-01-08
      • 2023-01-03
      相关资源
      最近更新 更多