Development edition · 16 November 2026. Commands using repository paths, Make targets or sample projects require access to the Quinzee source checkout. No public installer is available. Examples use disposable local environments.
18. One directory behind HTTPS and LDAP
Entra-style HTTPS and LDAP are two entrances to one directory. The important Unix question is which process parses each protocol, where the authoritative bytes live, and which permissions allow the processes to communicate.
Follow the actual process path
Graph/OAuth client -- HTTPS --> quinzee.cloud
|
LDAP client -- LDAPS --> slapd -- private Unix stream socket
|
shared directory objects
|
libpq connection and writer lease
|
dedicated PostgreSQL database
OpenLDAP terminates LDAP TLS, parses LDAPv3 and applies its frontend limits.
Its back-sock backend forwards supported operations over a local Unix socket.
The C++ backend implements the shared directory view and authentication. Slapd
does not hold another writable copy of the users in an MDB database here.
There is no background LDAP-to-Graph synchronization job.
The application-facing PostgreSQL ARM module is a different service. Its databases are application resources and can be deleted with their groups. The directory's dedicated PostgreSQL dependency must remain available before the cloud can administer those resources.
Understand the PostgreSQL session
directory_store reads a private regular JSON connection file of at most 16 KiB.
It passes separate values to PQconnectdbParams, without URI expansion. TCP
requires verify-full and a root certificate. An absolute socket directory in
the host field selects PostgreSQL's local Unix socket transport; TLS is disabled
for that transport, so filesystem and PostgreSQL authentication rules matter.
The connection is named quinzee-directory. It sets a five-second connect
timeout, statement timeout and lock timeout. Queries use nonblocking libpq
calls with poll on its socket and an approximately six-second client deadline.
This is bounded synchronous work from the caller's perspective: it can occupy
a cloud worker or the LDAP backend worker while waiting for PostgreSQL.
The schema is deliberately small: public.quinzee_directory stores a JSONB
snapshot keyed by tenant UUID. The directory layer limits its serialized state
to 8 MiB and each object collection to 1,024 records; the SQL column also has a
16 MiB text-size guard. It is not a normalized SQL table per user or group.
At startup the connection obtains a session-level PostgreSQL advisory lock for the tenant. A second writer is refused. A mutation validates a candidate snapshot, commits its single parameterized upsert, then publishes the new in-memory state. This ordering keeps a failed write from becoming the accepted in-memory permission state. Other directory entry points check backend health.
If the session fails, the store drops the connection and denies further access. It does not silently reconnect: reconnection would need to re-establish writer ownership and trustworthy state. Restore PostgreSQL and restart the cloud. An OS file lock and a PostgreSQL advisory lock are different mechanisms; this lease belongs to the database session, not a lock file on the operator host.
Follow migration and restart
Without a database configuration, a legacy installation uses its private
modules/identity/directory.json. When PostgreSQL is configured, the first
successful import retains IDs and credentials and writes
directory-postgresql.json with a destination fingerprint. Existing PostgreSQL
state is reused instead of overwriting it with old JSON.
The destination fingerprint binds host, port, database and user. Removing the database configuration, changing that destination or losing a previously migrated tenant row fails rather than reviving stale permissions. The old JSON is retained as migration input/history, not continuously updated as a standby database. Restore the PostgreSQL snapshot and matching local state together.
Persistent directory records are distinct from authentication session state. The OAuth signing key is generated in memory when the authority loads; a cloud restart changes it and invalidates tokens at the restarted authority. Login tickets, authorization/device codes and rotating refresh grants are also process-local. A persistent user therefore still needs to sign in again after a restart. External APIs caching old signing keys have their own token-validation and expiry behavior; the cloud cannot recall a token from their memory.
Inspect the Unix socket boundary
The cloud binds the configured absolute socket path, limited to 100 bytes, in a parent directory with no group/other permissions. The socket itself is mode 0600. The implementation relies on this filesystem boundary and the trusted frontend running as the same UID; it is not a separate SO_PEERCRED-based identity protocol. A process with that UID is inside the local trust boundary.
stat -c '%F %a %U:%G %n' .local/directory-run \
.local/directory-run/directory.sock
ss -xl
Use your actual configured paths. A socket pathname alone does not prove that a listener is alive. The cloud refuses to unlink a pre-existing path during startup because it might belong to another live process. Normal destruction stops its worker and removes its socket; an unclean exit can leave a stale path. Verify ownership and absence of a live listener before any manual cleanup.
The Asio backend permits at most 16 active sessions, reads a bounded 16 KiB request until the back-sock blank-line delimiter, writes one response and closes the connection. Each session has a five-second timer. Synchronous backend work can delay that timer's callback, so it is not a hard preemption guarantee. The implementation also bounds results and directory queries; the public API cannot ask the kernel to kill an in-progress C++ call safely.
Understand what slapd contributes
infrastructure/directory/ldap.py writes a private slapd.conf and calls
os.execv. Exec replaces the Python process image with slapd while retaining
its process identity. There is no Python reverse proxy left forwarding bytes.
The generated configuration includes core/cosine/inetOrgPerson/NIS schemas and
Quinzee's bounded Windows attribute schema, selects database sock, and points
to the private backend socket.
The frontend listens on LDAPS only, defaults to localhost:11636, requires TLS 1.2 or later and a security strength factor of at least 128, uses four threads, and sets size/time/idle/write limits. Back-sock conveys the bound DN and SSF; the backend checks enabled identities before serving reads. Anonymous users may authenticate but cannot enumerate the directory. Bind credentials cross the private socket, so never publish that socket or trace its payload.
POSIX users/groups and Windows-oriented users/groups are projections of the
same objects. Direct members become memberUid or member/memberOf values in
the appropriate view. Stable POSIX IDs and generated account names are directory
data; they are not entries automatically installed in /etc/passwd or
/etc/group. App-role grants use direct user membership, while resource RBAC
has its separate bounded transitive membership rules.
No PAM, NSS or SSSD configuration is changed by the server. Linux login requires an explicitly configured client. No Kerberos KDC, Windows domain join, SID-based security descriptor engine or AD replication service appears merely because the LDAP view exposes Microsoft-shaped attributes.