Hyperledger结构到LDAP目录的ca连接
我们正在实施Hyperledger结构解决方案。为此,我们在一个特定的docker中使用最小配置(我们仍在试图弄清楚这些东西是如何工作的)来设置一个fabric CA 当我们需要使用电子邮件/密码对登录用户时,我们设置了一个LDAP组件。我们选择使用OpenLDAP,在不同的docker中使用osixia/OpenLDAP实现 我们在fabric-ca-server-config.yaml中设置参数,以将fabric-ca连接到LDAP。在两个dockers的开头,日志似乎都很好:Hyperledger结构到LDAP目录的ca连接,ldap,openldap,hyperledger-fabric-ca,Ldap,Openldap,Hyperledger Fabric Ca,我们正在实施Hyperledger结构解决方案。为此,我们在一个特定的docker中使用最小配置(我们仍在试图弄清楚这些东西是如何工作的)来设置一个fabric CA 当我们需要使用电子邮件/密码对登录用户时,我们设置了一个LDAP组件。我们选择使用OpenLDAP,在不同的docker中使用osixia/OpenLDAP实现 我们在fabric-ca-server-config.yaml中设置参数,以将fabric-ca连接到LDAP。在两个dockers的开头,日志似乎都很好: Succes
Successfully initialized LDAP client
当我们进行Fabric CA教程时,命令失败:
fabric-ca-client enroll -u http://cn=admin,dc=example:admin@localhost:7054
结果是:
[INFO] 127.0.0.1:46244 POST /enroll 401 23 "Failed to get user: Failed to connect to LDAP server over TCP at localhost:389: LDAP Result Code 200 "": dial tcp 127.0.0.1:389: connect: connection refused"
当使用相同的凭据在CLI中通过LDAP浏览器PHPLdapAdmin进行解析时,LDAP的设置和功能正确
这是fabric-ca-server-config.yaml的一部分:
ldap:
enabled: true
url: ldap://cn=admin,dc=example:admin@localhost:389/dc=example
userfilter: (uid=%s)
tls:
enabled: false
certfiles:
client:
certfile: noclientcert
keyfile:
attribute:
names: ['uid','member']
converters:
- name: hf.Revoker
value: attr("uid") =~ "revoker*"
maps:
groups:
- name: example
value: peer
有人能帮忙吗?
感谢阅读,我没有使用本地LDAP服务器,而是使用一行进行快速测试。。。 然而,我仍然得到错误以及 我的fabric-ca-server-config.yaml是
ldap:
enabled: true
url: ldap://cn=read-only-admin,dc=example,dc=com:password@ldap.forumsys.com:389/dc=example,dc=com
tls:
certfiles:
client:
certfile:
keyfile:
# Attribute related configuration for mapping from LDAP entries to Fabric CA attributes
attribute:
names: ['uid','member']
converters:
- name: hf.Revoker
value: attr("uid") =~ "revoker*"
maps:
groups:
- name:
value:
我通过以下方式运行它:
fabric-ca-server start -c fabric-ca-server-config.yaml
我看到了日志:
Successfully initialized LDAP client
以下是phpLDAPAdmin的屏幕截图:
我使用相同的脚本进行测试:
$fabric-ca-client enroll -u http://cn=read-only-admin,dc=example,dc=com:password@localhost:7054
$fabric-ca-client enroll -u http://uid=tesla,dc=example,dc=com:password@localhost:7054
但还是不太好,比如:
POST /enroll 401 23 "Failed to get user: User 'uid=tesla,dc=example,dc=com' does not exist in LDAP directory"
我在这里看到两个问题:
第一个与docker相关,而不是fabric-ca。您必须将netowrk_模式
设置为host
,以移除容器和docker主机之间的网络隔离。然后您的docker容器将看到位于docker主机上的OpenLDAP
请查看示例docker compose.yaml
文件
version: '2'
services:
fabric-ca-server:
image: hyperledger/fabric-ca:1.1.0
container_name: fabric-ca-server
ports:
- "7054:7054"
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
volumes:
- ./fabric-ca-server:/etc/hyperledger/fabric-ca-server
command: sh -c 'fabric-ca-server start'
network_mode: host
有关docker network的更多信息,您可以在此处找到:
当网络问题得到解决时,您还必须修改userfilter,使其与管理员前缀相关联,因此它应该如下所示:userfilter:(cn=%s)
如果无法修复userfilter,则您将获得在LDAP中找不到管理员的信息