官术网_书友最值得收藏!

Kerberos authentication

MongoDB Enterprise Edition also offers Kerberos authentication. Kerberos, named after the character Kerberos (or Cerberus) from Greek mythology, the ferocious three-headed guard dog of the underworld, Hades, focuses on mutual authentication between client-server protecting against eavesdropping and replay attacks.

Kerberos is widely used in Windows systems, through integration with Microsoft's Active Directory. To install Kerberos, we need to start mongod without Kerberos set up and then connect to the $external database (not the admin that we normally use for admin authorization) and create a user with a Kerberos role and permissions:

use $external
db.createUser(
{
user: "mongo_book_user@packt.net",
roles: [ { role: "read", db: "mongo_book" } ]
}
)

In the preceding example, we are authorizing the mongo_book_user@packt.net user to read our  mongo_book  database, just like we would do with a user using our admin system.

After that, we need to start our server with Kerberos support by passing in the authenticationMechanisms parameter:

--setParameter authenticationMechanisms=GSSAPI

And now we can connect from our server or command line:

$ mongo.exe --host <mongoserver> --authenticationMechanism=GSSAPI --authenticationDatabase='$external' --username mongo_book_user@packt.net
主站蜘蛛池模板: 子洲县| 扎囊县| 富宁县| 读书| 会泽县| 克山县| 太康县| 松滋市| 大关县| 若羌县| 东台市| 农安县| 新泰市| 贵州省| 昌吉市| 太保市| 讷河市| 金门县| 永修县| 宣恩县| 阳山县| 达孜县| 陕西省| 昌江| 鱼台县| 焦作市| 潮安县| 浮梁县| 华安县| 吴桥县| 灵寿县| 屏边| 吴忠市| 威海市| 巍山| 重庆市| 宁德市| 云南省| 新建县| 抚州市| 冀州市|