Skip to content

soft-cloud-dev/ldap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

LDAP

  1. Wait for it
  2. Initial setup
  3. Development
  4. Production and deployment

This repository: github.com/soft-cloud-dev/ldap

Prerequisites: slapd, ldap-utils LDAP domain: softcloud.dev Schemas: cosine, nis, inetorgperson

Wait for it

while true ldapsearch -Y EXTERNAL -H ldapi:/// -b "cn=config" -s base >/dev/null 2>&1 -Y EXTERNAL -H ldapi:/// -b "cn=config" -s base >/dev/null 2>&1; do echo "Waiting for LDAP"; sleep 1; done

Initial setup

  1. Load schemas
  2. Generate admin password hash
  3. Set up domain name
  4. Bootstrap database

Load schemas

ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif 2>/dev/null || true
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif 2>/dev/null || true
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif 2>/dev/null || true

Generate admin password hash

export ADMIN_PASS_HASH=$(slappasswd -s "$LDAP_ADMIN_PASSWORD")
cat <<EOF | ldapmodify -Y EXTERNAL -H ldapi:///
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: $LDAP_BASE_DN
-
replace: olcRootDN
olcRootDN: cn=admin,$LDAP_BASE_DN
-
replace: olcRootPW
olcRootPW: $ADMIN_PASS_HASH
EOF

Set up domain name

export LDAP_DOMAIN=softcloud.dev
export LDAP_BASE_DN="dc=$(echo $LDAP_DOMAIN | sed 's/\./,dc=/g')"

Bootstrap database

Use default bootstap.ldif from this repository.

ldapadd -x -D "cn=admin,$LDAP_BASE_DN" -w "$LDAP_ADMIN_PASSWORD" -f   -f <(curl -fsSL https://raw.githubusercontent.com/soft-cloud-dev/ldap/main/bootstrap.ldif)

Development

Alternative docker setup for development is included in the repository.

git clone github.com/soft-cloud-dev/ldap
cd ldap
docker compose up

Production and deployment

For production LDAP helm chart will be provided.

About

LDAP server configuration, docker and helm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published