Skip to content

[FEATURE] LDAP connection with certificate/key? #499

Description

@plaes

Is your feature request related to a problem? Please describe.
Currently, only option to connect to LDAP seems to be by using password/username. It should be possible authenticate to external LDAP server by using client certificate (using certificate and key).

Describe the solution you'd like
Add possibility to use client certificate authentication.

Describe alternatives you've considered

I tried to connect to Google LDAP service using password/username, but apparently it is not working as expected and it's not really a recommended way either.

Additional context

Ldap library already should have support for this, by using DialURL method:

cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
	return nil, err
}

certs := []tls.Certificate{cert}
tlsConfig := &tls.Config{
	ServerName:   serverName,
	Certificates: certs,
}

ldap.DialURL(url, ldap.DialWithTLSConfig(tlsConfig));

Activity

  1. plaes commented on Dec 9, 2025

    @plaes
    ContributorAuthor

    I have a WIP branch with certificate loading and connection initialization basically implemented.

    But, I'm not sure whether ldap.Bind("","") in LDAP library actually supports the mTLS usecase, as it fails with:

    LDAP Result Code 206 \"Empty password not allowed by the client\": ldap: empty password not allowed by the client
    

    Apparently I need to use ExternalBind(). And it works!

  2. plaes commented on Dec 10, 2025

    @plaes
    ContributorAuthor

    Initial implementation is now ready for review at #509

  3. steveiliop56 commented on Dec 31, 2025

    @steveiliop56
    Member

    Implemented in #509. Thank you @plaes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions