惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Cyber Attacks, Cyber Crime and Cyber Security
Security Latest
Security Latest
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
S
Schneier on Security
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
F
Full Disclosure
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
Hacker News: Ask HN
Hacker News: Ask HN
G
Google Developers Blog
H
Heimdal Security Blog
O
OpenAI News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LangChain Blog
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
IT之家
IT之家
Cyberwarzone
Cyberwarzone
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Know Your Adversary
Know Your Adversary
博客园 - 聂微东
The Cloudflare Blog
C
Check Point Blog
K
Kaspersky official blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Tor Project blog
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
P
Proofpoint News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
小众软件
小众软件
Cloudbric
Cloudbric
A
Arctic Wolf

二丫讲梵

学习周刊-总第258期-2026年第15周 学习周刊-总第257期-2026年第14周 学习周刊-总第256期-2026年第13周 学习周刊-总第255期-2026年第12周 学习周刊-总第254期-2026年第11周 学习周刊-总第253期-2026年第10周 临时插播一条羊毛,免费领取450元大模型API代金券 学习周刊-总第252期-2026年第09周 学习周刊-总第251期-2026年第08周 学习周刊-总第250期-2026年第07周 学习周刊-总第249期-2026年第06周 诚邀评论,聊聊你所知欲知的我 学习周刊-总第248期-2026年第05周 我的QQ动态之2015年 我的QQ动态之2014年 我的QQ动态之2013年 我的QQ动态之2012年 我的QQ动态-2010-2011年 我的QQ动态-创栏小叙 学习周刊-总第247期-2026年第04周 Nexus社区版权益阉割--一文告诉你有哪些版本可以选择 学习周刊-总第246期-2026年第03周 学习周刊-总第245期-2026年第02周 学习周刊-总第244期-2026年第01周 学习周刊-总第243期-2025年第52周 学习周刊-总第242期-2025年第51周 开源项目ZenOps:带你领略禅意运维 学习周刊-总第241期-2025年第50周 用京东金融,享负债人生 学习周刊-总第240期-2025年第49周 学习周刊-总第239期-2025年第48周 整理我在静态服务透明代理上的极致求索之路,最后一个你绝想不到 学习周刊-总第238期-2025年第47周 我们输了,但收获颇多 太多了,太多了 学习周刊-总第237期-2025年第46周 学习周刊-总第236期-2025年第45周 学习周刊-总第235期-2025年第44周 二五年国庆二三事 学习周刊-总第234期-2025年第43周 学习周刊-总第233期-2025年第42周 学习周刊-总第232期-2025年第41周 学习周刊-总第231期-2025年第40周 学习周刊-总第230期-2025年第39周 西湖毅行 2025年开源世界逸闻三则 学习周刊-总第229期-2025年第38周 手抄《与妻书》 CNB开发与构建基于docker-cache缓存复用的配置实践心得 学习周刊-总第228期-2025年第37周 父亲善行录 学习周刊-总第227期-2025年第36周 带你认识我之看看我的高中同学录(其二) 学习周刊-总第226期-2025年第35周 带你认识我之看看我的高中同学录(其一) 认识神级MCP工具系列--用anyquery和数据库交互 学习周刊-总第225期-2025年第34周 学习周刊-总第224期-2025年第33周 学习周刊-总第223期-2025年第32周 学习周刊-总第222期-2025年第31周 学习周刊-总第221期-2025年第30周 CNB云原生开发环境届的瑞士军刀,详解qifei项目 vuepress-vdoing主题配置自建不蒜子统计 学习周刊-总第220期-2025年第29周 写在博客发表文章1000篇的节点 从claude cli的体验聊聊最大的敌人是我们自己的成见 学习周刊-总第219期-2025年第28周 学习周刊-总第218期-2025年第27周 学习周刊-总第217期-2025年第26周 理论正确,事实错误 学习周刊-总第216期-2025年第25周 学习周刊-总第215期-2025年第24周 学习周刊-总第214期-2025年第23周 学习周刊-总第213期-2025年第22周 学习周刊-总第212期-2025年第21周 从赵心童世锦赛夺冠聊聊我的斯诺克情缘 学习周刊-总第211期-2025年第20周 记录二五年五一之短暂回归家庭 学习周刊-总第210期-2025年第19周 学习周刊-总第209期-2025年第18周 学习周刊-总第208期-2025年第17周 Go开发实践之Gin框架将前端的dist目录embed到二进制 学习周刊-总第207期-2025年第16周 近期关于cobra库的一些实践心得总结 学习周刊-总第206期-2025年第15周 我的嗜好--嗑瓜子 记大宝参加幼儿园组织的清明烈士陵园扫墓活动 学习周刊-总第205期-2025年第14周 学习周刊-总第204期-2025年第13周 前端开发小笔记--在数组中给字段添加值与删除字段的操作 学习周刊-总第203期-2025年第12周 人生实苦,何以自渡 学习周刊-总第202期-2025年第11周 近期发现的一些优秀的工具提名(一) 学习周刊-总第201期-2025年第10周 学习周刊-总第200期-2025年第09周 记一次女友喝醉使我忍术破功 爱情风波--一次分手又复合的经历 学习周刊-总第199期-2025年第08周 整理我的信息源
拯救openLDAP的上古管理界面,我写了一个现代化的ldap管理后台go-ldap-admin
二丫讲梵 · 2022-05-19 · via 二丫讲梵

Go-Ldap-Admin

基于Go+Vue实现的openLDAP后台管理项目。

Go version Gin version Gorm version License

目录

  • Go-Ldap-Admin
    • 缘起
    • 在线体验
    • 项目地址
    • 核心功能
    • 快速开始
    • 本地开发
    • 生产部署
    • 感谢
    • 另外

