feat(ldap): pin the LDAP server certificate by SHA-256 thumbprint (#180)
New optional MxGateway:Ldap:ServerCertificateThumbprintSha256 (hex SHA-256 of the DER cert; case/colon/dash/space-insensitive; comma/semicolon-separated string or array, so a rotation can carry old + new). When set, the dashboard's shared LDAP provider gets a RemoteCertificateValidationCallback via LdapOptions.ServerCertificateValidationCallback (Auth 0.4.1) that accepts the server certificate iff its thumbprint matches a pin, ignoring chain/name errors only then. Unset keeps default OS trust-store validation untouched. The callback is an init-only, code-only property, so the ILdapAuthService registration from AddZbLdapAuth is replaced with one built from the bound options plus the callback. Pins are read straight from configuration because the binder silently binds the scalar form onto a list as empty. GatewayOptionsValidator rejects a pin that is not 64 hex chars after normalization and any pin with Transport=None; the Production hard stops are unchanged. Pins are shown on the Settings page. Docs: GatewayConfiguration.md, glauth.md. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -373,3 +373,12 @@ add a `tokenGroups` query as an enhancement.
|
||||
- LDAPS isn't enabled in dev; binding sends passwords cleartext on the
|
||||
wire. The shared GLAuth listens only on the LAN (`10.100.0.35`); never
|
||||
expose port 3893 externally without enabling TLS first.
|
||||
- **Enabling LDAPS against GLAuth (self-signed cert).** GLAuth's `[ldaps]`
|
||||
listener normally uses a self-signed certificate. Rather than installing it in
|
||||
the gateway host's trust store, pin it: set `MxGateway:Ldap:Transport=Ldaps`,
|
||||
the LDAPS `Port`, `AllowInsecure=false`, and
|
||||
`MxGateway:Ldap:ServerCertificateThumbprintSha256` to the certificate's SHA-256
|
||||
thumbprint (`openssl x509 -in cert.pem -noout -fingerprint -sha256`). Several
|
||||
pins (comma-separated or an array) carry a rotation. A pin with
|
||||
`Transport=None` fails startup validation. See `docs/GatewayConfiguration.md`
|
||||
(*LDAP Options*).
|
||||
|
||||
Reference in New Issue
Block a user