Commit graph

28 commits

Author SHA1 Message Date
Michael Aldridge 31b9b295aa internal/ldap: Answer base-object searches for one entry
HashiCorp Vault reads the attributes of the user it just bound as by
issuing a base-object "(objectClass=*)" search whose base DN is the
user's own DN, and has no option to turn that step off. Those searches
named a leaf entry rather than a container, so nothing routed them and
login failed with unwillingToPerform.

A single entry is now looked up by ID or name and returned under the DN
the client asked for, advertising objectClass as the other entries do.
An unknown name reports noSuchObject so clients can distinguish it from
an empty result, an entry that does not match the filter succeeds with
no entries as RFC 4511 requires, and filter shapes we cannot evaluate
are refused instead of guessed at. The catch-all route is limited to
base-object scope so searches with an unknown subtree base are still
refused, which keeps a renamed server from answering its old base DN.

💘 Generated with Crush

Assisted-by: Crush:qwen38_flash_next_mtp
2026-11-02 19:59:53 -06:00
Michael Aldridge d74308280b internal/ldap: Reply with the result type a request expects
An LDAP client only accepts the result that pairs with the request it
sent, and silently ignores anything else. Unrouted operations were
answered with a generic result, which encodes with the wrong tag, so a
search with an unexpected base DN (for example the empty base that
ldapsearch uses when -b is omitted) left the client waiting forever
instead of reporting an error.

Every failure path now terminates the request with the matching result
type, panics included, so a single wrapper covers all operations rather
than one responder per operation. NetAuth calls carry a 30s deadline
because the gRPC client dials lazily and applies none of its own, and
refused operations and failed authentication are logged, which is what
an operator needs when a client appears to hang.

💘 Generated with Crush

Assisted-by: Crush:qwen38_flash_next_mtp
2026-11-02 19:59:04 -06:00
Michael Aldridge a33df9fd7e Switch to the maintained vjeantet LDAP server fork 2026-11-01 22:17:59 -06:00
Michael Aldridge 7c99ae60e5 internal/ldap: Support AND, OR and substring search filters 2026-11-01 19:44:11 -06:00
Michael Aldridge 0233e68ad7 internal/ldap: Only fetch group membership when it was requested 2026-11-01 19:26:04 -06:00
Michael Aldridge 9a270abbf2 internal/ldap: Validate the domain and make SetDomain repeatable 2026-11-01 19:16:29 -06:00
Michael Aldridge efb4904910 internal/ldap: Quote search values to prevent query injection 2026-11-01 18:55:53 -06:00
Michael Aldridge ca0e2434c7 internal/ldap: Stop reporting success for unmatched bind requests 2026-11-01 18:51:09 -06:00
Michael Aldridge e88df02eff internal/ldap: Require a bind before serving searches 2026-11-01 18:50:00 -06:00
Michael Aldridge fea33d115c internal/ldap: Fix double response on anonymous bind 2026-11-01 18:29:16 -06:00
Michael Aldridge 09fe187bce internal/ldap: Recover from panics in request handlers 2026-11-01 18:06:55 -06:00
Michael Aldridge 7e47e45109 internal/ldap: Fix panic on malformed bind DNs 2026-11-01 18:02:56 -06:00
Michael Aldridge 9cc9e6e986 internal/ldap: Add option to bind anonmyously 2022-08-27 17:35:45 -05:00
Michael Aldridge b8cd3bb4bc internal/ldap: use variadic options 2022-08-27 16:46:54 -05:00
Michael Aldridge 1c964cb732 internal/ldap: Improve support for attribute-present filters 2022-08-27 15:51:03 -05:00
Michael Aldridge 69798ffe7a internal/ldap: Log unsupported search filters 2021-10-16 18:01:02 -05:00
Michael Aldridge 44d8cee507 internal/ldap: Correctly handle multi-valued attributes 2020-11-08 19:33:21 -08:00
Michael Aldridge 1b2e59b9be internal/ldap: Support more LDAP filters 2020-11-08 16:45:07 -08:00
Michael Aldridge c4dd12c378 internal/ldap: Fix search equivalence translation 2020-08-25 18:58:56 -07:00
Michael Aldridge 1c55b7d328 main: Allow serving TLS connections 2020-08-23 19:35:21 -07:00
Michael Aldridge 6d4b4de38a main: Handle initialization and shutdown 2020-08-23 15:31:20 -07:00
Michael Aldridge 3c3d6979bc internal/ldap: Improve search debugging 2020-08-23 15:11:14 -07:00
Michael Aldridge 5789f11056 internal/ldap: Synchronize path 2020-08-23 00:52:38 -07:00
Michael Aldridge 792f53e2da internal/ldap: Implement search for groups 2020-08-23 00:50:43 -07:00
Michael Aldridge 2cf2849cea internal/ldap: Implement search for entities 2020-08-23 00:17:03 -07:00
Michael Aldridge 2b8ce28a83 internal/ldap: Remove unused search function 2020-08-22 20:50:38 -07:00
Michael Aldridge 83e78da739 internal/ldap: Handle bind 2020-08-22 20:49:54 -07:00
Michael Aldridge b3783dffb5 internal/ldap: Initial boilerplate 2020-08-21 00:03:53 -07:00