docker icon indicating copy to clipboard operation
docker copied to clipboard

SQL Connection over SSL

Open chharish opened this issue 6 years ago • 5 comments

I have successfully deployed a phpMyAdmin interface with SSL using dockers (nginx, nginx-gen, letsencrypt) but the SQl server connections are not going through a secure connection. I know the native way to setup secure connection from the command line, but not sure how I can give a command like "mysql -h only-ssl-db.ct5b4uz1gops.eu-central-1.rds.amazonaws.com --ssl-ca=/var/mysql-certs/rds-combined-ca-bundle.pem --ssl-mode=REQUIRED -u onlyssldbusr -P 3306 -p" to the docker container running PhpMyAdmin.

Is there a way we can use SSL to encrypt a SQL connection from PhpMyAdmin docker Application to an external DB server running MySQL?

chharish avatar Feb 28 '19 00:02 chharish

@chharish I think this is not implemented on the docker image

cc @ibennetch

williamdes avatar Feb 28 '19 12:02 williamdes

we never tried using SSL with certification authority for databases, but enabling ssl encrypted ssl connection is just adding to config.inc.php

$cfg['Servers'][$i]['ssl'] = true;

qeepcologne avatar Feb 14 '22 14:02 qeepcologne

I wrote some documentation about this recently: https://docs.phpmyadmin.net/en/latest/config.html#amazon-rds-aurora-with-ssl

cc @chharish

williamdes avatar Feb 14 '22 15:02 williamdes

Do you plan to add at phpmyadmin docker image level some PMA_XXXX variables to configure the SSL part ? Something like:

PMA_SSL_VERIFY PMA_SSL_CA ...

Thank you

grunlab avatar Sep 23 '22 14:09 grunlab

I've found a workaround for this problem.

docker-compose.yml

services:
  phpmyadmin:
    image: phpmyadmin
    container_name: 'myadmin'
    restart: always
    ports:
      - 127.0.0.1:8080:80
    links:
      - 'db'
    volumes:
      - ./db/conf.d/certs/ca.pem:/etc/mysql/ca.pem
      - ./phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php

config.user.inc.php

<?php

$i = 1;
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// Server certification authority
$cfg['Servers'][$i]['ssl_ca'] = '/etc/mysql/ca.pem';
// Enable SSL verification
$cfg['Servers'][$i]['ssl_verify'] = true;

image

timontr avatar Oct 28 '22 13:10 timontr