# 缘起

我曾经经历的公司强依赖 openLDAP 来作为企业内部员工管理的平台,并通过 openLDAP 进行各平台的认证打通工作。

但成也萧何败也萧何,给运维省力的同时,ldap 又是维护不够友好的。

godap (opens new window)项目中,作者这样描述对 ldap 的感受:

The short version of the story goes like this: I hate LDAP. I used to love it. But I loved it for all the wrong reasons. LDAP is supported as an authentication solution by many different pieces of software. Aside from its de jure standard status, its wide deployment cements it as a de facto standard as well.

However, just because it is a standard doesn't mean it is a great idea.

I'll admit that given its age LDAP has had a good run. I'm sure its authors carefully considered how to construct the protocol and chose ASN.1 and its encoding with all of wellest of well meaning intentions.

The trouble is that with today's Internet, LDAP is just a pain in the ass. You can't call it from your browser. It's not human readable or easy to debug. Tooling is often arcane and confusing. It's way more complicated than what is needed for most simple authentication-only uses. (Yes, I know there are many other uses than authentication - but it's often too complicated for those too.)

Likely owing to the complexity of the protocol, there seems to be virtually no easy to use library to implement the server side of the LDAP protocol that isn't tied in with some complete directory server system; and certainly not in a language as easy to "make it work" as Go.

他说他对 ldap 又爱又恨,因为 ldap 出现的最早,许多的三方软件都兼容支持它,它成了这方面的一个标准。但问题在于,它对于维护者而言,又是复杂麻烦的。就算是有 Phpldapadmin 这样的平台能够在浏览器维护,但看到那样上古的界面,以及复杂的交互逻辑,仍旧能够把不少人劝退。

鉴于此,我开发了这个现代化的 openLDAP 管理后台。

# 在线体验

admin / 123456

演示地址:http://demo-go-ldap-admin.eryajf.net (opens new window)

# 项目地址

分类 GitHub Gitee
后端 https://github.com/eryajf-world/go-ldap-admin.git https://gitee.com/eryajf-world/go-ldap-admin.git
前端 https://github.com/eryajf-world/go-ldap-admin-ui.git https://gitee.com/eryajf-world/go-ldap-admin-ui.git

# 核心功能

  • 基于 GIN WEB API 框架,基于 Casbin 的 RBAC 访问控制模型,JWT 认证,Validator 参数校验
  • 基于 GORM 的数据库存储
  • 基于 go-ldap 库的主逻辑交互
  • 用户管理
    • 用户的增删改查
  • 分组管理
    • 分组的增删改查
    • 分组内成员的管理

# 快速开始

你可以通过 docker-compose 在本地快速拉起进行体验。

快速拉起的容器包括:MySQL-5.7,openLDAP-1.4.0,phpldapadmin-0.9.0,go-ldap-admin。

服务端口映射如下:

Service Port
MySQL 3307:3306
openLDAP 389:389
phpldapadmin 8091:80
go-ldap-admin 8090:80,8888:8888

拉起之前确认是否有与本地端口冲突的情况。

$ git clone https://github.com/eryajf-world/go-ldap-admin.git

$ cd docs/docker-compose

$ docker-compose up -d

1
2
3
4
5

当看到容器都正常运行之后,可以在本地访问:http://localhost:8090,用户名/密码:admin/123456

登录页:

首页:

用户管理:

分组管理:

分组内成员管理:

# 本地开发

# 前言准备

前提是已准备好 MySQL 与 openLDAP,本地开发建议直接通过 docker 拉起即可,可参考文档:https://wiki.eryajf.net/pages/3a0d5f (opens new window)

# 拉取代码

# 后端代码
$ git clone https://github.com/eryajf-world/go-ldap-admin.git

# 前端代码
$ git clone https://github.com/eryajf-world/go-ldap-admin-ui.git

1
2
3
4
5

后端目录结构:

├─config     # viper读取配置
├─controller # controller层,响应路由请求的方法
├─docs       # 一些物料信息
├─logic      # 主要的处理逻辑
├─middleware # 中间件
├─model      # 结构体模型
├─public     # 一些公共的,工具类的放在这里
├─routes     # 所有路由
├─service    # 整合与底层存储交互的方法
├─svc        # 定义入参出参的结构体
└─test       # 跑测试用的

1
2
3
4
5
6
7
8
9
10
11

# 更改配置

# 修改后端配置
$ cd go-ldap-admin
# 文件路径 config.yml
$ vim config.yml

# 根据自己本地的情况,调整数据库以及openLDAP的配置信息。

1
2
3
4
5
6

# 启动服务

# 启动后端
$ cd go-ldap-admin
$ go mod tidy
$ go run main.go
$ make run

# 启动前端
$ cd go-ldap-admin-ui
$ yarn
$ yarn dev

1
2
3
4
5
6
7
8
9
10

本地访问:http://localhost:8090,用户名/密码:admin/密码是配置文件中 openLDAP 中 admin 的密码。

# 生产部署

生产环境单独部署,通过 Nginx 代理服务,配置如下:

server {
    listen 80;
    server_name go-ldap-admin.eryajf.net;

    root /data/www/web/dist;

    location / {
        try_files $uri $uri/ /index.html;
        add_header Cache-Control 'no-store';
    }

    location /api/ {
        proxy_set_header Host $http_host;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:8888;
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# 感谢

感谢如下优秀的项目,没有这些项目,不可能会有 go-ldap-admin:

# 另外

  • 如果觉得项目不错,麻烦动动小手点个 ⭐️star⭐️!
  • 如果你还有其他想法或者需求,欢迎在 issue 中交流!
  • 程序还有很多 bug,欢迎各位朋友一起协同共建!