Synapse的LDAP3认证提供者
项目描述
允许synapse使用LDAP作为密码提供者。
这允许用户使用来自LDAP服务器的用户名和密码登录到synapse。还有一个ma1sd (第三方) 提供更全面的集成。
安装
使用方法
示例Synapse配置
modules:
 - module: "ldap_auth_provider.LdapAuthProviderModule"
   config:
     enabled: true
     uri: "ldap://ldap.example.com:389"
     start_tls: true
     base: "ou=users,dc=example,dc=com"
     attributes:
        uid: "cn"
        mail: "mail"
        name: "givenName"
     #bind_dn:
     #bind_password:
     #filter: "(objectClass=posixAccount)"
     # Additional options for TLS, can be any key from https://ldap3.readthedocs.io/en/latest/ssltls.html#the-tls-object
     #tls_options:
     #  validate: true
     #  local_certificate_file: foo.crt
     #  local_private_key_file: bar.pem
     #  local_private_key_password: secret如果您想为高可用性指定多个LDAP服务器,您可以提供带有列表的uri参数。默认情况下,采用ldap3.ServerPool的高可用策略,因此使用第一个可用的服务器。
modules:
 - module: "ldap_auth_provider.LdapAuthProviderModule"
   config:
     enabled: true
     uri:
        - "ldap://ldap1.example.com:389"
        - "ldap://ldap2.example.com:389"
     start_tls: true
     base: "ou=users,dc=example,dc=com"
     attributes:
        uid: "cn"
        mail: "email"
        name: "givenName"
     #bind_dn:
     #bind_password:
     #filter: "(objectClass=posixAccount)"
     #tls_options:
     #  validate: true
     #  local_certificate_file: foo.crt
     #  local_private_key_file: bar.pem
     #  local_private_key_password: secret如果您想启用通过电子邮件登录/注册或注册时的givenName/email绑定,则需要启用搜索模式。以下是一个搜索模式的示例配置
modules:
 - module: "ldap_auth_provider.LdapAuthProviderModule"
   config:
     enabled: true
     mode: "search"
     uri: "ldap://ldap.example.com:389"
     start_tls: true
     base: "ou=users,dc=example,dc=com"
     attributes:
        uid: "cn"
        mail: "mail"
        name: "givenName"
     # Search auth if anonymous search not enabled
     bind_dn: "cn=hacker,ou=svcaccts,dc=example,dc=com"
     bind_password: "ch33kym0nk3y"
     #filter: "(objectClass=posixAccount)"
     #tls_options:
     #  validate: true
     #  local_certificate_file: foo.crt
     #  local_private_key_file: bar.pem
     #  local_private_key_password: secret或者,您也可以将服务用户的 bind_password 放入自己的文件中,以防止机密信息泄露到配置文件中
modules:
 - module: "ldap_auth_provider.LdapAuthProviderModule"
   config:
     enabled: true
     # all the other options you need
     bind_password_file: "/var/secrets/synapse-ldap-bind-password"请注意,密码文件中每个末尾的 \n 都将被自动删除。
Active Directory森林支持
如果将 active_directory 标志设置为 true,将搜索Active Directory森林以查找登录详细信息。在此模式下,用户在以下表单之一中输入他们的登录信息
- <login>/<domain> 
- <domain>\<login> 
在任一情况下,这将被映射到Matrix UID <login>/<domain>(在Matrix用户标识符中不能使用正常的AD域分隔符 @ 和 \,因此使用 / 代替。)
假设您在 example.com 森林中有几个域名
modules:
 - module: "ldap_auth_provider.LdapAuthProviderModule"
   config:
     enabled: true
     mode: "search"
     uri: "ldap://main.example.com:389"
     base: "dc=example,dc=com"
     # Must be true for this feature to work
     active_directory: true
     # Optional. Users from this domain may log in without specifying the domain part
     default_domain: main.example.com
     attributes:
        uid: "userPrincipalName"
        mail: "mail"
        name: "givenName"
     bind_dn: "cn=hacker,ou=svcaccts,dc=example,dc=com"
     bind_password: "ch33kym0nk3y"使用此配置,用户可以使用 main\someuser、main.example.com\someuser、someuser/main.example.com 或 someuser 登录。
example.com 森林中的其他域用户可以使用 domain\login 或 login/domain 登录。
请注意,当启用 active_directory 选项时,必须使用 userPrincipalName 或类似格式的LDAP属性,如 login@domain。
故障排除和调试
matrix-synapse-ldap3 日志包含在Synapse homeserver日志中(通常是 homeserver.log)。通过修改Synapse服务器日志配置文件,可以将LDAP插件日志级别提高到 DEBUG 以进行故障排除和调试
- 将 handlers.file.level 的值设置为 DEBUG 
handlers:
  file:
    # [...]
    level: DEBUG- 在 loggers 部分添加以下内容 
loggers:
   # [...]
   ldap3:
     level: DEBUG
   ldap_auth_provider:
     level: DEBUG最后,重新启动您的Synapse服务器以使更改生效
synctl restart项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。
源分布
构建分布
matrix-synapse-ldap3-0.3.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 8bb6517173164d4b9cc44f49de411d8cebdb2e705d5dd1ea1f38733c4a009e1d | |
| MD5 | 3d7ee1661060640df397b1b4a24d8b0e | |
| BLAKE2b-256 | 507580322f4a05c3d582c579eb580df34da8932577ca5f4f844e1d46946f6096 | 
matrix_synapse_ldap3-0.3.0-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 8b4d701f8702551e98cc1d8c20dbed532de5613584c08d0df22de376ba99159d | |
| MD5 | 9734fc61985f0820ea4ed860dc62c4a5 | |
| BLAKE2b-256 | c9879484876f57c370f059228e9f201d912ca3892026aebd46da50847ca78719 |