phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
666 stars 453 forks source link

SQL Connection over SSL #211

Open chharish opened 5 years ago

chharish commented 5 years ago

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?

williamdes commented 5 years ago

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

cc @ibennetch

qeepcologne commented 2 years ago

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;
williamdes commented 2 years ago

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

cc @chharish

grunlab commented 2 years ago

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

timontr commented 1 year ago

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