简体   繁体   English

PHP项目中的安全数据库密码

[英]Secure Database Passwords in PHP Project

I Have a PHP Project on Git, that have access some other developers. 我在Git上有一个PHP项目,可以访问其他一些开发人员。
The problem is. 问题是。
1) Developer make changes on project and push it on server or upload it to test server. 1)开发人员对项目进行更改,然后将其推送到服务器上或将其上传到测试服务器。
2) Developer logins to the test or production machine to run this script. 2)开发人员登录到测试或生产机器以运行此脚本。 How can secure the Database Password? 如何保护数据库密码?
If i make a config file, they can simple add an echo "" command and get the password. 如果我制作一个配置文件,他们可以简单地添加echo“”命令并获取密码。
Is there any solution for that? 有什么解决办法吗? Maybe with group/user permissions in linux? 也许在Linux中具有组/用户权限?

Thank you. 谢谢。

There won't be any real solution using linux security as the web server should always be able to execute the code and php also, so if you leave an ssh access to the production server they would be able to do anything they want on it. 使用Linux安全性不会有任何真正的解决方案,因为Web服务器应该总是能够同时执行代码和php,因此,如果您对生产服务器保留ssh访问权限,则他们将能够在其上执行任何操作。

One way to gain some security is to stop using manual login and try using a CI/CD with your git, that way you can have a full contrôle on what is executed on, at least, the production server. 获得某种安全性的一种方法是停止使用手动登录,并尝试在git中使用CI / CD ,这样至少在生产服务器上,您可以完全控制执行的内容。

That way you can leave access to the tests server, and they should always have that to be able to debug, but they can't execute anything that you did not validate before on the production server. 这样,您可以保留对测试服务器的访问权限,并且他们应该始终具有进行调试的权限,但是它们无法在生产服务器上执行您之前未验证的任何操作。 To be sure to not have any issue, you should be the only one, or the sysadmin team should be the only one to have access to the ssh key on the CI. 为确保没有任何问题,您应该是唯一的一个,或者sysadmin团队应该是唯一可以访问CI上的ssh密钥的人。

That's some work to do if you start a CI from scratch and never did it but it will be worth your time when finished and you will also gain in serenity, knowing that no one can access the production without you knowing what is going to get executed on it (that will be the real pain in the ass as you will have to check everything...). 如果您从头开始创建CI却从没做过,那是要做的一些工作,但是这将是值得您花些时间完成的时间,并且您还将获得宁静,因为知道没有人不知道要执行什么将无法访问生产。在它上面(这将是您真正的痛苦,因为您必须检查所有内容...)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM