作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在尝试为用 Golang 编写的 OpenLDAP 客户端实现 SASL/EXTERNAL
身份验证。
换句话说,我想加载以下数据:
ldapsearch -Y EXTERNAL -H ldapi:// -s base -b 'olcDatabase={1}mdb,cn=config' olcSyncRepl
我正在使用https://github.com/go-ldap/ldap图书馆。不幸的是,该库仅支持简单的身份验证。我很高兴实现 SASL/EXTERNAL
但我无法识别该协议(protocol)是如何工作的?例如有https://ldap.com/ldapv3-wire-protocol-reference-bind/ CRAM-MD5
身份验证过程。
我想得到 SASL/EXTERNAL
的相同解释。
我成功连接到 unix 套接字 (ldapi://
)。但我不明白需要以编程方式发送什么样的命令才能完成身份验证。
最佳答案
我找到了解决方案。
首先,您需要连接到unix套接字。通常,套接字位于 /var/run/slapd/ldapi
路径。
然后您需要进行两个更改的简单绑定(bind):
sasl
身份验证pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
saslAuth := ber.Encode(ber.ClassContext, ber.TypeConstructed, 3, "", "authentication")
saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "EXTERNAL", "SASL Mech"))
saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "SASL Cred"))
pkt.AppendChild(saslAuth)
关于go - 如何在 Golang 上通过 IPC 为 OpenLDAP 客户端实现 SASL/EXTERNAL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58272670/
我是一名优秀的程序员,十分优秀!