额外防止数据库篡改
是否可以防止除允许之外的人篡改数据库。我想我是在问除了数据库登录之外是否还有其他方法来阻止人们篡改数据库?我知道特权以及如何仅访问某些用户的数据库的某些部分。我正在寻找更多内容,以防有人设法确定正确的用户名/密码组合。
我将此数据库与网络服务器结合使用。数据库服务器和 Web 服务器位于不同的计算机上,并且位于硬件防火墙后面。 Web 服务器只能通过防火墙访问,数据库服务器也只能通过Web 服务器访问。
我想我要问的是,创建某种用户控件来创建会话 ID 或类似的东西是否可行,这样只有当该 ID 与用户登录时存储的 ID 匹配时才会运行查询。
Is it possible to prevent someone other than those allowed from tampering with the database. I guess I am asking if there is an method other than the database login to hamper people from tampering with the database? I am aware of privileges and how only access to certain parts of the database for certain users. I am looking for something more in case someone manages to ascertain the correct username/password combination.
I am using this database in conjunction with a web server. The database server and web server are on different machines and behind a hardware firewall. The web server is only accessible through the firewall, and the database server accessible only through the web server.
I guess what I am asking is would it be feasible to create some sort of user control that creates a session id or something similar so that only if that id matches that stored when the user signed on will the query be run.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,您可以控制设置哪个用户拥有什么权限。当然,如果他们掌握了 root 用户密码,那么我想你可能就不走运了。
查看此链接以获取有关授予/撤销权限的一些信息。
http://beginner-sql-tutorial.com/sql-grant -revoke-privileges-roles.htm
授予语法(来自链接)
撤销语法(来自链接)
更多:Brian 在评论中补充说,赛门铁克有一个很好的指南来保护 MySQL。我只是想补充一点,它还包含许多非常有用的信息, http://www.symantec.com/connect/articles/secure-mysql-step-step
Yes you have some control on setting which user has what privilege. Of course if they get a hold of the root user password, then I think you may be out of luck.
Check out this link for some information regarding Granting/Revoking privileges.
http://beginner-sql-tutorial.com/sql-grant-revoke-privileges-roles.htm
Granting Syntax (from link)
Revoke Syntax (from link)
More: Brian added as a comment that Symantec has a nice guide to securing MySQL. I just wanted to add that it contains a lot of very useful information as well, http://www.symantec.com/connect/articles/securing-mysql-step-step
防止人们篡改它的最佳方法是将其放在只能从需要与数据库通信的其他计算机(例如 Web 服务器)访问的服务器上
如果可能,Web 服务器不应该具有除通过本地网络或 VPN 之外的任何管理访问权限。
如果成本是一个问题(您可能只有一台服务器或共享主机),如果您可以通过 SSL 连接运行 MySQL,那么至少密码不会以明文形式发送。
The best way to prevent people from tampering with it is to put it on a server that can only be accessed from the other machines that need to talk to the database (such as a web server)
If possible, the web-servers shouldn't have any administrative access except through a local network or a VPN.
If cost is an issue (you only have one server perhaps or a shared host) If you can run MySQL over an SSL connection, at least then the passwords aren't sent in the clear.
更新您的操作系统以获取可能导致权限升级或远程代码执行的任何安全修复程序,并使用防火墙阻止除您需要的端口之外的所有端口。如果您的数据库需要远程访问,您可以使用 SSH 隧道。文件系统访问或 shell 访问可能是篡改数据库的一种方法。
使用具有相应权限的多个凭据。对不需要写访问权限的登录使用只读访问权限。
请解释一下您的环境、情况和典型用法,这将有助于查明潜在的缺陷。
Update your OS for any security fixes that could lead to privilege escalation or remote code execution and use a firewall to block every ports beside the one you need. You could use SSH tunnels if your database needs remote access. Filesystem access or shell access may be a way to tamper with the database.
Use multiple credentials with according privileges. Use read-only access to logins that doesn't need write access.
Please explain a bit your environment and your situation and typical usage, that would help up to pinpoint potential flaws.
阅读有关 SQL 注入攻击的信息,并确保您的代码不允许此类攻击。
如果您不使用动态 SQl 并使用存储过程,则可以将权限置于过程级别,并且用户只能通过存储过程执行操作,因为您可以防止直接插入、更新和删除表。这有助于防止欺诈,因为除了开发人员编写的内容之外,用户无法执行任何操作。所以没有人可以删除整个表等。除了选择权之外,不要给开发人员生产权。加密您的备份。请记住,员工对您的数据构成的威胁与外部攻击一样大,甚至更大。
在某些数据库中,不需要系统管理员的密码。始终使用一个。请勿将其分发给任何人,除非您必须这样做。
Read up on SQL Injection attacks and make sure your code will not allow them.
If you do not use dynamic SQl and use stored procs instead, you can put permissions at the proc level and users can only do things through the stored proc as you can prevent direct insert, update and delete to the tables. This helps prevent fraud because the users can't do anything except what the developers have written. So no one can delete a whole table, etc. Do not give developers production rights other than select rights. Encrypt your backups. Remember employees are as big or bigger threat to your data as outside attacks.
In some databases a password for the sys admin is not required. Always use one. Do not give it out to anyone more than you must.