Skip to content

Commit e91d7fa

Browse files
oetikerclaude
andcommitted
fix: ldapi:// URI requires percent-encoded socket path in host field
ldap3 extracts the socket path from the URL **host**, not the path component — so ldapi:/// (empty host) raises EmptyUnixPath. The correct form is ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi. - Fix Mode B block in examples/oposs-openldap.toml - Fix ldapi:// description in server-auth.md docs - Fix Unix domain socket example in server-auth.md - Add examples/ds-carbo-feh.toml: ready-to-use config for the carbo-link.com directory (46 POSIX users, posixGroup only, no Samba) Verified live: edaptor check connects and reports 93 objectClasses. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a1a7675 commit e91d7fa

3 files changed

Lines changed: 84 additions & 8 deletions

File tree

docs/src/configuration/server-auth.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ timeout_secs = 10 # bound the TCP connect so an unre
1717
- **`uri`** — the directory URL:
1818
- `ldap://` — plaintext TCP, usually combined with `start_tls = true`.
1919
- `ldaps://` — implicit TLS on the LDAPS port (636).
20-
- `ldapi:///` — Unix domain socket on the local host (OpenLDAP only). Connects
21-
to the default slapd socket at `/var/run/slapd/ldapi`. The socket path can be
22-
URL-encoded into the URI if it differs from the default, e.g.
23-
`ldapi://%2Ftmp%2Fslapd.sock`. Use with `auth.method = "external"` for
24-
password-free root access.
20+
- `ldapi://` — Unix domain socket on the local host (OpenLDAP only). The socket
21+
path goes in the **host** field, percent-encoded. For example, to connect to
22+
`/var/run/slapd/ldapi` use `ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi`. Use with
23+
`auth.method = "external"` for password-free root access.
2524
- **`base_dn`** — the root of the subtree eDAPtor loads and browses.
2625
- **`start_tls`** — when `true`, an `ldap://` connection is upgraded to TLS with
2726
StartTLS after connecting. **Do not combine `start_tls = true` with an
@@ -96,7 +95,7 @@ and passwords entirely:
9695

9796
```toml
9897
[server]
99-
uri = "ldapi:///"
98+
uri = "ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi" # /var/run/slapd/ldapi, percent-encoded
10099
base_dn = "dc=example,dc=com"
101100

102101
[auth]

examples/ds-carbo-feh.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# edaptor config — ds-carbo-feh (carbo-link.com directory)
2+
#
3+
# Run on the slapd host as root (or an olcAuthzRegexp-mapped admin user).
4+
# Connects via Unix domain socket — no TLS, no password required.
5+
6+
[server]
7+
uri = "ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi"
8+
base_dn = "dc=carbo-link,dc=com"
9+
10+
[auth]
11+
method = "external"
12+
13+
# ---------------------------------------------------------------------------
14+
# Profile: user
15+
# 46 POSIX accounts in ou=people. No Samba, no mailAccount on this host.
16+
# ---------------------------------------------------------------------------
17+
[[profile]]
18+
name = "user"
19+
object_classes = ["inetOrgPerson", "posixAccount", "shadowAccount"]
20+
rdn_attr = "uid"
21+
search_base = "ou=people,dc=carbo-link,dc=com"
22+
show = ["uid", "cn", "sn", "givenName", "displayName",
23+
"mail", "gecos", "uidNumber", "gidNumber",
24+
"homeDirectory", "loginShell"]
25+
search_attrs = ["cn", "uid", "mail", "sn", "givenName"]
26+
label = "{cn} ({uid})"
27+
28+
[profile.defaults]
29+
homeDirectory = "/home/{uid}"
30+
loginShell = "/bin/bash"
31+
uidNumber = "{next:1000-9999}"
32+
gidNumber = "{next:1000-9999}"
33+
34+
[profile.widget.userPassword]
35+
kind = "password"
36+
samba = false
37+
38+
[profile.widget.loginShell]
39+
kind = "choice"
40+
select = "single"
41+
format = "plain"
42+
options = [
43+
{ value = "/bin/bash", label = "Bash" },
44+
{ value = "/bin/sh", label = "POSIX sh" },
45+
{ value = "/bin/zsh", label = "Zsh" },
46+
{ value = "/sbin/nologin", label = "No login" },
47+
{ value = "/bin/false", label = "Disabled" },
48+
]
49+
50+
# Primary group: resolves a posixGroup entry and stores its gidNumber scalar.
51+
[profile.widget.gidNumber]
52+
kind = "picker"
53+
candidate = "posixgroup"
54+
store = "gidNumber"
55+
select = "single"
56+
57+
# ---------------------------------------------------------------------------
58+
# Profile: posixgroup
59+
# UID-based groups (posixGroup) in ou=groups — read by NSS/PAM via nssclient.
60+
# Personal groups (cn = uid) and shared groups (e.g. cl-admins) coexist here.
61+
# ---------------------------------------------------------------------------
62+
[[profile]]
63+
name = "posixgroup"
64+
object_classes = ["posixGroup"]
65+
rdn_attr = "cn"
66+
search_base = "ou=groups,dc=carbo-link,dc=com"
67+
show = ["cn", "gidNumber", "memberUid", "description"]
68+
label = "{cn}"
69+
70+
[profile.defaults]
71+
gidNumber = "{next:1000-9999}"
72+
73+
# memberUid: stores each picked user's uid scalar (not the DN).
74+
[profile.widget.memberUid]
75+
kind = "picker"
76+
candidate = "user"
77+
store = "uid"

examples/oposs-openldap.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ password_source = "prompt"
4747
# Uncomment this block and comment out Mode A above.
4848
# ---------------------------------------------------------------------------
4949
# [server]
50-
# uri = "ldapi:///" # connects to /var/run/slapd/ldapi (the default)
51-
# base_dn = "dc=example,dc=com" # oposs_openldap.base_dn
50+
# uri = "ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi" # /var/run/slapd/ldapi, percent-encoded
51+
# base_dn = "dc=example,dc=com" # oposs_openldap.base_dn
5252
# read_only = false
5353
#
5454
# [auth]

0 commit comments

Comments
 (0)