mysqlazuredockersslmautic

Error: Connections using insecure transport are prohibited while --require_secure_transport=ON in Mautic Docker container to Azure MySQL


I'm trying to set up Mautic in a Docker container with an Azure Database for MySQL backend. However, I'm encountering the following error:

Warning: mysqli::__construct(): (HY000/3159): Connections using insecure transport are prohibited while --require_secure_transport=ON. in /makedb.php on line 20 MySQL Connection Error: (3159) Connections using insecure transport are prohibited while --require_secure_transport=ON.

Here are the details of my setup:

version: "2"

services:

  mautic:
    container_name: mautic
    image: mautic/mautic:v4-apache
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=mydbase.mysql.database.azure.com
      - MAUTIC_DB_USER=mydbuser
      - MAUTIC_DB_PASSWORD=mydbuserpwd
      - MAUTIC_DB_NAME=mydbname
    restart: always
    networks:
      - mauticnet
    ports:
      - "8880:80"

networks:
  mauticnet:

volumes:
  mautic_data:

My Azure Database for MySQL has SSL enabled by default, and I have successfully connected to it using a separate tool outside the Mautic container. However, when running the Mautic container, I encounter the aforementioned error related to secure transport.

I suspect there might be an issue with how the Mautic container handles SSL/TLS when connecting to the Azure Database for MySQL.

Could someone please guide me on how to resolve this error and establish a secure connection between Mautic and Azure Database for MySQL within the Docker container?

Any insights or suggestions would be greatly appreciated. Thank you in advance!


Solution

  • You can change the following config: require_secure_transport to off .

    Whether client connections to the server are required to use some form of secure transport.

    When this variable is enabled, the server permits only TCP/IP connections that use SSL or connections that use a socket file (on Unix) or shared memory (on Windows).

    By default, MySQL sets this config to off. Azure sets to on as it's related to security improvements on the database connections.

    You can:

    More information for the require_secure_transport parameter on MySQL documentation: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_require_secure_transport