LDAP Implementation at Deshwal: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
dnf --enablerepo=epel -y install openldap-servers openldap-clients | dnf --enablerepo=epel -y install openldap-servers openldap-clients | ||
systemctl enable --now slapd | systemctl enable --now slapd | ||
systemctl restart slapd | |||
[[Set OpenLDAP admin password. ]] | [[Set OpenLDAP admin password. ]] | ||
| Line 60: | Line 61: | ||
# replace to your own domain name for [dc=***,dc=***] section | # replace to your own domain name for [dc=***,dc=***] section | ||
# specify the password generated above for [olcRootPW] section | # specify the password generated above for [olcRootPW] section | ||
dn: olcDatabase={1}monitor,cn=config | dn: olcDatabase={1}monitor,cn=config | ||
changetype: modify | changetype: modify | ||
| Line 66: | Line 67: | ||
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" | olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" | ||
read by dn.base="cn=Manager,dc=bluemonk,dc=com" read by * none | read by dn.base="cn=Manager,dc=bluemonk,dc=com" read by * none | ||
dn: olcDatabase={2}mdb,cn=config | dn: olcDatabase={2}mdb,cn=config | ||
changetype: modify | changetype: modify | ||
replace: olcSuffix | replace: olcSuffix | ||
olcSuffix: dc=bluemonk,dc=com | olcSuffix: dc=bluemonk,dc=com | ||
dn: olcDatabase={2}mdb,cn=config | dn: olcDatabase={2}mdb,cn=config | ||
changetype: modify | changetype: modify | ||
replace: olcRootDN | replace: olcRootDN | ||
olcRootDN: cn=Manager,dc=bluemonk,dc=com | olcRootDN: cn=Manager,dc=bluemonk,dc=com | ||
dn: olcDatabase={2}mdb,cn=config | dn: olcDatabase={2}mdb,cn=config | ||
changetype: modify | changetype: modify | ||
add: olcRootPW | add: olcRootPW | ||
olcRootPW: {SSHA}0eQj3z0tjTCkz4Elh4X61hlJ3lkqhS8V | olcRootPW: {SSHA}0eQj3z0tjTCkz4Elh4X61hlJ3lkqhS8V | ||
dn: olcDatabase={2}mdb,cn=config | dn: olcDatabase={2}mdb,cn=config | ||
changetype: modify | changetype: modify | ||
| Line 89: | Line 90: | ||
olcAccess: {1}to dn.base="" by * read | olcAccess: {1}to dn.base="" by * read | ||
olcAccess: {2}to * by dn="cn=Manager,dc=bluemonk,dc=com" write by * read | olcAccess: {2}to * by dn="cn=Manager,dc=bluemonk,dc=com" 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" | |||
[[Add Base OUs]] | |||
[root@ldap ~]# vi base.ldif | |||
dn: dc=bluemonk,dc=com | |||
objectClass: top | |||
objectClass: domain | |||
dc: bluemonk | |||
dn: ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: PROTAIGA GLOBAL | |||
dn: ou=Bluemonk Ventures,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: Bluemonk Ventures | |||
dn: ou=Deshwal,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: Deshwal | |||
dn: ou=devit,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: devit | |||
dn: ou=oxypc,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: oxypc | |||
dn: ou=customers,dc=bluemonk,dc=com | |||
objectClass: organizationalUnit | |||
ou: customers | |||
dn: cn=Manager,dc=bluemonk,dc=com | |||
objectClass: organizationalRole | |||
cn: Manager | |||
description: LDAP Administrator | |||
[root@ldap ~]# ldapadd -x -D cn=Manager,dc=bluemonk,dc=com -W -f base.ldif | |||
Enter LDAP Password: | |||
adding new entry "dc=bluemonk,dc=com" | |||
adding new entry "ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com" | |||
adding new entry "ou=Bluemonk Ventures,dc=bluemonk,dc=com" | |||
adding new entry "ou=Deshwal,dc=bluemonk,dc=com" | |||
adding new entry "ou=devit,dc=bluemonk,dc=com" | |||
adding new entry "ou=oxypc,dc=bluemonk,dc=com" | |||
adding new entry "ou=customers,dc=bluemonk,dc=com" | |||
adding new entry "cn=Manager,dc=bluemonk,dc=com" | |||
[[Add User with Right Attributes]] | |||
[root@ldap ~]# vi user.ldif | |||
dn: uid=jsmith,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com | |||
objectClass: inetOrgPerson | |||
objectClass: organizationalPerson | |||
uid: jsmith | |||
cn: John Smith | |||
sn: Smith | |||
employeeNumber: 1001 | |||
mail: jsmith@bluemonk.com | |||
mobile: +1 555-123-4567 | |||
title: Software Engineer | |||
departmentNumber: IT | |||
l: New York | |||
manager: uid=mbrown,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com | |||
userPassword: {SSHA}6eGKqoklEjwwi6HABhmbbY1OaBi39cIG | |||
[root@ldap ~]# ldapadd -x -D cn=Manager,dc=bluemonk,dc=com -W -f user.ldif | |||
Enter LDAP Password: | |||
adding new entry "uid=jsmith,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com" | |||
Latest revision as of 05:22, 6 February 2025
Referance Link : https://www.server-world.info/en/note?os=CentOS_Stream_9&p=openldap&f=1
OS - Centos 9 Stream or RHEL 9
dnf --enablerepo=epel -y install openldap-servers openldap-clients systemctl enable --now slapd systemctl restart slapd
slappasswd
New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxx
[root]# vi chrootpw.ldif
# specify the password generated above for [olcRootPW] section
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}xxxxxxxxxxxxxxxxxxxxxxxx
[root]# 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"
[root]# 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"
Set your domain name on LDAP DB
- generate directory manager's password
[root@dlp ~]# slappasswd
New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxx
[root@ldap ~]# vi chdomain.ldif
# replace to your own domain name for [dc=***,dc=***] section
# specify the password generated above for [olcRootPW] section
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=bluemonk,dc=com" read by * none
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=bluemonk,dc=com
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=bluemonk,dc=com
dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}0eQj3z0tjTCkz4Elh4X61hlJ3lkqhS8V
dn: olcDatabase={2}mdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by
dn="cn=Manager,dc=bluemonk,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=bluemonk,dc=com" 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"
Add Base OUs
[root@ldap ~]# vi base.ldif dn: dc=bluemonk,dc=com objectClass: top objectClass: domain dc: bluemonk dn: ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com objectClass: organizationalUnit ou: PROTAIGA GLOBAL dn: ou=Bluemonk Ventures,dc=bluemonk,dc=com objectClass: organizationalUnit ou: Bluemonk Ventures dn: ou=Deshwal,dc=bluemonk,dc=com objectClass: organizationalUnit ou: Deshwal dn: ou=devit,dc=bluemonk,dc=com objectClass: organizationalUnit ou: devit dn: ou=oxypc,dc=bluemonk,dc=com objectClass: organizationalUnit ou: oxypc dn: ou=customers,dc=bluemonk,dc=com objectClass: organizationalUnit ou: customers dn: cn=Manager,dc=bluemonk,dc=com objectClass: organizationalRole cn: Manager description: LDAP Administrator
[root@ldap ~]# ldapadd -x -D cn=Manager,dc=bluemonk,dc=com -W -f base.ldif Enter LDAP Password: adding new entry "dc=bluemonk,dc=com" adding new entry "ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com" adding new entry "ou=Bluemonk Ventures,dc=bluemonk,dc=com" adding new entry "ou=Deshwal,dc=bluemonk,dc=com" adding new entry "ou=devit,dc=bluemonk,dc=com" adding new entry "ou=oxypc,dc=bluemonk,dc=com" adding new entry "ou=customers,dc=bluemonk,dc=com" adding new entry "cn=Manager,dc=bluemonk,dc=com"
Add User with Right Attributes
[root@ldap ~]# vi user.ldif
dn: uid=jsmith,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com
objectClass: inetOrgPerson
objectClass: organizationalPerson
uid: jsmith
cn: John Smith
sn: Smith
employeeNumber: 1001
mail: jsmith@bluemonk.com
mobile: +1 555-123-4567
title: Software Engineer
departmentNumber: IT
l: New York
manager: uid=mbrown,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com
userPassword: {SSHA}6eGKqoklEjwwi6HABhmbbY1OaBi39cIG
[root@ldap ~]# ldapadd -x -D cn=Manager,dc=bluemonk,dc=com -W -f user.ldif Enter LDAP Password: adding new entry "uid=jsmith,ou=PROTAIGA GLOBAL,dc=bluemonk,dc=com"