Fedora 40
Sponsored Link

OpenLDAP : LDAP सर्वर कॉन्फ़िगर करें2024/05/14

 
अपने स्थानीय नेटवर्क में उपयोगकर्ताओं के खाते साझा करने के लिए LDAP सर्वर कॉन्फ़िगर करें।
[1] OpenLDAP इंस्टॉल करें।
[root@dlp ~]#
dnf -y install openldap-servers openldap-clients
[root@dlp ~]#
systemctl enable --now slapd

[2] OpenLDAP एडमिन पासवर्ड सेट करें।
# एन्क्रिप्टेड पासवर्ड जनरेट करें

[root@dlp ~]#
slappasswd

New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxx
[root@dlp ~]#
vi chrootpw.ldif
# [olcRootPW] अनुभाग के लिए ऊपर उत्पन्न पासवर्ड निर्दिष्ट करें

dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxx

[root@dlp ~]#
ldapadd -Y EXTERNAL -H ldapi:/// -f chrootpw.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "olcDatabase={0}config,cn=config"
[3] बुनियादी स्कीमा आयात करें।
[root@dlp ~]#
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=cosine,cn=schema,cn=config"

[root@dlp ~]#
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=nis,cn=schema,cn=config"

[root@dlp ~]#
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=inetorgperson,cn=schema,cn=config"
[4] अपना डोमेन नाम LDAP DB पर सेट करें।
# निर्देशिका प्रबंधक का पासवर्ड जनरेट करें

[root@dlp ~]#
slappasswd

New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxx
[root@dlp ~]#
vi chdomain.ldif
# [dc=***,dc=***] अनुभाग के लिए अपने स्वयं के डोमेन नाम से बदलें
# [olcRootPW] अनुभाग के लिए ऊपर उत्पन्न पासवर्ड निर्दिष्ट करें

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=srv,dc=world" read by * none

dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=srv,dc=world

dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=srv,dc=world

dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxx

dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by
  dn="cn=Manager,dc=srv,dc=world" write by anonymous auth by self write by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by dn="cn=Manager,dc=srv,dc=world" write by * read

[root@dlp ~]#
ldapmodify -Y EXTERNAL -H ldapi:/// -f chdomain.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "olcDatabase={1}monitor,cn=config"

modifying entry "olcDatabase={2}mdb,cn=config"

modifying entry "olcDatabase={2}mdb,cn=config"

modifying entry "olcDatabase={2}mdb,cn=config"

modifying entry "olcDatabase={2}mdb,cn=config"

[root@dlp ~]#
vi basedomain.ldif
# [dc=***,dc=***] अनुभाग के लिए अपने स्वयं के डोमेन नाम से बदलें

dn: dc=srv,dc=world
objectClass: top
objectClass: dcObject
objectclass: organization
o: Server World
dc: srv

dn: cn=Manager,dc=srv,dc=world
objectClass: organizationalRole
cn: Manager
description: Directory Manager

dn: ou=People,dc=srv,dc=world
objectClass: organizationalUnit
ou: People

dn: ou=Group,dc=srv,dc=world
objectClass: organizationalUnit
ou: Group

[root@dlp ~]#
ldapadd -x -D cn=Manager,dc=srv,dc=world -W -f basedomain.ldif

Enter LDAP Password:    
# निर्देशिका प्रबंधक का पासवर्ड

adding new entry "dc=srv,dc=world"

adding new entry "cn=Manager,dc=srv,dc=world"

adding new entry "ou=People,dc=srv,dc=world"

adding new entry "ou=Group,dc=srv,dc=world"
[5]
[6] एसएसएल/टीएलएस के लिए Slapd कॉन्फ़िगर करें।
[root@dlp ~]#
cp /etc/pki/tls/certs/{server.key,server.crt} /etc/openldap/certs/

[root@dlp ~]#
chown ldap:ldap /etc/openldap/certs/{server.key,server.crt}
[root@dlp ~]#
vi mod_ssl.ldif
# नया निर्माण

dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/server.crt
-
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/openldap/certs/server.key

[root@dlp ~]#
ldapmodify -Y EXTERNAL -H ldapi:/// -f mod_ssl.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@dlp ~]#
systemctl restart slapd

[7] यदि Firewalld चल रहा है, तो LDAP सेवा की अनुमति दें।
[root@dlp ~]#
firewall-cmd --add-service={ldap,ldaps}

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
मिलान सामग्री