LDAP Install

by Mark Nielsen
Copyright May 2023



LDAP install



Links



LDAP setup

# log in as root somehow
  sudo bash

# run ifconfig
# Choose the interface not "lo".
# Look the line similar to "inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255"
# Pick out the inet line and add it to /etc/hosts

echo "" >> /etc/hosts
echo "10.0.2.15 ldap1.mydomain.local" >> /etc/hosts

apt update

# it will asl you for a password twice.
# Enter the password : password twice.
# It is a terrible password, do not use for production, or even as a development server.
# I just am doing this on Linux installatio on VirtualBox, so there is no outside connection possible. 
sudo apt install slapd ldap-utils

# 1. Enter ldap1.mydomain.local as the hostname
# 2. For My Organization when is asks for your organization.
#   Enter for the password : password twice, yes its bad. 
# 3. Enter no, for purging the database. 
# 4. Answer yes to move files. 
dpkg-reconfigure slapd

# Test login to ldap, use password : password
slappasswd
# Enter password : password twice

echo "" >> /etc/ldap/ldap.conf
echo "BASE dc=example,dc=com
URI ldap://ldap01.example.com  ldap://ldap01.example.com:666 ">> /etc/ldap/ldap.conf

# See wha the configuration looks like
slapcat

# If you have DNS configured correctly
# ldapsearch

mkdir LDAP_install
cd LDAP_INSTALL

echo "dn: olcDatabase={0}config,cn=config
changetype: modify
add: password
olcRootPW: {SSHA}PASSWORD_CREATED" > ldaprootpasswd.ldif

ldapadd -Y EXTERNAL -H ldapi:/// -f ldaprootpasswd.ldif