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

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
主站蜘蛛池模板: 池州市| 朝阳区| 汾阳市| 蓬安县| 黄龙县| 桂平市| 中江县| 开原市| 文山县| 厦门市| 尤溪县| 丽水市| 庆阳市| 阳江市| 青岛市| 子洲县| 蛟河市| 邻水| 甘泉县| 津南区| 尼玛县| 平安县| 荃湾区| 河曲县| 五河县| 奉贤区| 侯马市| 昔阳县| 安顺市| 岚皋县| 乌兰县| 五家渠市| 神木县| 渭源县| 宁安市| 独山县| 元氏县| 左权县| 香港| 历史| 中方县|