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

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
主站蜘蛛池模板: 长泰县| 波密县| 柳河县| 湾仔区| 福清市| 金塔县| 青田县| 呼和浩特市| 城步| 泽州县| 额尔古纳市| 嘉荫县| 沂源县| 禹城市| 江西省| 当阳市| 武陟县| 淳安县| 郓城县| 阜阳市| 阳曲县| 报价| 陇川县| 清苑县| 嘉荫县| 五大连池市| 拉孜县| 柞水县| 大石桥市| 离岛区| 太白县| 大姚县| 余庆县| 灌阳县| 嵊州市| 仙桃市| 黄骅市| 搜索| 宾阳县| 乌兰察布市| 广平县|