Open aliridha1510 opened 4 weeks ago
Hi, you should be able to set the TLS connection attributes in the config.php
and then just mount it and the certificates and keys into the container.
cat config.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
return array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=mydbhost;port=3306;dbname=limesurvey;',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'changeme',
'charset' => 'utf8mb4',
'tablePrefix' => 'lime_',
'attributes' => array(
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
PDO::MYSQL_ATTR_SSL_KEY => '/ls/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/ls/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/ls/ca-cert.pem',
),
),
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(),
'showScriptName' => true,
),
),
'config'=>array(
'mysqlEngine' => 'MyISAM',
)
);
If the certs are not dummy certs like mine, you can set PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => tue
.
My LS Setup:
ls /tmp/lime
config.php ca-cert.pem client-cert.pem client-key.pem
podman run -ti --rm -v /tmp//lime/:/ls -v /tmp/lime/config.php:/var/www/html/application/config/config.php -e DB_PASSWORD=changeme -e ADMIN_PASSWORD=changeme -e DB_HOST=mydbhost -p 8080:8080 docker.io/martialblog/limesurvey:6-apache
My DB Setup:
ls /tmp/db
1-server-ssl.cnf ca-cert.pem server-cert.pem server-key.pem
cat /tmp/db/1-server-ssl.cnf
[mariadbd]
ssl-ca = /etc/mysql/conf.d/ca-cert.pem
ssl-cert = /etc/mysql/conf.d/server-cert.pem
ssl-key = /etc/mysql/conf.d/server-key.pem
podman run --name mariadb -v /tmp/db:/etc/mysql/conf.d -e MARIADB_ROOT_PASSWORD=changeme -p 3306:3306 docker.io/mariadb:latest
Hope that helps.
Hi there,
I am trying to connect the LimeSurvey Docker image to a MySQL database that requires TLS. I'm using the following Docker image:
Docker Image: martialblog/limesurvey:latest MySQL: Hosted on Azure, configured with TLS I’ve been attempting to configure the database connection with TLS but haven't found any environment variables or documentation that describe how to pass the TLS certificates to the application.
Here are the logs from my LimeSurvey container:
My Attempt at Setting Up SSL/TLS
I attempted to set up the database connection using the following PHP code:
However, I couldn't find a way to directly pass the SSL certificate in the LimeSurvey configuration or through environment variables.
Any guidance or suggestions would be greatly appreciated!
Thank you!