Table of Contents

LDAP

ABI's directory service. It holds user accounts, groups, SSH public keys and mail addresses; SSH logins, Git, the wiki and the ticketing system all authenticate against it.

ID ranges and storage facts verified against live systems: 2026-11-20. Install and schema details below come from the original setup notes.

Component Value
Server OpenLDAP 2.6 (slapd) in the ldap-01 jail on bane
Address ldap-01.local.abi.am, 172.20.42.38
Database MDB (memory-mapped)
Base DN dc=abi,dc=am
Encryption LDAPS with a self-signed certificate
Management tools ldapscript_extension (fork of ldapscripts; clone at /root/ldapscripts_extension)

Directory layout

dc=abi,dc=am
  cn=admin        root DN used by the management scripts
  ou=Users        user accounts (posixAccount + ldapPublicKey)
  ou=Groups       groups
  ou=Machines     machine accounts
  ou=Idmap        id mapping
  ou=Services     service accounts

A user entry carries uid, uidNumber, gidNumber, cn, sn, mail, homeDirectory, loginShell and one or more sshPublicKey values. Locked accounts keep their entry but use homeDirectory: /var/locked and loginShell: /usr/sbin/nologin.

ID ranges

Only the start values are enforced by software; the upper bounds are conventions.

Range Used for Defined by
10000+ Human users (uidNumber) UIDSTART=10000 in /usr/local/etc/ldapscripts/ldapscripts.conf
10000+ Per-user groups (gidNumber mirrors the uid) GIDSTART=10000, same file
14999 One-off account, excluded from the next-ID calculation Manage Users procedure
15000-15999 Shared and project groups Convention (e.g. 15000 scientist, 15020 armenian_ancestry, 15999 sysadmins)
50000+ Bot accounts Convention; provisioning via botctl
59999 Shared group bots BOTS_GID in botctl

Adding and managing users

The procedure lives on Manage Users: creating the group and user, setting the password, adding SSH keys and mail, group membership, and creating the matching ZFS datasets on mustafar. This page documents the server itself; do not duplicate the steps here.

Install and configure

pkg install openldap26-server openldap26-client
 
sysrc slapd_enable="YES"
sysrc slapd_flags="-f /usr/local/etc/openldap/slapd.conf -h ldap://0.0.0.0/"

TLS certificate

mkdir -p /usr/local/etc/openldap/tls
cd /usr/local/etc/openldap/tls
 
openssl genrsa -out ldap-server.key 2048
openssl req -new -key ldap-server.key -out ldap-server.csr \
  -subj "/C=AM/ST=Yerevan/L=Yerevan/O=abi.am/CN=ldap.abi.am"
openssl x509 -req -days 365 -in ldap-server.csr \
  -signkey ldap-server.key -out ldap-server.crt
 
chmod 600 ldap-server.key
chmod 644 ldap-server.crt
chown ldap:ldap ldap-server.crt

Database directory

mkdir -p /var/db/openldap-data
chown -R ldap:ldap /var/db/openldap-data
chmod 700 /var/db/openldap-data

Configuration files

File Purpose
/usr/local/etc/openldap/slapd.conf daemon: schemas, TLS, database, indexes, ACLs, root password hash
/root/base-setup.ldif initial directory structure: base DN, OUs, first admin
/usr/local/etc/openldap/ldap.conf client defaults: server URI, base DN, TLS

Essential slapd.conf settings:

include     /usr/local/etc/openldap/schema/core.schema
include     /usr/local/etc/openldap/schema/cosine.schema
include     /usr/local/etc/openldap/schema/inetorgperson.schema

modulepath  /usr/local/libexec/openldap
moduleload  back_mdb

TLSCertificateFile  /usr/local/etc/openldap/tls/ldap-server.crt
TLSCertificateKeyFile   /usr/local/etc/openldap/tls/ldap-server.key
TLSCACertificateFile    /usr/local/etc/openldap/tls/ldap-server.crt

database    mdb
suffix      "dc=abi,dc=am"
rootdn      "cn=admin,dc=abi,dc=am"
rootpw      {SSHA}<hash from slappasswd>
directory   /var/db/openldap-data

index   objectClass eq
index   cn,sn,uid,mail eq,sub

access to attrs=userPassword
    by self write
    by anonymous auth
    by * none

access to *
    by self write
    by users read
    by * read

Import the base structure, then start the daemon:

ldapadd -x -D "cn=admin,dc=abi,dc=am" -W -f /root/base-setup.ldif
service slapd start
sockstat -l | grep 389

Schema notes

Common operations

Change a user's mail

dn: uid=USERNAME,ou=Users,dc=abi,dc=am
changetype: modify
replace: mail
mail: user@abi.am
ldapmodify -x -D "cn=admin,dc=abi,dc=am" -W -f modify-email.ldif

Change a password

ldappasswd -x -D "cn=admin,dc=abi,dc=am" -W -S "uid=USERNAME,ou=Users,dc=abi,dc=am"

Back up the database

/usr/local/sbin/slapcat > /root/ldap-backup-$(date +%Y%m%d).ldif

Verify authentication and TLS

ldapwhoami -x -D "cn=admin,dc=abi,dc=am" -W
ldapwhoami -x -D "cn=admin,dc=abi,dc=am" -W -ZZ
ldapsearch -x -b "dc=abi,dc=am" -LLL

See also