九色91_成人精品一区二区三区中文字幕_国产精品久久久久一区二区三区_欧美精品久久_国产精品99久久久久久久vr_www.国产视频

Hello! 歡迎來到小浪云!


CentOS 7 簡單搭建OpenLDAP服務


avatar
小浪云 2025-01-29 170

CentOS 7 簡單搭建OpenLDAP服務

**安裝OpenLDAP服務**

首先,安裝OpenLDAP服務器和客戶端組件:

yum install -y openldap-servers openldap-clients

復制并配置數據庫配置文件:

cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG chown ldap. /var/lib/ldap/DB_CONFIG

啟動并啟用OpenLDAP服務:

systemctl start slapd systemctl enable slapd
**配置OpenLDAP服務**
  1. 創建管理員密碼:
slappasswd

記錄生成的密碼,稍后配置中會用到。

  1. 配置根密碼:

使用文本編輯器創建一個名為chrootpw.ldif的文件,并將生成的管理員密碼添加到olcRootPW字段中。 例如:

dn: olcDatabase={0}config,cn=config changetype: modify add: olcRootPW olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxx  // 將xxxxxxxxxxxxxxxxxxxxxxxx替換為你的密碼哈希值

然后導入配置:

ldapadd -Y EXTERNAL -H ldapi:/// -f chrootpw.ldif
**導入基本模式**

導入必要的模式文件:

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
**設置域名和數據庫配置**
  1. 創建目錄管理員密碼:
slappasswd

記錄生成的密碼。

  1. 配置域名和管理員信息:

創建一個名為chdomain.ldif的文件,替換dc=jumpserver,dc=tk為你自己的域名,并將生成的目錄管理員密碼添加到olcRootPW字段中。 請注意olcAccess部分的權限設置。 以下是一個示例,請根據你的需求修改:

dn: olcDatabase={1}monitor,cn=config changetype: modify replace: olcAccess olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=Manager,dc=example,dc=com" read by * none dn: olcDatabase={2}hdb,cn=config changetype: modify replace: olcSuffix olcSuffix: dc=example,dc=com  // 替換為你的域名 dn: olcDatabase={2}hdb,cn=config changetype: modify replace: olcRootDN olcRootDN: cn=Manager,dc=example,dc=com  // 替換為你的域名和管理員DN dn: olcDatabase={2}hdb,cn=config changetype: modify add: olcRootPW olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxx  // 將xxxxxxxxxxxxxxxxxxxxxxxx替換為你的密碼哈希值 dn: olcDatabase={2}hdb,cn=config changetype: modify add: olcAccess olcAccess: {0}to attrs=userPassword,shadowLastChange by dn="cn=Manager,dc=example,dc=com" write by anonymous auth by self write by * none olcAccess: {1}to dn.base="" by * read olcAccess: {2}to * by dn="cn=Manager,dc=example,dc=com" write by * read 

然后導入配置:

ldapmodify -Y EXTERNAL -H ldapi:/// -f chdomain.ldif
  1. 創建基礎條目:

創建一個名為basedomain.ldif的文件,替換dc=jumpserver,dc=tk為你自己的域名。 例如:

dn: dc=example,dc=com  // 替換為你的域名 objectClass: top objectClass: dcObject objectclass: organization o: Example Organization dc: example dn: cn=Manager,dc=example,dc=com  // 替換為你的域名 objectClass: organizationalRole cn: Manager description: Directory Manager dn: ou=People,dc=example,dc=com  // 替換為你的域名 objectClass: organizationalUnit ou: People dn: ou=Group,dc=example,dc=com  // 替換為你的域名 objectClass: organizationalUnit ou: Group

然后導入配置:

ldapadd -x -D cn=Manager,dc=example,dc=com -W -f basedomain.ldif
**開放防火墻端口**

允許LDAP服務通過防火墻:

firewall-cmd --add-service=ldap --permanent firewall-cmd --reload
**添加用戶**
  1. 生成用戶密碼:
slappasswd

記錄生成的密碼。

  1. 創建用戶條目:

創建一個名為ldapuser.ldif的文件,替換dc=jumpserver,dc=tk為你自己的域名,并將生成的密碼添加到userPassword字段中。 例如:

dn: uid=test,ou=People,dc=example,dc=com  // 替換為你的域名 objectClass: inetOrgPerson objectClass: posixAccount objectClass: shadowAccount cn: test sn: Linux userPassword: {SSHA}xxxxxxxxxxxxxxxxx  // 將xxxxxxxxxxxxxxxxx替換為你的密碼哈希值 loginShell: /bin/bash uidNumber: 1000 gidNumber: 1000 homeDirectory: /home/test dn: cn=test,ou=Group,dc=example,dc=com  // 替換為你的域名 objectClass: posixGroup cn: test gidNumber: 1000 memberUid: test

然后導入配置:

ldapadd -x -D cn=Manager,dc=example,dc=com -W -f ldapuser.ldif
  1. 驗證用戶:
ldapsearch -x -D "cn=Manager,dc=example,dc=com" -W -b "dc=example,dc=com"

請記住將占位符域名和密碼哈希值替換為你自己的值。 在執行命令前,仔細檢查所有.ldif文件中的內容,確保沒有錯誤。

相關閱讀

主站蜘蛛池模板: 999精品视频 | 天堂在线中文字幕 | 91最新视频| 欧美黄色一区 | 黄色永久免费 | 久久综合九色综合欧美狠狠 | 国产大毛片 | 亚洲人精品 | 日韩免费网站 | 国产精品1区2区 | 高清av一区 | 91在线观看免费 | 粉嫩国产精品一区二区在线观看 | 亚洲最新网址 | 日本免费视频在线观看 | 国产精品片 | 欧美日韩综合视频 | 精品久久久久久亚洲精品 | 欧美精品一区二区在线观看 | 91精品91久久久 | 91免费观看在线 | 国外激情av| 成人av在线网站 | 一级毛片网 | 国产福利91精品一区二区三区 | 中文字幕av亚洲精品一部二部 | 国产精品高潮呻吟久久久久 | 成人国产在线视频 | 久久在线 | 国产精品海角社区在线观看 | 欧美激情亚洲天堂 | 久草.com| 亚洲乱码一区二区三区在线观看 | 91国产在线视频在线 | 精精国产xxxx视频在线野外 | 一区在线观看视频 | 欧美精品久久 | 日日干天天干 | 国产日韩精品在线 | 69堂永久69tangcom | 麻豆毛片 |