[PR #3565] [CLOSED] Add support LDAP and portable database MySQL #5442

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/3565
Author: @konstpic
Created: 9/26/2025
Status: ❌ Closed

Base: main ← Head: main


📝 Commits (2)

  • 51b5d10 add ldap support and portable database MySQL
  • df3e483 see to changelog

📊 Changes

150 files changed (+78853 additions, -7241 deletions)

View changed files

📝 DockerInit.sh (+1 -1)
📝 Dockerfile (+20 -8)
📝 README.ar_EG.md (+14 -14)
📝 README.es_ES.md (+13 -14)
📝 README.fa_IR.md (+13 -14)
📝 README.md (+13 -14)
📝 README.ru_RU.md (+13 -14)
📝 README.zh_CN.md (+13 -14)
➕ build/x-ui (+0 -0)
➕ changelog_RU_EN.md (+121 -0)
➕ changelog_RU_EN.txt (+121 -0)
📝 config/config.go (+11 -92)
📝 config/version (+1 -1)
📝 database/db.go (+35 -35)
📝 database/model/model.go (+34 -46)
📝 docker-compose.yml (+121 -6)
📝 go.mod (+41 -36)
📝 go.sum (+158 -84)
📝 install.sh (+16 -50)
📝 logger/logger.go (+1 -19)

...and 80 more files

📄 Description

Add LDAP Integration and External MySQL Support

What is the pull request?

This PR introduces two major improvements:

  1. LDAP Integration for Client Access Management

    • Scheduled sync job reads LDAP to:
      • Enable/disable clients by client.email (local status storage, no LDAP lookup on connect).
      • Optionally auto-create clients in selected inbounds if missing.
      • Optionally auto-delete clients from selected inbounds if they disappear in LDAP or access flag is deny.
    • Access flag evaluation:
      • ldapFlagField (fallback: ldapVlessField).
      • ldapTruthyValues (default: true, 1, yes, on).
      • ldapInvertFlag (useful for shadowInactive).
    • New settings: connection, user search, access flag, scheduler, inbound management, auto-create/delete defaults.
    • UI support for selecting inbound tags and displaying hints when none exist.
  2. External MySQL Database Support

    • Added ability to connect to an external MySQL instance instead of a local DB.
    • Docker environment supports external DB parameters.
    • The panel initializes as soon as the database becomes reachable.

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Implementation Details

  • LDAP

    • Sync job: web/job/ldap_sync_job.go
    • LDAP client: util/ldap/ldap.go (go-ldap/ldap/v3)
    • Backend: web/service/setting.go, web/entity/entity.go
    • Frontend:
      • web/assets/js/model/setting.js
      • web/html/settings/panel/general.html
      • web/html/settings.html
    • Xray restart handled by existing scheduler when changes occur.
  • External MySQL

    • Support for external DB connection with proper initialization at startup.
    • Panel becomes available once DB is reachable.

Upgrade Notes

  • Frontend assets are version-busted (config/version) → please hard refresh browser (Ctrl+F5) after update.
  • If you previously used only vless_enabled, you can now configure access flags via ldapFlagField + ldapTruthyValues + ldapInvertFlag.
  • To enable auto-create, select inbound targets (ldapInboundTags) and set ldapAutoCreate = true.

Screenshots

4_panel_view_connect_turn_of_flag
3_panel_settings
2_panel_view_connect
1_panel_logs


🔄 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/3565 **Author:** [@konstpic](https://github.com/konstpic) **Created:** 9/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`51b5d10`](https://github.com/MHSanaei/3x-ui/commit/51b5d10edfd90898aba17d05cfb8811e08c2db7d) add ldap support and portable database MySQL - [`df3e483`](https://github.com/MHSanaei/3x-ui/commit/df3e48379703cc06fb25f3b8f3f57e1c10c049f8) see to changelog ### 📊 Changes **150 files changed** (+78853 additions, -7241 deletions) <details> <summary>View changed files</summary> 📝 `DockerInit.sh` (+1 -1) 📝 `Dockerfile` (+20 -8) 📝 `README.ar_EG.md` (+14 -14) 📝 `README.es_ES.md` (+13 -14) 📝 `README.fa_IR.md` (+13 -14) 📝 `README.md` (+13 -14) 📝 `README.ru_RU.md` (+13 -14) 📝 `README.zh_CN.md` (+13 -14) ➕ `build/x-ui` (+0 -0) ➕ `changelog_RU_EN.md` (+121 -0) ➕ `changelog_RU_EN.txt` (+121 -0) 📝 `config/config.go` (+11 -92) 📝 `config/version` (+1 -1) 📝 `database/db.go` (+35 -35) 📝 `database/model/model.go` (+34 -46) 📝 `docker-compose.yml` (+121 -6) 📝 `go.mod` (+41 -36) 📝 `go.sum` (+158 -84) 📝 `install.sh` (+16 -50) 📝 `logger/logger.go` (+1 -19) _...and 80 more files_ </details> ### 📄 Description # Add LDAP Integration and External MySQL Support ## What is the pull request? This PR introduces two major improvements: 1. **LDAP Integration for Client Access Management** - Scheduled sync job reads LDAP to: - Enable/disable clients by `client.email` (local status storage, no LDAP lookup on connect). - Optionally auto-create clients in selected inbounds if missing. - Optionally auto-delete clients from selected inbounds if they disappear in LDAP or access flag is `deny`. - Access flag evaluation: - `ldapFlagField` (fallback: `ldapVlessField`). - `ldapTruthyValues` (default: `true, 1, yes, on`). - `ldapInvertFlag` (useful for `shadowInactive`). - New settings: connection, user search, access flag, scheduler, inbound management, auto-create/delete defaults. - UI support for selecting inbound tags and displaying hints when none exist. 2. **External MySQL Database Support** - Added ability to connect to an external MySQL instance instead of a local DB. - Docker environment supports external DB parameters. - The panel initializes as soon as the database becomes reachable. --- ## Which part of the application is affected by the change? - [x] Frontend - [x] Backend --- ## Type of Changes - [ ] Bug fix - [x] New feature - [x] Refactoring - [ ] Other --- ## Implementation Details - **LDAP** - Sync job: `web/job/ldap_sync_job.go` - LDAP client: `util/ldap/ldap.go` (go-ldap/ldap/v3) - Backend: `web/service/setting.go`, `web/entity/entity.go` - Frontend: - `web/assets/js/model/setting.js` - `web/html/settings/panel/general.html` - `web/html/settings.html` - Xray restart handled by existing scheduler when changes occur. - **External MySQL** - Support for external DB connection with proper initialization at startup. - Panel becomes available once DB is reachable. --- ## Upgrade Notes - Frontend assets are version-busted (`config/version`) → please **hard refresh browser** (`Ctrl+F5`) after update. - If you previously used only `vless_enabled`, you can now configure access flags via `ldapFlagField + ldapTruthyValues + ldapInvertFlag`. - To enable auto-create, select inbound targets (`ldapInboundTags`) and set `ldapAutoCreate = true`. --- ## Screenshots ![4_panel_view_connect_turn_of_flag](https://github.com/user-attachments/assets/84a39551-c751-4674-905b-05dfed972a77) ![3_panel_settings](https://github.com/user-attachments/assets/57a622a2-6ef3-4c4c-8da9-bebf17e41157) ![2_panel_view_connect](https://github.com/user-attachments/assets/5a287f0f-6029-4ee6-b5b3-b7095f8f7ded) ![1_panel_logs](https://github.com/user-attachments/assets/ec1e0979-3fd9-4788-8631-bf16b9656c90) --- <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#5442
No description provided.