Jump to content

LDAP Implementation at Deshwal: Difference between revisions

From TetraWiki
No edit summary
No edit summary
Line 103: Line 103:
   
   
  modifying entry "olcDatabase={2}mdb,cn=config"
  modifying entry "olcDatabase={2}mdb,cn=config"
[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"
[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"

Revision as of 05:04, 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

install from EPEL

dnf --enablerepo=epel -y install openldap-servers openldap-clients 
systemctl enable --now slapd 

Set OpenLDAP admin password.

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"

Import basic Schemas.

[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

  1. 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"
[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"


[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"