A restart fixing it, suggests some persistent state or some other dep. Could you collect additional information? 1. Temp enable the debug log of nslcd.conf inside the jail 2. While it is broken, try to look up for a known ldap user: "getent passwd <ldap_user>". Repeat after 30 secs w/o restarting. 3. If the log only reports a generic connection error, trace the existing broken process. Run as root on the host, substituting that jail's nslcd pid: ktrace -t cs -f /tmp/nslcd-failed.ktrace -p PID Trigger the lookup inside the jail, then on the host: ktrace -c -p PID kdump -f /tmp/nslcd-failed.ktrace > /tmp/nslcd-failed.txt
The useful sequence is socket(), connect(), any getsockopt(SO_ERROR), and subsequent operations on that descriptor. EINPROGRESS from a non-blocking connect() is normal; the eventual result matters. A successful TCP connection followed by LDAP failure points toward TLS, binding, or connection handling instead of an outbound socket restriction. or you can share the collected files. -- On Tue, Oct 13, 2026 at 6:04 AM Anthony Pankov <[email protected]> wrote: > Hello, > > I have an issue with nss-pam-ldapd (nslcd) inside a jail. > When the jail started nslcd do not work and say "Can't connect LDAP > server". > After "service nslcd restart" all work as expected. > > May be somebody can explain/help? > > > I have many tries myself, then with AI and no luck. Before AI give up it > said: > "The Socket is not connected error happens when nslcd handles an early > request inside the jail while dropping root privileges (setuid). In a > shared-IP jail environment, FreeBSD's kernel enforces a strict network > isolation rule: an unprivileged process inside a jail is completely > forbidden from creating an outbound TCP socket (connect()) if it is inside > a process path processing a local UNIX domain socket loop check." > > > Jail is configured as: > # host shared loopback > ip6.addr += "hosl|1:2554:e::1/64"; > # use casual ip4 > ip4.addr = "$if_lan|192.168.0.113"; > > P.S. > System is 14-stable. > Things that doesn't help: > - adding ip4.add="lo0|127.1.0.1" > - prevent dropping privileges (uid root, gid wheel in nslcd.conf) > - running with "nscld_supervisior="YES" (through daemon) > - defining IP addresses (host(jail) itself, ldap servers) in /etc/hosts > - preventing any real query to ldap from nslcd before startup sequence end > > -- > Best regards, > Anthony Pankov mailto:[email protected] > > > -- Thanks, Yuri.
