Jail: r-ldap

one time
zfs create ship/r-ldap
mkdir /mnt/ship/r-ldap/openldap
mkdir /mnt/ship/r-ldap/openldap-data
chown -R 389:389 /mnt/ship/r-ldap/openldap-data

create jail
export JAIL=r-ldap
export JAILHOSTNAME=ldap
export JAILDOMAIN=beyondbell.com
export JAILIP=78
export JAILUSER=r
export JAILUSERID=2002
export JAILUSERVNC=false

/root/FreeBSD/jails/create.sh $JAIL $JAILHOSTNAME $JAILDOMAIN $JAILIP $JAILUSER $JAILUSERID $JAILUSERVNC

iocage fstab -a $JAIL /mnt/ship/r-ldap/openldap /usr/local/etc/openldap nullfs rw 0 0
iocage fstab -a $JAIL /mnt/ship/r-ldap/openldap-data /var/db/openldap-data nullfs rw 0 0
iocage fstab -l $JAIL

iocage exec $JAIL "pkg install -y openssl"

iocage exec $JAIL "pkg install -y -r pkgp121 openldap-sasl-server openldap-sasl-client"
iocage exec $JAIL "pkg lock -y openldap-sasl-server"
iocage exec $JAIL "pkg lock -y openldap-sasl-client"

iocage exec $JAIL "sysrc slapd_enable=YES"
iocage exec $JAIL "sysrc slapd_flags='-h "ldapi://%2Fvar%2Frun%2Fopenldap%2Fldapi/ ldap:/// ldaps:///"'"
# The above config entry needs to entered manually for now - too many quotes
iocage exec $JAIL "sysrc slapd_sockets=/var/run/openldap/ldapi"

iocage exec $JAIL "service slapd start"

Notes:
Debugging:
/usr/local/libexec/slapd -Tt
/usr/local/libexec/slapd -d1

ldapsearch -x -W -D cn=Manager,dc=beyondbell,dc=com
ldapsearch -x -H ldap://ldap.beyondbell.com
ldapsearch -x -H ldaps://ldap.beyondbell.com

ldapsearch -h localhost -D cn=Manager,dc=beyondbell,dc=com -b dc=infra -W
ldapsearch -h ldap.beyondbell.com -D cn=Manager,dc=beyondbell,dc=com -b dc=infra -W


//
#first time
slappasswd -h '{SHA}'
nano /usr/local/etc/openldap/slapd.conf
#include all non wip schema
#Uncomment back_mdb and back_ldap
suffix      "dc=beyondbell,dc=com"
rootdn      "cn=Manager,dc=beyondbell,dc=com"
#add SHA password from previous command
rootpw          {SHA}...
logfile /var/log/slapd.log
loglevel 256
//

Showcased here is a capital and operational cost effective approach, using minimal server and networking hardware with multiple virtualized applications for Home and Business. This solution template can be easily scaled out and adapted for larger Enterprise deployments.
drop by the diyIT Matrix public room at #diyit:matrix.ahlawat.com
if you have any IT questions/feedback or to request pro bono consulting for a nonprofit

message me privately at @sharad:matrix.ahlawat.com
or email me at - sharad@ahlawat.com - pgpkey: 68DD6B89
Networking and Security Technologist.
EngineerĀ andĀ an avid Programmer.

https://sharad.ahlawat.com
strive to learn and pass on the knowledge to the next generation
one day humanity will understand the meaning of life and hopefully it will be more than ASCII 42 = "*" regex for whatever you want it to be,
and destiny is more than just a roll of a pair of dice with 42 dots (Lets nail down Quantum Entanglement)

May you Live Long (Intelligently) and Prosper and work on technology that matters.
© 2024 Sharad Ahlawat

No personal identifying data is collected or any form of analytics/metrics reported to a third-party by this website.