目錄
Overview
Requirements
Setup procedure
Setting up MongoDB with LDAP authentication using Centrify
Setting up MongoDB with Kerberos authentication using Centrify
Summary and more information
About Centrify
Video tutorials
首頁 資料庫 mysql教程 MongoDB LDAP and Kerberos Authentication with Cent

MongoDB LDAP and Kerberos Authentication with Cent

Jun 07, 2016 pm 04:40 PM
and auth kerberos ldap mongodb

By Alex Komyagin at MongoDB with the help of Felderi Santiago at Centrify and Robertson Pimentel at Centrify Overview Centrify provides unified identity management solutions that result in single sign-on (SSO) for users and a simplified id

By Alex Komyagin at MongoDB with the help of Felderi Santiago at Centrify and Robertson Pimentel at Centrify

Overview

Centrify provides unified identity management solutions that result in single sign-on (SSO) for users and a simplified identity infrastructure for IT. Centrify’s Server Suite integrates Linux systems into Active Directory domains to enable centralized authentication, access control, privilege user management and auditing access for compliance needs.

Since version 2.4, MongoDB Enterprise allows authentication with Microsoft Active Directory Services using LDAP and Kerberos protocols. On Linux systems it is now possible to leverage Centrify’s Server Suite solution for integrating MongoDB with Active Directory.

The use of Centrify’s Active Directory integration with MongoDB greatly simplifies setup process and allows MongoDB to seamlessly integrate into the most complex Active Directory environments found at enterprise customer sites with hundreds or thousands of employees.

Requirements

  • Existing Active Directory domain
  • MongoDB Enterprise 2.4 or greater
  • Centrify Suite

All further MongoDB commands in this paper are given for the current latest stable release, MongoDB 2.6.5. The Linux OS used is RHEL6.4. The Centrify Server Suite version is 2014.1.

Setup procedure

Preparing a new MongoDB Linux server

In existing Enterprise environments that are already using Centrify and MongoDB there are usually specific guidelines on setting up Linux systems. Here we will cover the most basic steps needed, that can be used as a quick reference:

1. Configure hostname and DNS resolution

For Centrify and MongoDB to function properly you must set a hostname on the system and make sure it’s configured to use the proper Active Directory-aware DNS server instance IP address. You can update the hostname using commands that resemble the following:

<b>$ nano /etc/sysconfig/network</b>
HOSTNAME=lin-client.mongotest.com
<b>$ reboot</b>
<b>$ hostname -f</b>
lin-client.mongotest.com
登入後複製

Next, verify the DNS settings and add additional servers, if needed:

<b>$ nano /etc/resolv.conf</b>
search mongotest.com
nameserver 10.10.42.250
登入後複製

2. Install MongoDB Enterprise

The installation process is well outlined in our Documentation. It’s recommended to turn SELinux off for this exercise:

<b>$ nano /etc/selinux/config</b>
SELINUX=disabled
登入後複製

Since MongoDB grants user privileges through role-based authorization, there should be an LDAP and a Kerberos user created in mongodb:

<b>$ service mongod start
$ mongo
> db.getSiblingDB("$external").createUser(
    {
      user : "alex",
      roles: [ { role: "root" , db : "admin"} ]
    }
)
> db.getSiblingDB("$external").createUser(
   {
     user: "alex@MONGOTEST.COM",
     roles: [ { role: "root", db: "admin" } ]
   }
)</b>
登入後複製

“alex” is a user listed in AD and who is a member of the “Domain Users” group and has “support” set as its Organizational Unit.

3. Install Centrify agent

Unpack the Centrify suite archive and install the centrify-dc package. Then join the server to your domain as a workstation:

<b>$ rpm -ihv centrifydc-5.2.0-rhel3-x86_64.rpm</b>
<b>$ adjoin -V -w -u ldap_admin mongotest.com</b>
ldap_admin@MONGOTEST.COM's password:
登入後複製

Here “ldap_admin” is user who is a member of the “Domain Admins” group in AD.

Setting up MongoDB with LDAP authentication using Centrify

Centrify agent manages all communications with Active Directory, and MongoDB can use the Centrify PAM module to authenticate LDAP users.

1. Configure saslauthd, which is used by MongoDB as an interface between the database and the Linux PAM system.

a. Verify that “MECH=pam” is set in /etc/sysconfig/saslauthd:

<b>$ grep ^MECH /etc/sysconfig/saslauthd</b>
MECH=pam
登入後複製

b. Turn on the saslauthd service and ensure it is started upon reboot:

<b>$ service saslauthd start</b>
Starting saslauthd:                                     [  OK  ]
<b>$ chkconfig saslauthd on</b>
<b>$ chkconfig --list saslauthd</b>
saslauthd  0:off   1:off   2:on    3:on 4:on    5:on    6:off
登入後複製

2. Configure PAM to recognize the mongodb service by creating an appropriate PAM service file. We will use the sshd service file as a template, since it should’ve already been preconfigured to work with Centrify:

