[PR #3568] [MERGED] feat: add ldap component #5441

Closed
opened 2026-10-31 20:46:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3568
Author: @konstpic
Created: 9/26/2025
Status: ✅ Merged
Merged: 9/28/2025
Merged by: @MHSanaei

Base: main ← Head: main


📝 Commits (3)

  • 685b9a0 add ldap component
  • d8c3844 fix: fix russian comments, tls cert verify default true
  • 3efa271 feat: remove replaces go mod for local dev

📊 Changes

12 files changed (+910 additions, -23 deletions)

View changed files

📝 go.mod (+3 -0)
➕ util/ldap/ldap.go (+144 -0)
📝 web/assets/js/model/setting.js (+22 -0)
📝 web/assets/js/util/index.js (+7 -17)
📝 web/entity/entity.go (+25 -1)
📝 web/html/settings.html (+22 -1)
📝 web/html/settings/panel/general.html (+130 -0)
➕ web/job/ldap_sync_job.go (+393 -0)
📝 web/service/inbound.go (+17 -0)
📝 web/service/setting.go (+102 -0)
📝 web/service/user.go (+33 -4)
📝 web/web.go (+12 -0)

📄 Description

What is the pull request?

This PR introduces LDAP integration for client access management with scheduled synchronization and group capture support:

  • LDAP sync job (web/job/ldap_sync_job.go):

    • Reads user entries from LDAP and updates local clients.
    • Enables/disables clients based on LDAP flag values (ldapFlagField, ldapTruthyValues, ldapInvertFlag).
    • Matches users by ldapUserAttr ↔ client.email.
    • Supports group capture via multi-select inbound tags (ldapInboundTags).
  • Auto client management:

    • Auto-create new clients in selected inbounds if missing.
    • Auto-delete clients if removed in LDAP or flagged as “deny”.
    • Defaults for auto-created clients: ldapDefaultTotalGB, ldapDefaultExpiryDays, ldapDefaultLimitIP.
    • Protocol-specific rules (UUID for VLESS/VMESS, password for Trojan/Shadowsocks, etc.).
  • Settings (UI + backend):

    • New LDAP section in Panel → Settings → General.
    • Covers connection parameters, search filters, access flag evaluation, inbound management, and scheduler config.
    • Frontend assets updated with version-busting.
  • Implementation details:

    • util/ldap/ldap.go: LDAP client (using go-ldap/ldap/v3).
    • web/service/setting.go, web/entity/entity.go: new settings handling.
    • web/assets/js/model/setting.js, web/html/settings/*.html: frontend integration.
    • Automatic Xray restart triggered on relevant changes.

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Screenshots

New settings panel with LDAP integration and group capture options:

1_panel_logs
4_panel_view_connect_turn_of_flag
3_panel_settings
2_panel_view_connect


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3568 **Author:** [@konstpic](https://github.com/konstpic) **Created:** 9/26/2025 **Status:** ✅ Merged **Merged:** 9/28/2025 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`685b9a0`](https://github.com/MHSanaei/3x-ui/commit/685b9a0e8194a41772deb80e47125458c7c693df) add ldap component - [`d8c3844`](https://github.com/MHSanaei/3x-ui/commit/d8c384411d04a5951c7be7523e236ffca64b3b16) fix: fix russian comments, tls cert verify default true - [`3efa271`](https://github.com/MHSanaei/3x-ui/commit/3efa271466d3e39a96ba86a8d13028238a228754) feat: remove replaces go mod for local dev ### 📊 Changes **12 files changed** (+910 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+3 -0) ➕ `util/ldap/ldap.go` (+144 -0) 📝 `web/assets/js/model/setting.js` (+22 -0) 📝 `web/assets/js/util/index.js` (+7 -17) 📝 `web/entity/entity.go` (+25 -1) 📝 `web/html/settings.html` (+22 -1) 📝 `web/html/settings/panel/general.html` (+130 -0) ➕ `web/job/ldap_sync_job.go` (+393 -0) 📝 `web/service/inbound.go` (+17 -0) 📝 `web/service/setting.go` (+102 -0) 📝 `web/service/user.go` (+33 -4) 📝 `web/web.go` (+12 -0) </details> ### 📄 Description ## What is the pull request? This PR introduces **LDAP integration for client access management** with scheduled synchronization and **group capture** support: - **LDAP sync job (`web/job/ldap_sync_job.go`)**: - Reads user entries from LDAP and updates local clients. - Enables/disables clients based on LDAP flag values (`ldapFlagField`, `ldapTruthyValues`, `ldapInvertFlag`). - Matches users by `ldapUserAttr` ↔ `client.email`. - Supports **group capture** via multi-select inbound tags (`ldapInboundTags`). - **Auto client management:** - Auto-create new clients in selected inbounds if missing. - Auto-delete clients if removed in LDAP or flagged as “deny”. - Defaults for auto-created clients: `ldapDefaultTotalGB`, `ldapDefaultExpiryDays`, `ldapDefaultLimitIP`. - Protocol-specific rules (UUID for VLESS/VMESS, password for Trojan/Shadowsocks, etc.). - **Settings (UI + backend):** - New LDAP section in **Panel → Settings → General**. - Covers connection parameters, search filters, access flag evaluation, inbound management, and scheduler config. - Frontend assets updated with version-busting. - **Implementation details:** - `util/ldap/ldap.go`: LDAP client (using `go-ldap/ldap/v3`). - `web/service/setting.go`, `web/entity/entity.go`: new settings handling. - `web/assets/js/model/setting.js`, `web/html/settings/*.html`: frontend integration. - Automatic Xray restart triggered on relevant changes. --- ## Which part of the application is affected by the change? - [x] Frontend - [x] Backend --- ## Type of Changes - [ ] Bug fix - [x] New feature - [ ] Refactoring - [ ] Other --- ## Screenshots *New settings panel with LDAP integration and group capture options:* ![1_panel_logs](https://github.com/user-attachments/assets/67e41e28-b0f9-4e4a-be7d-4f0e661ad7b2) ![4_panel_view_connect_turn_of_flag](https://github.com/user-attachments/assets/18a68c55-eae1-412a-bc9d-bac67eb67a4e) ![3_panel_settings](https://github.com/user-attachments/assets/81367cb2-ba89-4df9-a95a-b1e0d54ece3f) ![2_panel_view_connect](https://github.com/user-attachments/assets/e32f6e64-2839-4c73-964e-653ab8a07b4d) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:46:59 +07:00
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#5441
No description provided.