KeyCloak 用户凭证加密
KeyCloak User Credentials Encryption
我正在使用 KeyCloak 自动将包含的用户导入现有的 LDAP。现在,我需要知道 KeyCloak 如何与 LDAP 通信。具体来说,KeyCloak 如何将密码传递给 LDAP 以验证用户凭据。
我尝试在整个 Internet 上进行搜索,但找不到与此相关的论坛、博客或文档。我需要这个来满足我们的安全要求。
Keycloak 通过(请鼓掌)LDAP 协议与 LDAP 兼容的目录服务进行通信。 Keycloak docs talk about Active Directory as the LDAP service but any LDAP-compliant server could work. LDAP as a protocol allows connections to be made to the server in an unencrypted mode as well as secure mode over SSL (aka LDAPS). Keycloak supports LDAPS 除了普通的旧 LDAP:
14.3.4. Connect to LDAP over SSL
When you configure a secured connection URL to your LDAP store(for example
ldaps://myhost.com:636), Keycloak will use SSL for the communication with LDAP server.
Keycloak 文档继续说,当密码在 Keycloak 中更新并推回到 LDAP 时,它是以明文形式完成的。这有点误导。如果您使用 LDAPS,密码在某些情况下确实会以明文形式发送,但它会作为传输层包装在 SSL 中。
这取决于使用的协议。
添加 LDAP 用户联盟时,可以同时使用 ldap
和 ldaps
协议。
将 Connection URL
设置为 ldap://ldapserver.domain.com
时,
使用 ldap 协议并且 Keycloak 通过端口 389(默认情况下)与服务器通信,这意味着从 LDAP 服务器提取的所有数据都将通过纯文本传输,包括每当发出身份验证请求时的密码。
另一方面,将 Connection URL
设置为 ldaps://ldapserver.domain.com
,将使用 LDAP over SSL/TLS
(不要与 LDAP+STARTTLS 混淆,后者是加密 LDAP 通信)和 Keycloak 通过端口 636(默认)与服务器通信。这意味着 Keycloak 和 LDAP 服务器之间的所有通信都将通过加密的 SSL/TLS 隧道进行,类似于浏览器和 HTTPS
网站的通信方式。
14.3.4. Connect to LDAP over SSL
When you configure a secured connection URL to your LDAP store(for
example ldaps://myhost.com:636 ), Keycloak will use SSL for the
communication with LDAP server. ...
关于密码,这似乎是 OP 的具体关注点,根据文档,密码按原样发送到供应商,如果使用 ldaps
,密码当然会通过加密的 TLS 隧道传输。
14.3.7. Password Hashing
When the password of user is updated from Keycloak and sent to LDAP,
it is always sent in plain-text. This is different from updating the
password to built-in Keycloak database, when the hashing and salting
is applied to the password before it is sent to DB. In the case of
LDAP, the Keycloak relies on the LDAP server to provide hashing and
salting of passwords.
Most of LDAP servers (Microsoft Active Directory, RHDS, FreeIPA)
provide this by default. Some others (OpenLDAP, ApacheDS) may store
the passwords in plain-text by default and you may need to explicitly
enable password hashing for them. See the documentation of your LDAP
server more details.
当我发现将 Keycloak 与 OpenLDAP 结合使用时,我也有同样的担忧,密码以明文形式存储在 LDAP 服务器中。
在研究了很长时间如何强制 OpenLDAP 在收到密码时对密码进行哈希处理后,我发现只有在客户端 (Keycloak) 不支持“LDAPv3 密码修改扩展操作”时才需要这样做。
如果您希望密码以散列形式存储在 LDAP 服务器中,则应在 Keycloak 中配置 LDAP 连接时在高级设置中启用“LDAPv3 密码修改扩展操作”。
我正在使用 KeyCloak 自动将包含的用户导入现有的 LDAP。现在,我需要知道 KeyCloak 如何与 LDAP 通信。具体来说,KeyCloak 如何将密码传递给 LDAP 以验证用户凭据。
我尝试在整个 Internet 上进行搜索,但找不到与此相关的论坛、博客或文档。我需要这个来满足我们的安全要求。
Keycloak 通过(请鼓掌)LDAP 协议与 LDAP 兼容的目录服务进行通信。 Keycloak docs talk about Active Directory as the LDAP service but any LDAP-compliant server could work. LDAP as a protocol allows connections to be made to the server in an unencrypted mode as well as secure mode over SSL (aka LDAPS). Keycloak supports LDAPS 除了普通的旧 LDAP:
14.3.4. Connect to LDAP over SSL
When you configure a secured connection URL to your LDAP store(for example ldaps://myhost.com:636), Keycloak will use SSL for the communication with LDAP server.
Keycloak 文档继续说,当密码在 Keycloak 中更新并推回到 LDAP 时,它是以明文形式完成的。这有点误导。如果您使用 LDAPS,密码在某些情况下确实会以明文形式发送,但它会作为传输层包装在 SSL 中。
这取决于使用的协议。
添加 LDAP 用户联盟时,可以同时使用 ldap
和 ldaps
协议。
将 Connection URL
设置为 ldap://ldapserver.domain.com
时,
使用 ldap 协议并且 Keycloak 通过端口 389(默认情况下)与服务器通信,这意味着从 LDAP 服务器提取的所有数据都将通过纯文本传输,包括每当发出身份验证请求时的密码。
另一方面,将 Connection URL
设置为 ldaps://ldapserver.domain.com
,将使用 LDAP over SSL/TLS
(不要与 LDAP+STARTTLS 混淆,后者是加密 LDAP 通信)和 Keycloak 通过端口 636(默认)与服务器通信。这意味着 Keycloak 和 LDAP 服务器之间的所有通信都将通过加密的 SSL/TLS 隧道进行,类似于浏览器和 HTTPS
网站的通信方式。
14.3.4. Connect to LDAP over SSL
When you configure a secured connection URL to your LDAP store(for example ldaps://myhost.com:636 ), Keycloak will use SSL for the communication with LDAP server. ...
关于密码,这似乎是 OP 的具体关注点,根据文档,密码按原样发送到供应商,如果使用 ldaps
,密码当然会通过加密的 TLS 隧道传输。
14.3.7. Password Hashing
When the password of user is updated from Keycloak and sent to LDAP, it is always sent in plain-text. This is different from updating the password to built-in Keycloak database, when the hashing and salting is applied to the password before it is sent to DB. In the case of LDAP, the Keycloak relies on the LDAP server to provide hashing and salting of passwords.
Most of LDAP servers (Microsoft Active Directory, RHDS, FreeIPA) provide this by default. Some others (OpenLDAP, ApacheDS) may store the passwords in plain-text by default and you may need to explicitly enable password hashing for them. See the documentation of your LDAP server more details.
当我发现将 Keycloak 与 OpenLDAP 结合使用时,我也有同样的担忧,密码以明文形式存储在 LDAP 服务器中。
在研究了很长时间如何强制 OpenLDAP 在收到密码时对密码进行哈希处理后,我发现只有在客户端 (Keycloak) 不支持“LDAPv3 密码修改扩展操作”时才需要这样做。
如果您希望密码以散列形式存储在 LDAP 服务器中,则应在 Keycloak 中配置 LDAP 连接时在高级设置中启用“LDAPv3 密码修改扩展操作”。