<b>$ cp -v /etc/pam.d/{sshd,mongodb}</b>
`/etc/pam.d/sshd' -> `/etc/pam.d/mongodb'
登入後複製

3. Start MongoDB with LDAP authentication enabled, by adjusting the config file:

<b>$ nano /etc/mongod.conf</b>
auth=true
setParameter=saslauthdPath=/var/run/saslauthd/mux
setParameter=authenticationMechanisms=PLAIN
<b>$ service mongod restart</b>
登入後複製

4. Try to authenticate as the user “alex” in MongoDB:

<b>$ mongo
> db.getSiblingDB("$external").auth(
   {
     mechanism: "PLAIN",
     user: "alex",
     pwd:  "xxx",
     digestPassword: false
   }
)</b>
1
<b>></b>
登入後複製

Returning a value of “1” means the authentication was successful.

Setting up MongoDB with Kerberos authentication using Centrify

Centrify agent automatically updates system Kerberos configuration (the /etc/krb5.conf file), so no manual configuration is necessary. Additionally, Centrify provides means to create Active Directory service user, service principal name and keyfile directly from the Linux server, thus making automation easier.

1. Create the “lin-client-svc” user in Active Directory with SPN and UPN for the server, and export its keytab to the “mongod_lin.keytab” file:

<b>$ adkeytab -n -P mongodb/lin-client.mongotest.com@MONGOTEST.COM -U mongodb/lin-client.mongotest.com@MONGOTEST.COM -K /home/ec2-user/mongod_lin.keytab -c "OU=support" -V --user ldap_admin lin-client-svc</b>
ldap_admin@MONGOTEST.COM's password:
<b>$ adquery user lin-client-svc -PS</b>
userPrincipalName:mongodb/lin-client.mongotest.com@MONGOTEST.COM
servicePrincipalName:mongodb/lin-client.mongotest.com
登入後複製

Again, the “ldap_admin” is user who is a member of the “Domain Admins” group in AD. An OU “support” will be used to create the “lin-client-svc” service user.

2. Start MongoDB with Kerberos authentication enabled, by adjusting the config file. You also need to make sure that mongod listens on the interface associated with the FQDN. For this exercise, you can just configure mongod to listen on all interfaces:

<b>$ nano /etc/mongod.conf</b>
# Listen to local interface only. Comment out to listen on all interfaces.
#bind_ip=127.0.0.1
auth=true
setParameter=authenticationMechanisms=GSSAPI
<b>$ service mongod stop</b>
<b>$ env KRB5_KTNAME=/home/ec2-user/mongod_lin.keytab mongod -f /etc/mongod.conf</b>
登入後複製

3. Try to authenticate as the user “alex@MONGOTEST.COM” in MongoDB:

<b>$ kinit alex@MONGOTEST.COM</b>
Password for alex@MONGOTEST.COM:
<b>$ mongo --host lin-client.mongotest.com
> db.getSiblingDB("$external").auth(
   {
     mechanism: "GSSAPI",
     user: "alex@MONGOTEST.COM",
   }
)</b>
1
<b>></b>
登入後複製

The return value of “1” indicates success.

Summary and more information

MongoDB supports different options for authentication, including Kerberos and LDAP external authentication. With MongoDB and Centrify integration, it is now possible to speed up enterprise deployments of MongoDB into your existing security and Active Directory infrastructure and ensure quick day-one productivity without expending days and weeks of labor dealing with open-source tools.

About Centrify

Centrify is a leading provider of unified identity management solutions that result in single sign-on (SSO) for users and a simplified identity infrastructure for IT. Centrify’s Server Suite software integrates Linux systems into Active Directory domains to enable centralized authentication, access control, privilege user management and auditing access for compliance needs. Over the last 10 years, more than 5,000 customers around the world, including nearly half of the Fortune 50, have deployed and trusted Centrify solutions across millions of servers, workstations, and applications, and have regularly reduced their identity management and compliance costs by 50% or more.

Video tutorials

Video on how to use Centrify to integrate MongoDB with Active Directory:

Video on how to enforce PAM access rights as an additional security layer for MongoDB with Centrify:

Centrify Community post and videos showcasing Active Directory integration for MongoDB: http://community.centrify.com/t5/Standard-Edition-DirectControl/MongoDB-AD-Integration-made-easy-with-Centrify/td-p/18779

MongoDB security documentation is available here: http://docs.mongodb.org/manual/security/ MongoDB user and role management tutorials: http://docs.mongodb.org/manual/administration/security-user-role-management/

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1668
14
CakePHP 教程
1428
52
Laravel 教程
1329
25
PHP教程
1273
29
C# 教程
1256
24
使用 Composer 解決推薦系統的困境:andres-montanez/recommendations-bundle 的實踐 使用 Composer 解決推薦系統的困境:andres-montanez/recommendations-bundle 的實踐 Apr 18, 2025 am 11:48 AM

