Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mutual TLS (mTLS) support for remote database connections in PhpMyAdmin #448

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

LordRobinCbz
Copy link

Problem:
In the context of mutual TLS (mTLS), it is currently not possible to define a list of files to configure the connection between PhpMyAdmin and one or more database servers or services.

Proposed Solution:
My idea is to introduce the ability to configure specific PhpMyAdmin parameters to allow mTLS connections to secure services.

To achieve this, I built upon existing syntax and implemented an approach that encodes the necessary files (CA, CERT, and KEY) in Base64 format. These files can then be passed to PhpMyAdmin using environment variables.

Potential Question: Why not use a volume instead of environment variables?
In a hyperscaler context such as Kubernetes, creating NFS volumes can pose significant challenges for many users. Managing environment variables is often simpler and more portable than managing volumes. Additionally, adding volumes introduces statefulness to PhpMyAdmin, which can be problematic for certain infrastructures. Using environment variables resolves these issues and keeps PhpMyAdmin stateless.

Note:
This is my first open-source pull request, so I am not entirely sure if I’m following the correct process. I kindly ask for your understanding. I am also more active on GitLab than GitHub, so feel free to reach out if you need more information about me.

Thank you for your time and consideration!

LordRobinCbz and others added 2 commits December 11, 2024 14:44
feat:(config.inc.php/docker-entrypoint.sh): Add support for mTLS to a remote server/cluster/service
@LordRobinCbz
Copy link
Author

LordRobinCbz commented Dec 16, 2024

Hello @williamdes , I am sorry to have to you ask you such a thing, but can you see my proposal please ?

The related issue is here: #449

README.md Outdated Show resolved Hide resolved
LordRobinCbz and others added 5 commits December 21, 2024 16:22
… TLS logic from entrypoint to php configuration files
fix(config.inc.php/docker-entrypoint.sh,dockerfile,helpers.php): Move TLS logic from entrypoint to php configuration files
… TLS logic from entrypoint to php configuration files, in all other build
fix(config.inc.php/docker-entrypoint.sh,dockerfile,helpers.php): Move TLS logic from entrypoint to php configuration files, in all other build
apache/helpers.php Outdated Show resolved Hide resolved
apache/helpers.php Outdated Show resolved Hide resolved
apache/config.inc.php Outdated Show resolved Hide resolved
LordRobinCbz and others added 2 commits December 21, 2024 21:40
Co-authored-by: William Desportes <[email protected]>
add types to function parameters

Co-authored-by: William Desportes <[email protected]>
apache/helpers.php Outdated Show resolved Hide resolved
apache/helpers.php Outdated Show resolved Hide resolved
Remove the custom exception

Co-authored-by: William Desportes <[email protected]>
Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to change https://github.com/phpmyadmin/docker/blob/master/config.inc.php
and https://github.com/phpmyadmin/docker/blob/master/Dockerfile-alpine.template
and https://github.com/phpmyadmin/docker/blob/master/Dockerfile-debian.template

And run ./update to sync the changes to all files

I like your work, and will also use it at work for Amazon RDS

@williamdes
Copy link
Member

If you can also open a PR to the QA_5_2 branch of https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/setup.rst#installing-using-docker to add the new ENVs that would be great. Else I will do it

I guess an example using https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/config.rst#amazon-rds-aurora-with-ssl could clarify how to use this feature.

…ates, add PMA_SSLS in the README and add PMA_SSL_DIR to set output path for certificate generation
@LordRobinCbz
Copy link
Author

If you can also open a PR to the QA_5_2 branch of https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/setup.rst#installing-using-docker to add the new ENVs that would be great. Else I will do it

I guess an example using https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/config.rst#amazon-rds-aurora-with-ssl could clarify how to use this feature.

So, if I understand correctly, you wan't to me to open a PR for PhpMyAdmin application and add mTLS support in the installing-using-docker section of the setup.rst.

If yes, I am your men.

@LordRobinCbz
Copy link
Author

If you can also open a PR to the QA_5_2 branch of https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/setup.rst#installing-using-docker to add the new ENVs that would be great. Else I will do it

I guess an example using https://github.com/phpmyadmin/phpmyadmin/blob/QA_5_2/doc/config.rst#amazon-rds-aurora-with-ssl could clarify how to use this feature.

Here the PR about documentation adds: phpmyadmin/phpmyadmin#19465

Many thanks for your time and consideration

Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite good
Merci Robin !

…e script to import it in target folders/images

Signed-off-by: lordrobincbz <[email protected]>
@williamdes williamdes changed the title Add mTLS support for remote database connections in PhpMyAdmin Add mutual TLS (mTLS) support for remote database connections in PhpMyAdmin Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants