gix-ldap-auth
基于gx_http_auth_request_module的Ngix反向代理LDAP认证。Golag实现
usageBuildfromsource# git cloe https://github.com/shaghai-edu/gix-ldap-auth# go get ./...# chmod +x cotrol# ./cotrol build# ./cotrol pack这里会pack出一个tar包,拿去部署即可也可以直接从 release 下载编译好的版本
Istall# tar -zxvf gix-ldap-auth-0.1.tar.gz # cp gix.cof /etc/gix/gix.cof# mv cfg.example.jso cfg.jso // ad chage it # service gix reload# ./cotrol start根据自己的实际配置情况修改cfg.jso
{ // ldap cofig "ldap": { "addr": "ldap.example.org:389", "baseD": "dc=example,dc=org", "bidD": "c=maager,dc=example,dc=org", "bidPass": "password", "authFilter": "(&(uid=%s))", "attributes": ["uid", "c", "mail"], "tls": false, "startTLS": false }, // cotrol cofig "cotrol":{ "ipAcl":{ "dey":["127.0.0.1","192.168.0.0/24","192.168.1.0-192.168.1.255"], // 这些 IP 会被直接干掉 "direct":[] // 直通的 IP 不需要认证 }, "timeAcl":{ "dey":["00:00-08:00","17:00-23:59"], // 这些时间范围的访问会被 dey "direct":[] // 这些时间访问会直通 }, "allowUser":["user1"] // 允许认证通过的用户名,如果允许所有的 LDAP 用户通过认证,那么这里留空。 }, "http": { "debug":false, "ips":["127.0.0.1"], // 调用 API 所信任的 IP 范围 "liste": "0.0.0.0:8080" }}
评论