Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
github.com/childe/ldap-nginx-golang
这只是一个Demo, 用来学习的, 我也没有在生产环境跑过.
从编码编译
git clone git@github.com:childe/ldap-nginx-golang.git cd ldap-nginx-golang make
或者下载编译好的二进制文件
从https://github.com/childe/ldap-nginx-golang/releases/tag/201607下载对应的版本
配置config.json
参考 config.example.json, 配置项参考后面的ldap验证原理
配置nginx
cp nginx.conf /etc/nginx
nginx -s reload
配置可参考后面的nginx原理
运行
./nginx-ldap-auth-daemon --config config.json
所有参数都可以在运行时指定, 会覆盖config.json里面的值, 如下:
./nginx-ldap-auth-daemon --host 0.0.0.0 --port 9000 --insecureSkipVerify true
useSSL和insecureSkipVerify两个参数只能在运行时指定, 不能写在config.json里面, 因为我不知道golang里面怎么处理bool类型的options参数的默认值, 没办法和config.json里面的值做合并. 用interface好像也可以做, 但太麻烦了.
./nginx-ldap-auth-daemon --help
依赖auth_request这个模块, 但这个模块默认是不安装的, 需要编译nginx的时候加上--with-http_auth_request_module这个参数.
官方文档在http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
简单解释一下:
location / {
auth_request /auth-proxy;
proxy_pass http://backend/;
}
这个意思是说, 所有访问先转到/auth-proxy这里, /auth-proxy如果返回401或者403, 则访问被拒绝; 如果返回2xx, 访问允许,继续被nginx转到http://backend/; 返回其他值, 会被认为是个错误.
ldap的验证步骤为:
参见http://ohmycat.me/nginx/2016/06/28/nginx-ldap.html
nginx的一篇官方博客已经给出了非常详细的ldap认证办法, 并给出了示例代码
我只是用golang实现了一下, 并做了精简.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.