MongoDB LDAP and Kerberos Authentication with Cent
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/
原文地址:MongoDB LDAP and Kerberos Authentication with Cent, 感谢原作者分享。

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

전자 상거래 웹 사이트를 개발할 때 어려운 문제가 발생했습니다. 사용자에게 개인화 된 제품 권장 사항을 제공하는 방법. 처음에는 간단한 권장 알고리즘을 시도했지만 결과는 이상적이지 않았으며 사용자 만족도에도 영향을 미쳤습니다. 추천 시스템의 정확성과 효율성을 향상시키기 위해보다 전문적인 솔루션을 채택하기로 결정했습니다. 마지막으로 Composer를 통해 Andres-Montanez/Residations-Bundle을 설치하여 문제를 해결했을뿐만 아니라 추천 시스템의 성능을 크게 향상 시켰습니다. 다음 주소를 통해 작곡가를 배울 수 있습니다.

해시 값으로 저장되기 때문에 MongoDB 비밀번호를 Navicat을 통해 직접 보는 것은 불가능합니다. 분실 된 비밀번호 검색 방법 : 1. 비밀번호 재설정; 2. 구성 파일 확인 (해시 값이 포함될 수 있음); 3. 코드를 점검하십시오 (암호 하드 코드 메일).

CentOS 시스템의 GitLab 데이터베이스 배포 안내서 올바른 데이터베이스를 선택하는 것은 GitLab을 성공적으로 배포하는 데 중요한 단계입니다. Gitlab은 MySQL, PostgreSQL 및 MongoDB를 포함한 다양한 데이터베이스와 호환됩니다. 이 기사는 이러한 데이터베이스를 선택하고 구성하는 방법을 자세히 설명합니다. 데이터베이스 선택 권장 사항 MySQL : 널리 사용되는 RDBMS (Relational Database Management System). PostgreSQL : 강력한 오픈 소스 RDBM은 복잡한 쿼리 및 고급 기능을 지원하며 대형 데이터 세트를 처리하는 데 적합합니다. MongoDB : 인기있는 NOSQL 데이터베이스, 바다 취급에 능숙합니다

CentOS 시스템 하에서 MongoDB 효율적인 백업 전략에 대한 자세한 설명이 기사는 CentOS 시스템에서 MongoDB 백업을 구현하기위한 다양한 전략을 자세히 소개하여 데이터 보안 및 비즈니스 연속성을 보장 할 것입니다. Docker 컨테이너 환경에서 수동 백업, 시간이 정해진 백업, 자동 스크립트 백업 및 백업 메소드를 다루고 백업 파일 관리를위한 모범 사례를 제공합니다. 수동 백업 : MongoDump 명령을 사용하여 Manual 전체 백업을 수행하십시오 (예 : Mongodump-HlocalHost : 27017-U username-P password-d 데이터베이스 이름 -o/백업 디렉토리이 명령은 지정된 데이터베이스의 데이터 및 메타 데이터를 지정된 백업 디렉토리로 내보내게됩니다.

MongoDB 및 Relational Database : 심층 비교이 기사는 NOSQL 데이터베이스 MongoDB와 전통적인 관계형 데이터베이스 (예 : MySQL 및 SQLServer)의 차이점을 심층적으로 탐구합니다. 관계형 데이터베이스는 행 및 열의 테이블 구조를 사용하여 데이터를 구성하는 반면 MongoDB는 유연한 문서 지향 모델을 사용하여 최신 응용 프로그램의 요구에 더 잘 어울립니다. 주로 데이터 구조를 차별화합니다. 관계형 데이터베이스는 사전 정의 된 스키마 테이블을 사용하여 데이터를 저장하고 기본 키와 외부 키를 통해 테이블 간의 관계가 설정됩니다. MongoDB는 JSON과 같은 BSON 문서를 사용하여 컬렉션에 저장하며 각 문서 구조는 패턴없는 설계를 달성하기 위해 독립적으로 변경할 수 있습니다. 건축 설계 : 관계형 데이터베이스는 사전 정의 된 고정 스키마가 필요합니다. MongoDB는 지원합니다

MongoDB 사용자를 설정하려면 다음 단계를 따르십시오. 1. 서버에 연결하고 관리자 사용자를 만듭니다. 2. 사용자에게 액세스 권한을 부여 할 데이터베이스를 작성하십시오. 3. CreateUser 명령을 사용하여 사용자를 생성하고 자신의 역할 및 데이터베이스 액세스 권한을 지정하십시오. 4. GetUsers 명령을 사용하여 생성 된 사용자를 확인하십시오. 5. 선택적으로 다른 컬렉션에 대한 다른 권한을 설정하거나 사용자 권한을 부여합니다.

데비안 시스템에서 MongoDB 데이터베이스를 암호화하려면 다음 단계에 따라 필요합니다. 1 단계 : 먼저 MongoDB 설치 먼저 Debian 시스템이 MongoDB가 설치되어 있는지 확인하십시오. 그렇지 않은 경우 설치를위한 공식 MongoDB 문서를 참조하십시오 : https://docs.mongodb.com/manual/tutorial/install-mongodb-ondodb-on-debian/step 2 : 암호화 키 파일 생성 암호화 키를 포함하는 파일을 만듭니다.

MongoDB에 연결하기위한 주요 도구는 다음과 같습니다. 1. MongoDB 쉘, 데이터를 신속하게보고 간단한 작업을 수행하는 데 적합합니다. 2. 언어 드라이버 (Pymongo, MongoDB Java 드라이버, MongoDB Node.js 드라이버 등)는 응용 프로그램 개발에 적합하지만 사용 방법을 마스터해야합니다. 3. GUI 도구 (예 : Robo 3T, Compass)는 초보자를위한 그래픽 인터페이스와 빠른 데이터보기를 제공합니다. 도구를 선택할 때는 응용 프로그램 시나리오 및 기술 스택을 고려하고 연결 문자열 구성, 권한 관리 및 연결 풀 및 인덱스 사용과 같은 성능 최적화에주의를 기울여야합니다.
