20.12. 启用不同类型的绑定
每当实体登录或访问 Directory 服务器时,它将 绑定到 目录。有许多不同类型的绑定操作,有时根据绑定方法(如简单绑定或自动绑定)以及某些类型,具体取决于用户绑定到目录的身份(匿名和未经身份验证的绑定)。
以下部分包含可增加绑定安全性(如 第 20.12.1 节 “需要安全绑定”)或简化绑定操作(如 第 20.12.4 节 “配置自动绑定”)的配置参数。
20.12.1. 需要安全绑定 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
简单的绑定是,当实体使用简单的绑定 DN 密码组合向目录服务器进行身份验证时。虽然可以使用密码文件而不是直接通过命令行发送密码,但这两种方法仍然需要通过线路发送或访问纯文本密码。这使得密码易受任何人嗅探连接的影响。
可能需要在安全连接(TLS 或 STARTTLS)上进行简单绑定,这会有效地加密明文密码,因为它与 bind 操作发送。(也可以使用替代替代简单绑定,如 SASL 身份验证和基于证书的身份验证。)
重要
除了登录服务器和 LDAP 操作的常规用户外,服务器到服务器的连接也会受到需要简单绑定的安全连接的影响。复制、同步和数据库链都可以在服务器之间使用简单绑定,例如。
如果打开
nsslapd-require-secure-binds
属性,请确保复制协议、同步协议和链配置指定了安全连接。否则,这些操作将失败。
注意
为 bind 操作需要安全连接仅适用于 经过身份验证的绑定。无密码(匿名和未经身份验证的绑定)的绑定操作可以进行标准连接。
- 在 上,将
nsslapd-require-secure-binds
配置参数设置为 :dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-require-secure-binds=on
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-require-secure-binds=on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 重启实例:
dsctl instance_name restart
# dsctl instance_name restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.12.2. 禁用匿名绑定 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
如果用户在不提供任何用户名或密码的情况下尝试连接到目录服务器,则这是一个 匿名绑定。匿名绑定简化了常见的搜索和读操作,如检查电话号码或电子邮件地址的目录,不需要用户先向目录进行身份验证。
注意
默认情况下,允许匿名绑定(on)用于搜索和读取操作。这允许访问 常规目录条目,其中包括用户和组条目以及类似 root DSE 的配置条目。另一个选项
rootdse
允许匿名搜索和读取访问权限搜索 root DSE 本身,但限制对所有其他目录条目的访问。
但是,匿名绑定存在风险。必须就适当的 ACI 来限制对敏感信息的访问,并禁止像修改和删除这样的操作。另外,匿名绑定可用于拒绝服务攻击或恶意人员访问服务器。
第 18.11.1.1.3 节 “授予匿名访问权限” 具有设置 ACI 的示例来控制匿名用户可以访问的内容,第 14.5.4 节 “在匿名绑定上设置资源限值” 提供了有关为匿名用户放置资源限值的信息。
如果这些选项没有提供足够级别的安全性,则可以完全禁用匿名绑定:
- 将
nsslapd-allow-anonymous-access
配置参数设置为 off :dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-allow-anonymous-access=off
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-allow-anonymous-access=off
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 重启实例:
dsctl instance_name restart
# dsctl instance_name restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
注意
禁用匿名绑定后,用户无法使用其 RDN 登录。它们需要提供要登录的完整 DN。
另外,当禁用匿名绑定时,未经身份验证的绑定也会自动禁用。
20.12.3. 允许未验证的绑定 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
未经身份验证的绑定是到提供空密码的目录服务器的连接。出于安全原因,使用默认设置,目录服务器在此场景中拒绝访问:
ldapsearch -w "" -p 389 -h server.example.com -b "dc=example,dc=com" \ -s sub -x "(objectclass=*)"
# ldapsearch -w "" -p 389 -h server.example.com -b "dc=example,dc=com" \
-s sub -x "(objectclass=*)"
ldap_bind: Server is unwilling to perform (53)
additional info: Unauthenticated binds are not allowed
警告
红帽建议不要启用未经身份验证的绑定。此验证方法允许用户在不提供密码作为任何帐户(包括目录管理器)的情况下绑定。绑定后,用户可以使用用来绑定的帐户的权限访问所有数据。
要启用不安全的未经身份验证的绑定,请在 上将
nsslapd-allow-unauthenticated-binds
配置选项设置为 :
dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-allow-unauthenticated-binds=on
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-allow-unauthenticated-binds=on
20.12.4. 配置自动绑定 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Autobind 是基于本地 UNIX 凭据连接到目录服务器的方法,该凭据映射到存储在目录本身的身份。Autobind 在两个部分配置:
在配置 autobind 前,首先确保启用了 LDAPI。然后,配置自动绑定映射(在 第 20.12.4.2 节 “配置
Autobind
功能” 中)。
20.12.4.1. Autobind 和 LDAPI 概述 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
进程间通信(IPC)是独立于 Unix 机器或网络上的进程来直接相互通信的方法。LDAPI 是一种通过这些 IPC 连接运行 LDAP 连接的方法,这意味着 LDAP 操作可以通过 Unix 套接字运行。与常规 LDAP 连接相比,这些连接速度更快、更安全。
目录服务器使用这些 LDAPI 连接,允许用户立即绑定到目录服务器,或使用支持通过 Unix 套接字连接的工具访问目录服务器。Autobind 使用 Unix 用户的 uid:gid,并将该用户映射到 Directory 服务器中的条目,然后允许访问该用户。
Autobind 允许映射到三个目录条目:
- 如果 Unix 用户与一个用户条目匹配,则用户条目
- 如果 Unix 用户是 root 用户,或者
nsslapd-ldapimaprootdn
中定义的超级用户,则目录管理器
图 20.1. 自动绑定连接路径
特殊的 autobind 用户是特殊的 autobind 后缀下的条目(在常规用户子树之外)。下面的条目通过其用户和组 ID 号标识:
gidNumber=gid+uidNumberuid, autobindsuffix
gidNumber=gid+uidNumberuid, autobindsuffix
如果没有启用 autobind,但 LDAPI 是启用的,那么 Unix 用户匿名绑定到 Directory 服务器,除非它们提供了其他绑定凭证。
注意
Autobind 允许客户端在不提供绑定用户名和密码的情况下向目录服务器发送请求,或使用其它 SASL 身份验证机制。根据 LDAP 标准,如果没有通过请求提供绑定信息,服务器会将请求作为匿名绑定处理。要符合标准,这需要某种类型的绑定信息,任何使用 autobind 的客户端都应通过 SASL/EXTERNAL 发送请求。
有关配置 SASL 的详情,请参考 第 9.10 节 “设置 SASL 身份映射”。
20.12.4.2. 配置 Autobind 功能 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
启用
Autobind
功能仅允许匿名访问目录服务器。但是,您可以将 Linux 用户映射到 Directory Server 条目,并将 root
用户映射到 Directory Manager:
- 验证
nsslapd-ldapiautobind
参数是否已启用,这是默认值:dsconf -D "cn=Directory Manager" ldap://server.example.com config get nsslapd-ldapiautobind
# dsconf -D "cn=Directory Manager" ldap://server.example.com config get nsslapd-ldapiautobind nsslapd-ldapiautobind: on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 如果
nsslapd-ldapiautobind
参数设置为 off,请启用它:dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapiautobind=on
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapiautobind=on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 要映射用户条目,例如:
dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapimaptoentries=on nsslapd-ldapiuidnumbertype=uidNumber nsslapd-ldapigidnumbertype=gidNumber nsslapd-ldapientrysearchbase=ou=People,dc=example,dc=com
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapimaptoentries=on nsslapd-ldapiuidnumbertype=uidNumber nsslapd-ldapigidnumbertype=gidNumber nsslapd-ldapientrysearchbase=ou=People,dc=example,dc=com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - nsslapd-ldapimaptoentries=on 启用条目映射。
- nsslapd-ldapiuidnumbertype=uidNumber 设置包含 Unix UID 号的目录服务器中的属性。
- nsslapd-ldapigidnumbertype=gidNumber 设置包含 Unix GID 号的目录服务器中的属性。
- nsslapd-ldapientrysearchbase=ou=People,dc=example,dc=com 设置 DN,用于搜索用户条目。
- (可选)将 Red Hat Enterprise Linux 中的
root
用户映射到 Directory 服务器中的 cn=Directory Manager 帐户:dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapimaprootdn="cn=Directory Manager"
# dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-ldapimaprootdn="cn=Directory Manager"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 重启实例:
dsctl instance_name restart
# dsctl instance_name restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow