使用SSL从PHP连接到mySQL [英] Using SSL to connect to mySQL from PHP

查看:228
本文介绍了使用SSL从PHP连接到mySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一位安全顾问,要求我们实现与mySQL的加密连接.他担心在我们连接时会以明文形式发送数据库的用户名和密码.

I have a security consultant demanding that we implement encrypted connections to mySQL. He is concerned that the username and pass for the db are being sent cleartext when we connect.

mysql服务器与脚本在同一网络上,尽管物理机不在同一台计算机上.因此,凭据将不会从外部传递,并且应该很好,除非服务器已经受到威胁.

The mysql server is on the same network as the scripts though not the same physical machine. So the credentials will not be passed externally and should be fine unless the server is already compromised.

我对SSL会过大吗?

推荐答案

如果您需要实施此安全措施,我将设置一个加密的SSH隧道.在网络服务器上:

If you need to implement this security measure, I would set up an encrypted SSH tunnel. On the web server:

ssh -L 3306:localhost:3306 -N someuser@mysql.server.address

然后在您的Web应用程序中的127.0.0.1上连接到MySQL,它将通过加密的SSH隧道转发到远程MySQL服务器.

Then connect to MySQL on 127.0.0.1 in your web app, and it will be forwarded to the remote MySQL server over an encrypted SSH tunnel.

这篇关于使用SSL从PHP连接到mySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