安装OpenLDAP
2.6.安裝OpenLDAP
2.6.1.系統(tǒng)環(huán)境信息
[root@hadoop1 ~]# cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core)2.6.2.基礎(chǔ)的環(huán)境準(zhǔn)備
關(guān)閉防火墻:/etc/init.d/iptables stop && chkconfig iptables off
關(guān)閉NetworkManager:/etc/init.d/NetworkManager stop && chkconfig NetworkManager off
SeLinux設(shè)為disabled:getenforce 是否為Disabled,若不是,則修改:
1:臨時(shí)的生效 setenforce 0,再getenforce的時(shí)候?yàn)閜ermissive
2:修改配置文件,然后重啟 vim /etc/sysconfig/selinux 把SELINUX=disabled
2.6.3.OpenLDAP服務(wù)器的搭建
2.6.3.1.安裝OpenLDAP的相關(guān)
yum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql openldap-devel migrationtools openldap-servers-sql其中compat-openldap這個(gè)包與主從有很大的關(guān)系
安裝包說(shuō)明:
| openldap | openldap服務(wù)端和客戶(hù)端必須用的庫(kù)文件。 |
| openldap-servers | 用于啟動(dòng)服務(wù)器和設(shè)置。包含單獨(dú)的ldap后臺(tái)守護(hù)程序。 |
| openldap-client | 用于啟動(dòng)服務(wù)和設(shè)置. 包含單獨(dú)的ldap后臺(tái)守護(hù)程序。 |
| openldap-devel | devel包,可選擇進(jìn)行安裝。 |
| openldap-servers-sq | 支持sql模塊,可進(jìn)行選擇性安裝。 |
| migrationtools | 通過(guò)migrationtools實(shí)現(xiàn)OpenLDAP用戶(hù)及用戶(hù)組的添加,導(dǎo)入系統(tǒng)賬戶(hù),可進(jìn)行選擇性安裝。 |
| compat-openldap | openldap兼容性庫(kù) |
安裝完后,可以看到自動(dòng)創(chuàng)建了ldap用戶(hù):
[root@hadoop1 ~]# tail -n 2 /etc/passwd ldap:x:55:55:OpenLDAP server:/var/lib/ldap:/sbin/nologin saslauth:x:997:76:Saslauthd user:/run/saslauthd:/sbin/nologin [root@hadoop1 ~]#可以通過(guò)rpm -qa |grep openldap查看安裝了哪些包:
[root@hadoop1 ~]# rpm -qa | grep openldap openldap-clients-2.4.44-21.el7_6.x86_64 openldap-servers-2.4.44-21.el7_6.x86_64 openldap-devel-2.4.44-21.el7_6.x86_64 compat-openldap-2.3.43-5.el7.x86_64 openldap-servers-sql-2.4.44-21.el7_6.x86_64 openldap-2.4.44-21.el7_6.x86_64 [root@hadoop1 ~]#查看OpenLDAP版本,使用如下命令:
[root@hadoop1 openldap]# slapd -VV @(#) $OpenLDAP: slapd 2.4.44 (Jan 29 2019 17:42:45) $mockbuild@x86-01.bsys.centos.org:/builddir/build/BUILD/openldap-2.4.44/openldap-2.4.44/servers/slapd[root@hadoop1 openldap]#2.6.3.2.OpenLDAP的相關(guān)配置文件信息
/etc/openldap : OpenLDAP配置文件和目錄所在位置
/etc/openldap/slapd.conf :OpenLDAP的主配置文件,記錄根域信息,管理員名稱(chēng),密碼,日志,權(quán)限等
/etc/openldap/slapd.d : 這下面是/etc/openldap/slapd.conf配置信息生成的文件,每修改一次配置信息,這里的東西就要重新生成, OpenLDAP2.4.23版本開(kāi)始所有配置數(shù)據(jù)都保存在/etc/openldap/slapd.d/,很多博客都是使用slapd.conf作為配置文件。
/etc/openldap/schema/* : OpenLDAP的schema存放的地方
/var/lib/ldap/* : OpenLDAP的數(shù)據(jù)文件
/usr/share/openldap-servers/DB_CONFIG.example 模板數(shù)據(jù)庫(kù)配置文件
OpenLDAP監(jiān)聽(tīng)的端口:
默認(rèn)監(jiān)聽(tīng)端口:389(明文數(shù)據(jù)傳輸)
加密監(jiān)聽(tīng)端口:636(密文數(shù)據(jù)傳輸)
2.6.3.3.配置OpenLDAP的管理員密碼
這里明文密碼設(shè)置成hadoop
[root@hadoop1 ~]# slappasswd -s hadoop {SSHA}SMAAPnUUuQGauovPwsCAk/q1eKY87kUu [root@hadoop1 ~]#2.6.3.4.修改olcDatabase={2}hdb.ldif文件
vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{2\}hdb.ldif末尾添加一行: olcRootPW: {SSHA}SMAAPnUUuQGauovPwsCAk/q1eKY87kUu (注意,這里是上面的密碼,它上面不要有空行)修改: olcSuffix: dc=zuoquantu,dc=com olcRootDN: cn=Manager,dc=zuoquantu,dc=com完整文件:
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. # CRC32 6f27a82a dn: olcDatabase={2}hdb objectClass: olcDatabaseConfig objectClass: olcHdbConfig olcDatabase: {2}hdb olcDbDirectory: /var/lib/ldap olcSuffix: dc=zuoquantu,dc=com olcRootDN: cn=Manager,dc=zuoquantu,dc=com olcDbIndex: objectClass eq,pres olcDbIndex: ou,cn,mail,surname,givenname eq,pres,sub structuralObjectClass: olcHdbConfig entryUUID: 667c30cc-25e8-103a-83dd-c7513b40ba38 creatorsName: cn=config createTimestamp: 20200509022740Z entryCSN: 20200509022740.627338Z#000000#000#000000 modifiersName: cn=config modifyTimestamp: 20200509022740Z olcRootPW: {SSHA}SMAAPnUUuQGauovPwsCAk/q1eKY87kUu2.6.3.5.修改olcDatabase={1}monitor.ldif文件
vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{1\}monitor.ldif修改如下:
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=Manager,dc=zuoquantu,dc=com" read by * none完整如下:
# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. # CRC32 45a2833d dn: olcDatabase={1}monitor objectClass: olcDatabaseConfig olcDatabase: {1}monitor olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=Manager,dc=zuoquantu,dc=com" read by * none structuralObjectClass: olcDatabaseConfig entryUUID: 667c2992-25e8-103a-83dc-c7513b40ba38 creatorsName: cn=config createTimestamp: 20200509022740Z entryCSN: 20200509022740.627153Z#000000#000#000000 modifiersName: cn=config modifyTimestamp: 20200509022740Z2.6.3.6.驗(yàn)證配置文件是否正確
[root@hadoop1 ~]# slaptest -u 5eb650aa ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif" 5eb650aa ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif" config file testing succeeded [root@hadoop1 ~]#2.6.3.7.啟動(dòng)服務(wù)&&查看服務(wù)
[root@hadoop1 ~]# systemctl enable slapd [root@hadoop1 ~]# systemctl start slapd [root@hadoop1 ~]# systemctl status slapd ● slapd.service - OpenLDAP Server DaemonLoaded: loaded (/usr/lib/systemd/system/slapd.service; enabled; vendor preset: disabled)Active: active (running) since 六 2020-05-09 14:44:50 CST; 7s agoDocs: man:slapdman:slapd-configman:slapd-hdbman:slapd-mdbfile:///usr/share/doc/openldap-servers/guide.htmlProcess: 1931 ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS (code=exited, status=0/SUCCESS)Process: 1915 ExecStartPre=/usr/libexec/openldap/check-config.sh (code=exited, status=0/SUCCESS)Main PID: 1933 (slapd)CGroup: /system.slice/slapd.service└─1933 /usr/sbin/slapd -u ldap -h ldapi:/// ldap:///5月 09 14:44:50 hadoop1 systemd[1]: Starting OpenLDAP Server Daemon... 5月 09 14:44:50 hadoop1 runuser[1918]: pam_unix(runuser:session): session opened for user ldap by (uid=0) 5月 09 14:44:50 hadoop1 slapd[1931]: @(#) $OpenLDAP: slapd 2.4.44 (Jan 29 2019 17:42:45) $mockbuild@x86-01.bsys.centos.org:/builddir/build/BUILD/openl...slapd 5月 09 14:44:50 hadoop1 slapd[1931]: ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/o...ldif" 5月 09 14:44:50 hadoop1 slapd[1931]: ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/o...ldif" 5月 09 14:44:50 hadoop1 slapd[1931]: tlsmc_get_pin: INFO: Please note the extracted key file will not be ...ions. 5月 09 14:44:50 hadoop1 slapd[1933]: hdb_db_open: warning - no DB_CONFIG file found in directory /var/lib... (2).Expect poor performance for suffix "dc=zuoquantu,dc=com". 5月 09 14:44:50 hadoop1 slapd[1933]: slapd starting 5月 09 14:44:50 hadoop1 systemd[1]: Started OpenLDAP Server Daemon. Hint: Some lines were ellipsized, use -l to show in full. [root@hadoop1 ~]#2.6.3.8.查看監(jiān)聽(tīng)端口389
[root@hadoop1 ~]# netstat -anpl | grep 389 tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN 1933/slapd tcp6 0 0 :::389 :::* LISTEN 1933/slapd [root@hadoop1 ~]#2.6.3.9.配置OpenLDAP數(shù)據(jù)庫(kù)
[root@hadoop1 ~]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG [root@hadoop1 ~]# chown ldap:ldap -R /var/lib/ldap/ [root@hadoop1 ~]# chmod 700 -R /var/lib/ldap/ [root@hadoop1 ~]# ll /var/lib/ldap/ 總用量 376 -rwx------ 1 ldap ldap 2048 5月 9 14:44 alock -rwx------ 1 ldap ldap 303104 5月 9 14:44 __db.001 -rwx------ 1 ldap ldap 40960 5月 9 14:44 __db.002 -rwx------ 1 ldap ldap 49152 5月 9 14:44 __db.003 -rwx------ 1 ldap ldap 845 5月 9 14:50 DB_CONFIG -rwx------ 1 ldap ldap 8192 5月 9 14:44 dn2id.bdb -rwx------ 1 ldap ldap 32768 5月 9 14:44 id2entry.bdb -rwx------ 1 ldap ldap 10485760 5月 9 14:44 log.0000000001 [root@hadoop1 ~]#注意:/var/lib/ldap/就是BerkeleyDB數(shù)據(jù)庫(kù)默認(rèn)存儲(chǔ)的路徑。
2.6.3.10.導(dǎo)入基本Schema
[root@hadoop1 ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif [root@hadoop1 ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif [root@hadoop1 ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif輸出:
2.6.3.11.修改migrate_common.ph文件
[root@hadoop1 ~]# vi /usr/share/migrationtools/migrate_common.ph修改如下變量:
$DEFAULT_MAIL_DOMAIN = "zuoquantu.com"; $DEFAULT_BASE = "dc=zuoquantu,dc=com"; $EXTENDED_SCHEMA = 1;2.6.3.12.添加用戶(hù)組及用戶(hù)組
默認(rèn)情況下OpenLDAP是沒(méi)有普通用戶(hù)的,但是有一個(gè)管理員用戶(hù)。管理用戶(hù)就是前面我們剛剛配置的root。
現(xiàn)在我們把系統(tǒng)中的用戶(hù),添加到OpenLDAP中。為了進(jìn)行區(qū)分,我們現(xiàn)在新加兩個(gè)用戶(hù)ldapuser1和ldapuser2,和兩個(gè)用戶(hù)組ldapgroup1和ldapgroup2,如下:
添加用戶(hù)組,使用如下命令:
2.6.3.13.添加用戶(hù)并設(shè)置密碼,使用如下命令
[root@hadoop1 ~]# useradd -g ldapgroup1 ldapuser1 [root@hadoop1 ~]# useradd -g ldapgroup2 ldapuser2 [root@hadoop1 ~]# useradd -g ldapgroup3 ldapuser3[root@hadoop1 ~]# passwd ldapuser1 更改用戶(hù) ldapuser1 的密碼 。 新的 密碼: 無(wú)效的密碼: 密碼少于 8 個(gè)字符 重新輸入新的 密碼: passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。密碼都設(shè)置為:hadoop [root@hadoop1 ~]# passwd ldapuser2 更改用戶(hù) ldapuser2 的密碼 。 新的 密碼: 無(wú)效的密碼: 密碼少于 8 個(gè)字符 重新輸入新的 密碼: passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。 [root@hadoop1 ~]#密碼都設(shè)置為:hadoop[root@hadoop1 ~]# passwd ldapuser3 更改用戶(hù) ldapuser2 的密碼 。 新的 密碼: 無(wú)效的密碼: 密碼少于 8 個(gè)字符 重新輸入新的 密碼: passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。 [root@hadoop1 ~]#密碼都設(shè)置為:hadoop2.6.3.14.提取用戶(hù)和組
[root@hadoop1 ~]# grep ":10[0-9][0-9]" /etc/passwd > /root/users [root@hadoop1 ~]# grep ":10[0-9][0-9]" /etc/group > /root/groups結(jié)果:
[root@hadoop1 ~]# cat users ldapuser1:x:1001:1001::/home/ldapuser1:/bin/bash ldapuser2:x:1002:1002::/home/ldapuser2:/bin/bash[root@hadoop1 ~]# cat groups ldapgroup1:x:1001: ldapgroup2:x:1002:2.6.3.15.生成用戶(hù)和組的ldif文件
[root@hadoop1 ~]# /usr/share/migrationtools/migrate_passwd.pl /root/users > /root/users.ldif [root@hadoop1 ~]# /usr/share/migrationtools/migrate_group.pl /root/groups > /root/groups.ldif [root@hadoop1 ~]# cat /root/users.ldif [root@hadoop1 ~]# cat groups.ldifcat /root/users.ldif的輸出如下:
[root@hadoop1 ~]# cat /root/users.ldif dn: uid=ldapuser1,ou=People,dc=zuoquantu,dc=com uid: ldapuser1 cn: ldapuser1 sn: ldapuser1 mail: ldapuser1@zuoquantu.com objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$hE6ZwUIO$/KDZEpoOZEPW5JkaFceOf7Xd4F/YuM5pI3413v4UmZQ3DKRrEA3YtyhndZirAlZ0EjdXXe2Vr61tBidjuRJ.K0 shadowLastChange: 18391 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 1001 gidNumber: 1001 homeDirectory: /home/ldapuser1dn: uid=ldapuser2,ou=People,dc=zuoquantu,dc=com uid: ldapuser2 cn: ldapuser2 sn: ldapuser2 mail: ldapuser2@zuoquantu.com objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$kRrZQi/u$iopzFYOu9CNLZGLrdHRp.e4qw2ifAL/rm6qeGSm/BNf2vmoDyK9SxJC.DZ.RmL7Kiikw4c7jKImpSgQCuVnKN1 shadowLastChange: 18391 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 1002 gidNumber: 1002 homeDirectory: /home/ldapuser2[root@hadoop1 ~]# [root@hadoop1 ~]# cat /root/groups.ldif dn: cn=ldapgroup1,ou=Group,dc=zuoquantu,dc=com objectClass: posixGroup objectClass: top cn: ldapgroup1 userPassword: {crypt}x gidNumber: 1001dn: cn=ldapgroup2,ou=Group,dc=zuoquantu,dc=com objectClass: posixGroup objectClass: top cn: ldapgroup2 userPassword: {crypt}x gidNumber: 1002[root@hadoop1 ~]#2.6.3.16.導(dǎo)入用戶(hù)及用戶(hù)組到OpenLDAP數(shù)據(jù)庫(kù)
配置openldap基礎(chǔ)的數(shù)據(jù)庫(kù),如下(注意空行):
cat > /root/base.ldif << EOF dn: dc=zuoquantu,dc=com o: zuoquantu com dc: zuoquantu objectClass: top objectClass: dcObject objectclass: organizationdn: cn=Manager,dc=zuoquantu,dc=com cn: Manager objectClass: organizationalRole description: Directory Managerdn: ou=People,dc=zuoquantu,dc=com ou: People objectClass: top objectClass: organizationalUnitdn: ou=Group,dc=zuoquantu,dc=com ou: Group objectClass: top objectClass: organizationalUnit EOF最終的結(jié)果如下:
導(dǎo)入基礎(chǔ)數(shù)據(jù)庫(kù),使用如下命令:
[root@hadoop1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/base.ldif adding new entry "dc=zuoquantu,dc=com"adding new entry "cn=Manager,dc=zuoquantu,dc=com"adding new entry "ou=People,dc=zuoquantu,dc=com"adding new entry "ou=Group,dc=zuoquantu,dc=com"[root@hadoop1 ~]#導(dǎo)入用戶(hù):
[root@hadoop1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/users.ldif adding new entry "uid=ldapuser1,ou=People,dc=zuoquantu,dc=com"adding new entry "uid=ldapuser2,ou=People,dc=zuoquantu,dc=com"[root@hadoop1 ~]#導(dǎo)入用戶(hù)組:
[root@hadoop1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/groups.ldif adding new entry "cn=ldapgroup1,ou=Group,dc=zuoquantu,dc=com"adding new entry "cn=ldapgroup2,ou=Group,dc=zuoquantu,dc=com"[root@hadoop1 ~]#2.6.3.17.把OpenLDAP用戶(hù)加入到用戶(hù)組
盡管我們已經(jīng)把用戶(hù)和用戶(hù)組信息,導(dǎo)入到OpenLDAP數(shù)據(jù)庫(kù)中了。但實(shí)際上目前OpenLDAP用戶(hù)和用戶(hù)組之間是沒(méi)有任何關(guān)聯(lián)的。
如果我們要把OpenLDAP數(shù)據(jù)庫(kù)中的用戶(hù)和用戶(hù)組關(guān)聯(lián)起來(lái)的話(huà),我們還需要做另外單獨(dú)的配置。
現(xiàn)在我們要把ldapuser1用戶(hù)加入到ldapgroup1用戶(hù)組,需要新建添加用戶(hù)到用戶(hù)組的ldif文件,如下
導(dǎo)入ldif
[root@hadoop1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/add_user_to_groups.ldif modifying entry "cn=ldapgroup1,ou=Group,dc=zuoquantu,dc=com"[root@hadoop1 ~]#經(jīng)過(guò)上面的操作之后,再次關(guān)聯(lián)用戶(hù)2
[root@bigdata1 ~]# cat > add_user_to_groups.ldif << "EOF" > dn: cn=ldapgroup2,ou=Group,dc=zuoquantu,dc=com > changetype: modify > add: memberuid > memberuid: ldapuser2 > EOF [root@bigdata1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/add_user_to_groups.ldif modifying entry "cn=ldapgroup2,ou=Group,dc=zuoquantu,dc=com"[root@bigdata1 ~]#經(jīng)過(guò)上面的操作之后,再次關(guān)聯(lián)用戶(hù)3
[root@bigdata1 ~]# cat > add_user_to_groups.ldif << "EOF" > dn: cn=ldapgroup3,ou=Group,dc=zuoquantu,dc=com > changetype: modify > add: memberuid > memberuid: ldapuser3 > EOF [root@bigdata1 ~]# ldapadd -x -w "hadoop" -D "cn=Manager,dc=zuoquantu,dc=com" -f /root/add_user_to_groups.ldif modifying entry "cn=ldapgroup3,ou=Group,dc=zuoquantu,dc=com"[root@bigdata1 ~]#查詢(xún)用戶(hù)
[root@hadoop1 ~]# ldapsearch -LLL -x -D 'cn=Manager,dc=zuoquantu,dc=com' -w "hadoop" -b 'dc=zuoquantu,dc=com' 'cn=ldapgroup1' dn: cn=ldapgroup1,ou=Group,dc=zuoquantu,dc=com objectClass: posixGroup objectClass: top cn: ldapgroup1 userPassword:: e2NyeXB0fXg= gidNumber: 1001 memberUid: ldapuser1[root@hadoop1 ~]#2.6.3.18.開(kāi)啟OpenLDAP日志訪(fǎng)問(wèn)功能
默認(rèn)情況下OpenLDAP是沒(méi)有啟用日志記錄功能的,但是在實(shí)際使用過(guò)程中,我們?yōu)榱硕ㄎ粏?wèn)題需要使用到OpenLDAP日志。
新建日志配置ldif文件,如下
導(dǎo)入到OpenLDAP中,并重啟OpenLDAP服務(wù),如下:
[root@hadoop1 ~]# ldapmodify -Y EXTERNAL -H ldapi:/// -f /root/loglevel.ldif SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 modifying entry "cn=config"[root@hadoop1 ~]# systemctl restart rsyslog2.6.4.安裝和配置LDAP管理工具PHP ldapadmin
[root@hadoop1 ~]# yum -y install httpd php php-ldap php-gd php-mbstring php-pear php-bcmath php-xml [root@hadoop1 ~]# yum -y install epel-release [root@hadoop1 ~]# yum --enablerepo=epel -y install phpldapadmin [root@hadoop1 ~]# ln -s /usr/share/phpldapadmin /var/www [root@hadoop1 ~]# cd /var/www/phpldapadmin/config [root@hadoop1 ~]# cp config.php config_backup.php2.6.4.1.修改配置文件
[root@hadoop1 ~]# vim /etc/phpldapadmin/config.php +397 #397行取消注釋,398行添加注釋 $servers->setValue('login','attr','dn'); // $servers->setValue('login','attr','uid');//添加一行: $servers->setValue('server','host','192.168.106.134');[root@hadoop1 ~]# vim /etc/httpd/conf.d/phpldapadmin.conf 修改為如下內(nèi)容: # # Web-based tool for managing LDAP servers #Alias /phpldapadmin /usr/share/phpldapadmin/htdocs Alias /ldapadmin /usr/share/phpldapadmin/htdocs<Directory /usr/share/phpldapadmin/htdocs><IfModule mod_authz_core.c># Apache 2.4Require local# 添加一行內(nèi)容,指定訪(fǎng)問(wèn)的ip端#Require 192.168.106.134Require all granted</IfModule><IfModule !mod_authz_core.c># Apache 2.2Order Deny,AllowAllow from all#Deny from all#Allow from 127.0.0.1#Allow from ::1</IfModule> </Directory>設(shè)置開(kāi)機(jī)自動(dòng)并啟動(dòng)Apache:
[root@hadoop1 ~]# systemctl enable httpd [root@hadoop1 ~]# systemctl start httpd [root@hadoop1 ~]# systemctl restart httpd登錄web控制臺(tái):http://192.168.106.134/phpldapadmin/
用戶(hù)名:cn=Manager,dc=zuoquantu,dc=com
密碼:hadoop
2.6.5.其它
2.6.5.1.查看objectClass的定義
在LDAP中,我們常會(huì)發(fā)現(xiàn)有一些objectClass,這些objectClass并不是我們自己寫(xiě)的,那他們到底在哪兒呢?在正常安裝了LDAP之后,我們可以通過(guò)以下方式查看object里面的定義。
[root@bigdata1 config]# grep -rn "shadowAccount" /etc /etc/openldap/schema/nis.ldif:87:olcObjectClasses: ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' DESC 'Additional a /etc/openldap/schema/nis.schema:167:objectclass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' /etc/openldap/slapd.d/cn=config/cn=schema/cn={2}nis.ldif:67:olcObjectClasses: {1}( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' DESC 'Additional [root@bigdata1 config]# vim /etc/openldap/schema/nis.ldif [root@bigdata1 config]# vim /etc/openldap/schema/nis.schema結(jié)果如下:
結(jié)果如下:
參考文章:
https://blog.csdn.net/woloqun/article/details/89216120?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-4&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-4
https://www.cnblogs.com/lemon-le/p/6266921.html
https://blog.csdn.net/dengchenrong/article/details/88389947
https://blog.csdn.net/dockj/article/details/82392263?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2
https://blog.csdn.net/belialxing/article/details/89183051
https://blog.csdn.net/qq_37865420/article/details/105024422
總結(jié)
以上是生活随笔為你收集整理的安装OpenLDAP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 出过人命的二手大货车是否属于一个抢手货呀
- 下一篇: 大件车拉设备和几桶设备用溶液可以上高速吗