Connect phpMyAdmin to MySQL server via SSL
P粉668019339
P粉668019339 2023-10-23 08:57:18
0
2
708

I may be barking up the wrong tree... However, what I have is a MySQL server that only accepts connections from clients with valid SSL certificates (see this link). This works great for Rails, for example. My database is on a server and I have a Rails application that connects using a client certificate. Maybe not the fastest, but it works.

The configuration in

database.ymlis as follows:

sslkey: /path/to/client-key.pem sslcert: /path/to/client-cert.pem sslca: /path/to/ca-cert.pem

The problem is that I want to host phpMyAdmin on the same server as the Rails application. I think phpMyAdmin is more limited in its connection options since I can't seem to find a way for it to connect using a client certificate. But I find it strange that googling doesn't turn up many answers on this question (which makes me wonder if I'm taking the wrong approach).

Obviously I could easily set up phpMyAdmin itself to be hosted behind an SSL certificate (which would encrypt requests between the client browser and my phpMyAdmin server), but I would like the phpMyAdmin <-> database connection to also is encrypted. < /p>

is it possible? Is this a bad design choice? Is there a better way?

P粉668019339
P粉668019339

reply all (2)
P粉806834059

I believe the fully comprehensive answer is well explained in the PHPmyadmin documentation:https://docs.phpmyadmin.net/en/latest/ config.html#example-google-ssl

You should follow it to configure your server connection records in config.inc.php as follows:

// IP address of your instance $cfg['Servers'][$i]['host'] = '8.8.8.8'; // Use SSL for connection $cfg['Servers'][$i]['ssl'] = true; // Client secret key $cfg['Servers'][$i]['ssl_key'] = '../client-key.pem'; // Client certificate $cfg['Servers'][$i]['ssl_cert'] = '../client-cert.pem'; // Server certification authority $cfg['Servers'][$i]['ssl_ca'] = '../server-ca.pem'; // Disable SSL verification (see above note) $cfg['Servers'][$i]['ssl_verify'] = false;
    P粉399090746

    In yourconfig.inc.php, add this line after the applicable server content:

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

    Assuming your php and its mysql client are configured with SSL, this should work.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!