mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5637] [MERGED] feat: ldap skip tls verify #5941
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5941
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5637
Author: @NikanZeyaei
Created: 6/28/2026
Status: ✅ Merged
Merged: 6/28/2026
Merged by: @MHSanaei
Base:
main← Head:feature/ldap-skip-tls-verify📝 Commits (6)
c04b078feat(ldap): add InsecureSkipVerify field and tlsConfig helper55f695afeat(settings): add LdapInsecureSkipVerify settingd5db896feat(ui): add Skip TLS verification switch in LDAP settingsf6b413cchore(i18n): add Skip TLS verification strings to all locales49c94b7chore(codegen): regenerate frontend artifactsb0fa7a4Merge branch 'main' into feature/ldap-skip-tls-verify📊 Changes
28 files changed (+180 additions, -67 deletions)
View changed files
📝
frontend/public/openapi.json(+8 -0)📝
frontend/src/generated/examples.ts(+2 -0)📝
frontend/src/generated/schemas.ts(+8 -0)📝
frontend/src/generated/types.ts(+2 -0)📝
frontend/src/generated/zod.ts(+2 -0)📝
frontend/src/models/setting.ts(+1 -0)📝
frontend/src/pages/settings/GeneralTab.tsx(+11 -0)📝
frontend/src/schemas/setting.ts(+1 -0)➕
frontend/src/test/setting-ldap-skip-verify.test.ts(+20 -0)📝
internal/util/ldap/ldap.go(+18 -17)➕
internal/util/ldap/ldap_test.go(+22 -0)📝
internal/web/entity/entity.go(+12 -11)📝
internal/web/job/ldap_sync_job.go(+12 -11)📝
internal/web/service/panel/user.go(+10 -8)📝
internal/web/service/setting.go(+25 -20)📝
internal/web/translation/ar-EG.json(+2 -0)📝
internal/web/translation/en-US.json(+2 -0)📝
internal/web/translation/es-ES.json(+2 -0)📝
internal/web/translation/fa-IR.json(+2 -0)📝
internal/web/translation/id-ID.json(+2 -0)...and 8 more files
📄 Description
Summary
Adds an optional
ldapInsecureSkipVerifysetting that, when enabled, establishes LDAPS connections without validating the server certificate chain (tls.Config.InsecureSkipVerify: true). Disabled by default; clearly marked as insecure in the UI.Why
Closes https://github.com/MHSanaei/3x-ui/issues/5538
LDAP sync and login currently fail with
x509: certificate signed by unknown authorityagainst enterprise directory servers (e.g. Microsoft AD CS) that use an internal CA which cannot be imported into the panel's system trust store. This PR gives operators an escape hatch for those environments while keeping secure verification on by default.The setting is wired into both the sync job (
FetchVlessFlags) and the LDAP login path (AuthenticateUser). The original issue's file list missed the login path, which would have left an inconsistent state where sync worked but login still failed against an untrusted CA.Type of change
Areas affected
How was this tested?
Automated:
go test ./...— full suite green; newTestTLSConfig_InsecureSkipVerifyPropagatespins thatConfig.InsecureSkipVerifyflows through the extractedtlsConfighelper totls.Config.InsecureSkipVerify(catches future regressions where someone re-hardcodesfalse).cd frontend && npm run test— all 41 test files pass, including the newsetting-ldap-skip-verifyVitest that round-tripsldapInsecureSkipVerifythrough the Zod schema and theAllSettingmodel.npm run typecheck,npm run lint,npm run build— all clean.npm run gen+git diff --exit-code -- frontend/src/generated frontend/public/openapi.json— clean (codegen CI gate).Manual QA performed by reviewer (recommended before merge):
go build ./...andcd frontend && npm run typecheck && npm run lint && npm run test && npm run build.cd frontend && npm run gen && git diff --exit-code -- frontend/src/generated frontend/public/openapi.json(must be clean after commit).LDAP sync job started…Fetched N LDAP flags) and LDAP login now succeed where they previously failed withx509: certificate signed by unknown authority.UpdateAllSettingreflect loop).Screenshots / recordings
N/A — purely a settings UI addition (one new Switch under "Use TLS (LDAPS)" with an insecure-warning description). The visible behavior is self-evident from the field label and description.
Breaking changes
None.
"false"everywhere (default map, model, UI switch, Zod schema, generated artifacts), so existing deployments are unaffected — zero-config behavior change.defaultValueMap.crypto/tlsimport ininternal/util/ldap/ldap.gostays (used by the newtlsConfighelper). No import additions or removals at the call sites.InsecureSkipVerify: truemode disables all cert validation (hostname + chain). TheskipTlsVerifyDesctext says so explicitly, and an alternative "trust a custom CA viatls.Config.RootCAs" is intentionally out of scope — the issue explicitly requests the skip-verify escape hatch.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.