[GH-ISSUE #5538] [Feature]: Add "Skip TLS Certificate Verification" option for LDAP/LDAPS #3866

Closed
opened 2026-10-31 20:35:31 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @pr0l on GitHub (Jun 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5538

Originally assigned to: @NikanZeyaei on GitHub.

Currently LDAP integration in 3x-ui requires a fully trusted TLS certificate chain when using LDAPS.

In enterprise environments, especially with Microsoft Active Directory Certificate Services (AD CS), LDAP servers often use certificates signed by an internal CA. If the CA certificate is not present in the system trust store, LDAP synchronization fails with:

LDAP fetch failed: LDAP Result Code 200 "Network Error":
tls: failed to verify certificate:
x509: certificate signed by unknown authority

While importing the CA certificate into the operating system is the preferred solution, there are situations where administrators may not have access to modify the trust store or may need a temporary workaround during deployment and testing.

Describe the solution you'd like

Add an optional checkbox in LDAP settings:

Skip TLS Certificate Verification

or

Allow Insecure TLS

When enabled, 3x-ui would establish LDAPS connections without validating the server certificate chain (equivalent to Go's InsecureSkipVerify: true).

Alternatives you've considered

Importing the internal CA certificate into the server trust store.
Replacing internal certificates with publicly trusted certificates.

These approaches are preferred for production environments but are not always practical or immediately available.

Concrete use case

This option should be disabled by default and clearly marked as insecure.

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @pr0l on GitHub (Jun 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5538 Originally assigned to: @NikanZeyaei on GitHub. ### Is your feature request related to a problem? Currently LDAP integration in 3x-ui requires a fully trusted TLS certificate chain when using LDAPS. In enterprise environments, especially with Microsoft Active Directory Certificate Services (AD CS), LDAP servers often use certificates signed by an internal CA. If the CA certificate is not present in the system trust store, LDAP synchronization fails with: LDAP fetch failed: LDAP Result Code 200 "Network Error": tls: failed to verify certificate: x509: certificate signed by unknown authority While importing the CA certificate into the operating system is the preferred solution, there are situations where administrators may not have access to modify the trust store or may need a temporary workaround during deployment and testing. ### Describe the solution you'd like Add an optional checkbox in LDAP settings: Skip TLS Certificate Verification or Allow Insecure TLS When enabled, 3x-ui would establish LDAPS connections without validating the server certificate chain (equivalent to Go's InsecureSkipVerify: true). ### Alternatives you've considered Importing the internal CA certificate into the server trust store. Replacing internal certificates with publicly trusted certificates. These approaches are preferred for production environments but are not always practical or immediately available. ### Concrete use case This option should be disabled by default and clearly marked as insecure. ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:35:31 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 24, 2026):

This is a valid feature gap. The LDAP TLS configuration currently hardcodes InsecureSkipVerify: false in two places in internal/util/ldap/ldap.go (lines 39 and 108), and there is no setting, database default, or frontend field for skipping certificate verification.

What a PR would need to touch:

  1. internal/util/ldap/ldap.go — Add InsecureSkipVerify bool to the Config struct and pass it into the tls.Config in both FetchVlessFlags and AuthenticateUser:

    ldap.DialWithTLSConfig(&tls.Config{
        InsecureSkipVerify: cfg.InsecureSkipVerify,
    })
    
  2. internal/web/service/setting.go — Add "ldapInsecureSkipVerify": "false" to the defaults map (around line 114) and a corresponding GetLdapInsecureSkipVerify() (bool, error) getter.

  3. internal/web/job/ldap_sync_job.go — Pass the new setting when building ldaputil.Config in Run().

  4. frontend/src/models/setting.ts and frontend/src/schemas/setting.ts — Add the ldapInsecureSkipVerify field to the model and Zod schema.

  5. frontend/src/pages/settings/GeneralTab.tsx — Add the checkbox to the LDAP settings section, clearly labelled as insecure, defaulting to off.

The change is self-contained and the surface area is small. The suggested default of false (disabled) is correct and aligns with the existing ldapUseTLS pattern. A clear warning label in the UI (e.g. "Insecure — disables server certificate validation") would be appropriate.

If you intend to submit a PR, following the existing pattern for boolean LDAP settings throughout those five files is sufficient.


This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4789303118 --> @github-actions[bot] commented on GitHub (Jun 24, 2026): This is a valid feature gap. The LDAP TLS configuration currently hardcodes `InsecureSkipVerify: false` in two places in `internal/util/ldap/ldap.go` (lines 39 and 108), and there is no setting, database default, or frontend field for skipping certificate verification. **What a PR would need to touch:** 1. **`internal/util/ldap/ldap.go`** — Add `InsecureSkipVerify bool` to the `Config` struct and pass it into the `tls.Config` in both `FetchVlessFlags` and `AuthenticateUser`: ```go ldap.DialWithTLSConfig(&tls.Config{ InsecureSkipVerify: cfg.InsecureSkipVerify, }) ``` 2. **`internal/web/service/setting.go`** — Add `"ldapInsecureSkipVerify": "false"` to the defaults map (around line 114) and a corresponding `GetLdapInsecureSkipVerify() (bool, error)` getter. 3. **`internal/web/job/ldap_sync_job.go`** — Pass the new setting when building `ldaputil.Config` in `Run()`. 4. **`frontend/src/models/setting.ts`** and **`frontend/src/schemas/setting.ts`** — Add the `ldapInsecureSkipVerify` field to the model and Zod schema. 5. **`frontend/src/pages/settings/GeneralTab.tsx`** — Add the checkbox to the LDAP settings section, clearly labelled as insecure, defaulting to off. The change is self-contained and the surface area is small. The suggested default of `false` (disabled) is correct and aligns with the existing `ldapUseTLS` pattern. A clear warning label in the UI (e.g. "Insecure — disables server certificate validation") would be appropriate. If you intend to submit a PR, following the existing pattern for boolean LDAP settings throughout those five files is sufficient. --- *This reply was generated automatically; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3866
No description provided.