连接到 AWS RDS 实例时,带有 Docker 的 phpMyAdmin 不使用 SSL
我正在使用 phpMyAdmin docker 映像连接到 AWS RDS 实例并需要它使用 SSL。一切均按照 PMA 文档< /a> 但它不会使用 SSL。
创建容器时,config.user.inc.php 和 rds-combined-ca-bundle.pem 都会被复制到 /etc/phpmyadmin 目录。
登录数据库服务器时,PMA 显示服务器连接:SSL 未使用。 当 RDS 中的数据库用户设置为 SSL 时,需要登录失败,而当设置为不需要 SSL 时,我可以正常登录。希望有人能帮助我解决这个问题。
Docker 组合
version: '3.1'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
PMA_HOST: somerdsserver.us-east-1.rds.amazonaws.com
PMA_PORT: 3306
restart: always
ports:
- 8081:80
volumes:
- /sessions
- /home/centos/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- /home/centos/phpmyadmin/rds-combined-ca-bundle.pem:/etc/phpmyadmin/rds-combined-ca-bundle.pem
配置.user.inc.php
<?php
// Address of your instance
$cfg['Servers'][$i]['host'] = 'somerdsserver.us-east-1.rds.amazonaws.com';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// Enable SSL verification
$cfg['Servers'][$i]['ssl_verify'] = true;
// You need to have the region CA file and the authority CA file (2019 edition CA for example) in the PEM bundle for it to work
$cfg['Servers'][$i]['ssl_ca'] = '/etc/phpmyadmin/rds-combined-ca-bundle.pem';
I am using phpMyAdmin docker image to connect to a AWS RDS instance and need it to use SSL. Everything is set as directed by PMA documentation but it will not use SSL.
Both config.user.inc.php and rds-combined-ca-bundle.pem are being copied to /etc/phpmyadmin directory when container is created.
When logging into DB server, PMA shows Server connection: SSL is not being used.
When database user in RDS is set to SSL required login fails and when set to not require SSL I am able to login OK. Hopefully someone can help me out with this.
Docker Compose
version: '3.1'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
PMA_HOST: somerdsserver.us-east-1.rds.amazonaws.com
PMA_PORT: 3306
restart: always
ports:
- 8081:80
volumes:
- /sessions
- /home/centos/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- /home/centos/phpmyadmin/rds-combined-ca-bundle.pem:/etc/phpmyadmin/rds-combined-ca-bundle.pem
config.user.inc.php
<?php
// Address of your instance
$cfg['Servers'][$i]['host'] = 'somerdsserver.us-east-1.rds.amazonaws.com';
// Use SSL for connection
$cfg['Servers'][$i]['ssl'] = true;
// Enable SSL verification
$cfg['Servers'][$i]['ssl_verify'] = true;
// You need to have the region CA file and the authority CA file (2019 edition CA for example) in the PEM bundle for it to work
$cfg['Servers'][$i]['ssl_ca'] = '/etc/phpmyadmin/rds-combined-ca-bundle.pem';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 docker-compose 中创建一个卷,并将 apache 配置和证书复制到容器
phpmyadmin/000-default.conf:
要完成,您需要使用 a2enmod 启用 ssl 并重新启动 apache,在我的情况下,我使用 phpmyadmin.dockerfile :
就是这样。
You can create a volume in docker-compose and replicate apache config and certificates to container
phpmyadmin/000-default.conf:
To finish you need enable ssl with a2enmod and restart apache, in my case I am using phpmyadmin.dockerfile with:
That's it.