MongoDB的安全性,我错过了什么?
如果你想用Node JS实现一些东西,Mongo DB&Express是否足够安全地连接到Mongo DB?
有人可以从安全angular度解释这个代码吗?
===
许多教程只是使用…
var mongoClient = new MongoClient(new Server('localhost', 27017));
Mongos文件包括…
var MongoClient = require('mongodb').MongoClient; // Connect to the db MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) { if(!err) { console.log("We are connected"); } });
===
代码基于Mongo文档 – http://mongodb.github.io/node-mongodb-native/api-articles/nodekoarticle1.html#getting-that-connection-to-the-database
你不会错过很多。 对于大多数数据库服务器来说,最好的办法是通过使它们远离公用networking来保护它们。
例如MySQL也是如此 – 它缺less像Kerberos这样的企业authentication方法(从2004年开始要求: http : //bugs.mysql.com/bug.php?id=6733 )。
您只需将您的数据库服务器保留在受信任的局域网内。 如果你想用密码进行login,那么总比没有好,但是将大多数数据库暴露给外部世界是一个坏主意,因为它们缺less简单的保护措施,如错误密码限制。 它们并不意味着以这种方式面向用户。