Tuesday, October 13, 2026, 4:06:03 PM, you 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

The issue is related to jail parameter

   exec.fib = 1;

When it is not set the issue disappeared. When fib is 1 the previously 
mentioned problem arises.
It seems to be something related to kernel:

" This is a timing race condition directly tied to how FreeBSD initializes 
independent routing tables (FIBs) for shared-IP jails.
When exec.fib=1 is configured, the jail executes all its internal /etc/rc boot 
processes within FIB 1. However, during the early stage of the jail creation 
sequence, the host assigns the jail's shared IP alias to FIB 0 first before the 
exec.fib=1 routine fully maps the IP alias space into FIB 1."




-- 
Best regards,
Anthony Pankov


Reply via email to