在開發一個電商網站時,我遇到了一個棘手的問題:如何為用戶提供個性化的商品推薦。最初,我嘗試了一些簡單的推薦算法,但效果並不理想,用戶的滿意度也因此受到影響。為了提升推薦系統的精度和效率,我決定採用更專業的解決方案。最終,我通過Composer安裝了andres-montanez/recommendations-bundle,這不僅解決了我的問題,還大大提升了推薦系統的性能。可以通過一下地址學習composer:學習地址

Navicat查看MongoDB數據庫密碼的方法 Navicat查看MongoDB數據庫密碼的方法 Apr 08, 2025 pm 09:39 PM

直接通過 Navicat 查看 MongoDB 密碼是不可能的,因為它以哈希值形式存儲。取回丟失密碼的方法:1. 重置密碼;2. 檢查配置文件(可能包含哈希值);3. 檢查代碼(可能硬編碼密碼)。

CentOS上GitLab的數據庫如何選擇 CentOS上GitLab的數據庫如何選擇 Apr 14, 2025 pm 04:48 PM

CentOS系統上GitLab數據庫部署指南選擇合適的數據庫是成功部署GitLab的關鍵步驟。 GitLab兼容多種數據庫,包括MySQL、PostgreSQL和MongoDB。本文將詳細介紹如何選擇並配置這些數據庫。數據庫選擇建議MySQL:一款廣泛應用的關係型數據庫管理系統(RDBMS),性能穩定,適用於大多數GitLab部署場景。 PostgreSQL:功能強大的開源RDBMS,支持複雜查詢和高級特性,適合處理大型數據集。 MongoDB:流行的NoSQL數據庫,擅長處理海

CentOS MongoDB備份策略是什麼 CentOS MongoDB備份策略是什麼 Apr 14, 2025 pm 04:51 PM

CentOS系統下MongoDB高效備份策略詳解本文將詳細介紹在CentOS系統上實施MongoDB備份的多種策略,以確保數據安全和業務連續性。我們將涵蓋手動備份、定時備份、自動化腳本備份以及Docker容器環境下的備份方法,並提供備份文件管理的最佳實踐。手動備份:利用mongodump命令進行手動全量備份,例如:mongodump-hlocalhost:27017-u用戶名-p密碼-d數據庫名稱-o/備份目錄此命令會將指定數據庫的數據及元數據導出到指定的備份目錄。

MongoDB 與關係數據庫:全面比較 MongoDB 與關係數據庫:全面比較 Apr 08, 2025 pm 06:30 PM

MongoDB與關係型數據庫:深度對比本文將深入探討NoSQL數據庫MongoDB與傳統關係型數據庫(如MySQL和SQLServer)的差異。關係型數據庫採用行和列的表格結構組織數據,而MongoDB則使用靈活的面向文檔模型,更適應現代應用的需求。主要區別數據結構:關係型數據庫使用預定義模式的表格存儲數據,表間關係通過主鍵和外鍵建立;MongoDB使用類似JSON的BSON文檔存儲在集合中,每個文檔結構可獨立變化,實現無模式設計。架構設計:關係型數據庫需要預先定義固定的模式;MongoDB支持

mongodb怎麼設置用戶 mongodb怎麼設置用戶 Apr 12, 2025 am 08:51 AM

要設置 MongoDB 用戶,請按照以下步驟操作:1. 連接到服務器並創建管理員用戶。 2. 創建要授予用戶訪問權限的數據庫。 3. 使用 createUser 命令創建用戶並指定其角色和數據庫訪問權限。 4. 使用 getUsers 命令檢查創建的用戶。 5. 可選地設置其他權限或授予用戶對特定集合的權限。

Debian MongoDB如何進行數據加密 Debian MongoDB如何進行數據加密 Apr 12, 2025 pm 08:03 PM

在Debian系統上為MongoDB數據庫加密,需要遵循以下步驟:第一步:安裝MongoDB首先,確保您的Debian系統已安裝MongoDB。如果沒有,請參考MongoDB官方文檔進行安裝:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/第二步:生成加密密鑰文件創建一個包含加密密鑰的文件,並設置正確的權限:ddif=/dev/urandomof=/etc/mongodb-keyfilebs=512

連接mongodb的工具有哪些 連接mongodb的工具有哪些 Apr 12, 2025 am 06:51 AM

連接MongoDB的工具主要有:1. MongoDB Shell,適用於快速查看數據和執行簡單操作;2. 編程語言驅動程序(如PyMongo, MongoDB Java Driver, MongoDB Node.js Driver),適合應用開發,但需掌握其使用方法;3. GUI工具(如Robo 3T, Compass),提供圖形化界面,方便初學者和快速數據查看。選擇工具需考慮應用場景和技術棧,並註意連接字符串配置、權限管理及性能優化,如使用連接池和索引。

See all articles