可插拔身份验证系统变量
除非安装了适当的服务器端插件,否则这些变量不可用:
uthentication_ldap_sasl
用于具有以下形式的名称的系统变量uthentication_ldap_sasl_xxx
uthentication_ldap_simple
用于具有以下形式的名称的系统变量uthentication_ldap_simple_xxx
表6.23身份验证插件系统变量摘要
名称 | Cmd线 | 选项文件 | 系统变量 | 状态变量 | 可变范围 | 动态 |
---|---|---|---|---|---|---|
uthentication_ldap_sasl_auth_method_name | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_bind_base_dn | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_bind_root_dn | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_bind_root_pwd | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_ca_path | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_group_search_attr | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_group_search_filter | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_init_pool_size | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_log_status | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_max_pool_size | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_server_host | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_server_port | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_tls | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_sasl_user_search_attr | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_auth_method_name | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_bind_base_dn | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_bind_root_dn | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_bind_root_pwd | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_ca_path | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_group_search_attr | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_group_search_filter | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_init_pool_size | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_log_status | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_max_pool_size | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_server_host | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_server_port | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_tls | 是 | 是 | 是 | Global | 是 | |
uthentication_ldap_simple_user_search_attr | 是 | 是 | 是 | Global | 是 | |
uthentication_windows_log_level | 是 | 是 | 是 | Global | 没有 | |
uthentication_windows_use_principal_name | 是 | 是 | 是 | Global | 没有 |
uthentication_ldap_sasl_auth_method_name
属性 值 命令行格式 --authentication-ldap-sasl-auth-method-name=value
系统变量 uthentication_ldap_sasl_auth_method_name
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 SCRAM-SHA-1
对于SASL LDAP身份验证,身份验证方法名称。身份验证插件和LDAP服务器之间的通信根据此身份验证方法进行。允许使用以下身份验证方法值:
SCRAM-SHA-1
:身份验证使用SASL质询响应机制来确保密码安全。客户端
uthentication_ldap_sasl_client
插件与SASL服务器通信,使用密码创建质询并获取SASL请求缓冲区,然后将该缓冲区传递给服务器端uthentication_ldap_sasl
插件。客户端和服务器端SASL LDAP插件使用SASL消息在LDAP协议内安全地传输凭据,以避免在MySQL客户端和服务器之间发送明文密码。
uthentication_ldap_sasl_bind_base_dn
属性 值 命令行格式 --authentication-ldap-sasl-bind-base-dn=value
系统变量 uthentication_ldap_sasl_bind_base_dn
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于SASL LDAP认证,基本专有名称(DN)。通过将变量锚定在搜索树中的某个位置(“基本”),可以使用该变量来限制搜索范围。
假设一组LDAP用户条目的成员各自具有以下形式:
uid=user_name,ou=People,dc=example,dc=com
另一组LDAP用户条目的成员每个都具有以下形式:
uid=user_name,ou=Admin,dc=example,dc=com
然后像这样搜索不同的基本DN值:
- 如果基本DN为
ou=People,dc=example,dc=com
:搜索仅在第一组中查找用户条目。 - 如果基本DN为
ou=Admin,dc=example,dc=com
:搜索仅在第二组中查找用户条目。 - 如果基本DN为
ou=dc=example,dc=com
:搜索将查找第一组或第二组中的用户条目。
通常,更具体的基本DN值可加快搜索速度,因为它们对搜索范围的限制更大。
- 如果基本DN为
uthentication_ldap_sasl_bind_root_dn
属性 值 命令行格式 --authentication-ldap-sasl-bind-root-dn=value
系统变量 uthentication_ldap_sasl_bind_root_dn
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于SASL LDAP身份验证,是根专有名称(DN)。此变量与
uthentication_ldap_sasl_bind_root_pwd
凭据一起使用,用于对LDAP服务器进行身份验证,以执行搜索。身份验证使用一个或两个LDAP绑定操作,具体取决于MySQL帐户是否命名LDAP用户DN:- 如果该帐户未命名用户DN:
uthentication_ldap_sasl
使用uthentication_ldap_sasl_bind_root_dn
和执行初始LDAP绑定uthentication_ldap_sasl_bind_root_pwd
。(默认情况下,它们都为空,因此,如果未设置它们,则LDAP服务器必须允许匿名连接。)生成的绑定LDAP句柄用于根据客户端用户名搜索用户DN。uthentication_ldap_sasl
使用用户DN和客户端提供的密码执行第二次绑定。 - 如果该帐户确实为用户DN命名:在这种情况下,不需要第一次绑定操作。
uthentication_ldap_sasl
使用用户DN和客户端提供的密码执行单个绑定。这比MySQL帐户未指定LDAP用户DN的速度要快。
- 如果该帐户未命名用户DN:
uthentication_ldap_sasl_bind_root_pwd
属性 值 命令行格式 --authentication-ldap-sasl-bind-root-pwd=value
系统变量 uthentication_ldap_sasl_bind_root_pwd
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于SASL LDAP身份验证,是根专有名称的密码。该变量与结合使用
uthentication_ldap_sasl_bind_root_dn
。请参阅该变量的描述。uthentication_ldap_sasl_ca_path
属性 值 命令行格式 --authentication-ldap-sasl-ca-path=value
系统变量 uthentication_ldap_sasl_ca_path
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于SASL LDAP认证,证书颁发机构文件的绝对路径。如果希望认证插件执行LDAP服务器证书的验证,请指定此文件。
注意
除了将
uthentication_ldap_sasl_ca_path
变量设置为文件名之外,还必须将适当的证书颁发机构证书添加到文件中并启用uthentication_ldap_sasl_tls
系统变量。uthentication_ldap_sasl_group_search_attr
属性 值 命令行格式 --authentication-ldap-sasl-group-search-attr=value
系统变量 uthentication_ldap_sasl_group_search_attr
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 cn
对于SASL LDAP认证,是在LDAP目录条目中指定组名称的属性名称。如果
uthentication_ldap_sasl_group_search_attr
其默认值为cn
,则搜索将返回该cn
值作为组名。例如,如果uid
值为的LDAP条目user1
的cn
属性为mygroup
,则搜索user1
returnmygroup
作为组名。如果不需要组或代理身份验证,则此变量应为空字符串。
如果组搜索属性为
isMemberOf
,则LDAP认证直接检索用户属性isMemberOf
值并将其分配为组信息。如果组搜索属性不是isMemberOf
,则LDAP身份验证将搜索用户所属的所有组。(后者是默认行为。)此行为基于如何以两种方式存储LDAP组信息:1)组条目可以具有名为memberUid
或member
带有用户名的值的属性;2)用户条目可以具有以isMemberOf
组名的值命名的属性。uthentication_ldap_sasl_group_search_filter
属性 值 命令行格式 --authentication-ldap-sasl-group-search-filter=value
系统变量 uthentication_ldap_sasl_group_search_filter
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 (|(&(objectClass=posixGroup)(memberUid=%s))(&(objectClass=group)(member=%s)))
对于SASL LDAP认证,自定义组搜索过滤器。
搜索过滤器值可以包含
{UA}
和{UD}
表示用户名和完整用户DN的符号。例如,{UA}
被替换为用户名(例如)"admin"
,而{UD}
被替换为使用完整DN(例如)"uid=admin,ou=People,dc=example,dc=com"
。以下值是默认值,它同时支持OpenLDAP和Active Directory:(|(&(objectClass=posixGroup)(memberUid={UA})) (&(objectClass=group)(member={UD})))
在某些情况下,对于用户方案,
memberOf
是一个简单的用户属性,不包含组信息。为了提高灵活性,{GA}
可以在组搜索属性中使用可选的前缀。任何带有{GA}前缀的组属性都将被视为具有组名称的用户属性。例如,{GA}MemberOf
如果值为,则如果组值是DN,则将返回来自组DN的第一个属性值作为组名。uthentication_ldap_sasl_init_pool_size
属性 值 命令行格式 --authentication-ldap-sasl-init-pool-size=#
系统变量 uthentication_ldap_sasl_init_pool_size
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 10
最低值 0
最大值 32767
对于SASL LDAP认证,是到LDAP服务器的连接池的初始大小。根据对LDAP服务器的并发身份验证请求的平均数量,选择此变量的值。
该插件将
uthentication_ldap_sasl_init_pool_size
和uthentication_ldap_sasl_max_pool_size
一起用于连接池管理:- 身份验证插件初始化时,它将创建
uthentication_ldap_sasl_init_pool_size
连接,除非uthentication_ldap_sasl_max_pool_size=0
禁用池。 - 如果当前连接池中没有空闲连接时插件接收到确认请求,则插件可以创建新连接,最大连接数为所指定
uthentication_ldap_sasl_max_pool_size
。 - 如果插件在池大小已达到最大值且没有可用连接时收到请求,则认证失败。
- 插件卸载后,它将关闭所有池连接。
更改插件系统变量设置可能不会影响池中已有的连接。例如,修改LDAP服务器主机,端口或TLS设置不会影响现有连接。但是,如果原始变量值无效并且无法初始化连接池,则插件将尝试为下一个LDAP请求重新初始化池。在这种情况下,新的系统变量值将用于重新初始化尝试。
如果
uthentication_ldap_sasl_max_pool_size=0
要禁用池,则插件打开的每个LDAP连接都使用系统变量当时具有的值。- 身份验证插件初始化时,它将创建
uthentication_ldap_sasl_log_status
属性 值 命令行格式 --authentication-ldap-sasl-log-status=#
系统变量 uthentication_ldap_sasl_log_status
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 1
最低值 1
最大值(>= 8.0.18) 6
最大值(<= 8.0.17) 5
对于SASL LDAP身份验证,写入错误日志的消息的日志记录级别。下表显示了允许的级别值及其含义。
表6.24 authentication_ldap_sasl_log_status的日志级别
期权价值 记录的消息类型 1
无讯息 2
错误讯息 3
错误和警告消息 4
错误,警告和信息消息 5
与上一级别相同,另外还有来自MySQL的调试消息 6
与上一级别相同,另外还有来自LDAP库的调试消息 日志级别6自MySQL 8.0.18起可用。
在客户端,可以通过设置
AUTHENTICATION_LDAP_CLIENT_LOG
环境变量将消息记录到标准输出中。允许的值和默认值与相同uthentication_ldap_sasl_log_status
。该
AUTHENTICATION_LDAP_CLIENT_LOG
环境变量仅适用于SASL LDAP认证。它对简单的LDAP身份验证无效,因为在这种情况下mysql_clear_password
,客户端插件为,它对LDAP操作一无所知。uthentication_ldap_sasl_max_pool_size
属性 值 命令行格式 --authentication-ldap-sasl-max-pool-size=#
系统变量 uthentication_ldap_sasl_max_pool_size
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 1000
最低值 0
最大值 32767
对于SASL LDAP身份验证,与LDAP服务器的连接池的最大大小。要禁用连接池,请将此变量设置为0。
该变量与结合使用
uthentication_ldap_sasl_init_pool_size
。请参阅该变量的描述。uthentication_ldap_sasl_server_host
属性 值 命令行格式 --authentication-ldap-sasl-server-host=host_name
系统变量 uthentication_ldap_sasl_server_host
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 对于SASL LDAP身份验证,LDAP服务器主机。此变量的允许值取决于身份验证方法:
- 对于
uthentication_ldap_sasl_auth_method_name=SCRAM-SHA-1
:LDAP服务器主机可以是主机名或IP地址。
- 对于
uthentication_ldap_sasl_server_port
属性 值 命令行格式 --authentication-ldap-sasl-server-port=port_num
系统变量 uthentication_ldap_sasl_server_port
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 389
最低值 1
最大值 32376
对于SASL LDAP认证,是LDAP服务器的TCP / IP端口号。
从MySQL 8.0.14开始,如果LDAP端口号配置为636或3269,则插件将使用LDAPS(基于SSL的LDAP)而不是LDAP。(LDAPS与有所不同
startTLS
。)uthentication_ldap_sasl_tls
属性 值 命令行格式 --authentication-ldap-sasl-tls[={OFF|ON}]
系统变量 uthentication_ldap_sasl_tls
范围 Global 动态 是 SET_VAR
提示适用没有 类型 布尔型 默认值 OFF
对于SASL LDAP身份验证,插件到LDAP服务器的连接是否安全。如果启用此变量,则插件将使用TLS安全地连接到LDAP服务器。如果启用此变量,则可能还希望设置该
uthentication_ldap_sasl_ca_path
变量。MySQL LDAP插件支持StartTLS方法,该方法在普通LDAP连接之上初始化TLS。该
ldaps
方法已被弃用,MySQL不支持该方法。uthentication_ldap_sasl_user_search_attr
属性 值 命令行格式 --authentication-ldap-sasl-user-search-attr=value
系统变量 uthentication_ldap_sasl_user_search_attr
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 uid
对于SASL LDAP认证,是在LDAP目录条目中指定用户名的属性名称。如果未提供用户专有名称,则认证插件将使用此属性搜索名称。例如,如果
uthentication_ldap_sasl_user_search_attr
值为uid
,则搜索用户名会user1
发现uid
值为的条目user1
。uthentication_ldap_simple_auth_method_name
属性 值 命令行格式 --authentication-ldap-simple-auth-method-name=value
系统变量 uthentication_ldap_simple_auth_method_name
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 SIMPLE
对于简单的LDAP认证,认证方法名称。身份验证插件和LDAP服务器之间的通信根据此身份验证方法进行。允许使用以下身份验证方法值:
SIMPLE
:此身份验证方法使用一个或两个LDAP绑定操作,具体取决于MySQL帐户是否命名为LDAP用户专有名称。请参阅的说明uthentication_ldap_simple_bind_root_dn
。AD-FOREST
:uthentication_ldap_simple
搜索Active Directory林中的所有域,对每个Active Directory域执行LDAP绑定,直到在某个域中找到用户为止。
注意
对于简单的LDAP身份验证,建议还设置TLS参数,以要求与LDAP服务器的通信通过安全连接进行。
uthentication_ldap_simple_bind_base_dn
属性 值 命令行格式 --authentication-ldap-simple-bind-base-dn=value
系统变量 uthentication_ldap_simple_bind_base_dn
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于简单的LDAP身份验证,使用基本专有名称(DN)。通过将变量锚定在搜索树中的某个位置(“基本”),可以使用该变量来限制搜索范围。
假设一组LDAP用户条目的成员各自具有以下形式:
uid=user_name,ou=People,dc=example,dc=com
另一组LDAP用户条目的成员每个都具有以下形式:
uid=user_name,ou=Admin,dc=example,dc=com
然后像这样搜索不同的基本DN值:
- 如果基本DN为
ou=People,dc=example,dc=com
:搜索仅在第一组中查找用户条目。 - 如果基本DN为
ou=Admin,dc=example,dc=com
:搜索仅在第二组中查找用户条目。 - 如果基本DN为
ou=dc=example,dc=com
:搜索将查找第一组或第二组中的用户条目。
通常,更具体的基本DN值可加快搜索速度,因为它们对搜索范围的限制更大。
- 如果基本DN为
uthentication_ldap_simple_bind_root_dn
属性 值 命令行格式 --authentication-ldap-simple-bind-root-dn=value
系统变量 uthentication_ldap_simple_bind_root_dn
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于简单的LDAP身份验证,请使用根专有名称(DN)。此变量与
uthentication_ldap_simple_bind_root_pwd
凭据一起使用,用于对LDAP服务器进行身份验证,以执行搜索。身份验证使用一个或两个LDAP绑定操作,具体取决于MySQL帐户是否命名LDAP用户DN:- 如果该帐户未命名用户DN:
uthentication_ldap_simple
使用uthentication_ldap_simple_bind_root_dn
和执行初始LDAP绑定uthentication_ldap_simple_bind_root_pwd
。(默认情况下,它们都为空,因此,如果未设置它们,则LDAP服务器必须允许匿名连接。)生成的绑定LDAP句柄用于根据客户端用户名搜索用户DN。uthentication_ldap_simple
使用用户DN和客户端提供的密码执行第二次绑定。 - 如果该帐户确实为用户DN命名:在这种情况下,不需要第一次绑定操作。
uthentication_ldap_simple
使用用户DN和客户端提供的密码执行单个绑定。这比MySQL帐户未指定LDAP用户DN的速度要快。
- 如果该帐户未命名用户DN:
uthentication_ldap_simple_bind_root_pwd
属性 值 命令行格式 --authentication-ldap-simple-bind-root-pwd=value
系统变量 uthentication_ldap_simple_bind_root_pwd
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于简单的LDAP认证,是根专有名称的密码。该变量与结合使用
uthentication_ldap_simple_bind_root_dn
。请参阅该变量的描述。uthentication_ldap_simple_ca_path
属性 值 命令行格式 --authentication-ldap-simple-ca-path=value
系统变量 uthentication_ldap_simple_ca_path
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 NULL
对于简单的LDAP认证,证书颁发机构文件的绝对路径。如果希望认证插件执行LDAP服务器证书的验证,请指定此文件。
注意
除了将
uthentication_ldap_simple_ca_path
变量设置为文件名之外,还必须将适当的证书颁发机构证书添加到文件中并启用uthentication_ldap_simple_tls
系统变量。uthentication_ldap_simple_group_search_attr
属性 值 命令行格式 --authentication-ldap-simple-group-search-attr=value
系统变量 uthentication_ldap_simple_group_search_attr
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 cn
对于简单的LDAP认证,是在LDAP目录条目中指定组名称的属性名称。如果
uthentication_ldap_simple_group_search_attr
其默认值为cn
,则搜索将返回该cn
值作为组名。例如,如果uid
值为的LDAP条目user1
的cn
属性为mygroup
,则搜索user1
returnmygroup
作为组名。如果组搜索属性为
isMemberOf
,则LDAP认证直接检索用户属性isMemberOf
值并将其分配为组信息。如果组搜索属性不是isMemberOf
,则LDAP身份验证将搜索用户所属的所有组。(后者是默认行为。)此行为基于如何以两种方式存储LDAP组信息:1)组条目可以具有名为memberUid
或member
带有用户名的值的属性;2)用户条目可以具有以isMemberOf
组名的值命名的属性。uthentication_ldap_simple_group_search_filter
属性 值 命令行格式 --authentication-ldap-simple-group-search-filter=value
系统变量 uthentication_ldap_simple_group_search_filter
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 (|(&(objectClass=posixGroup)(memberUid=%s))(&(objectClass=group)(member=%s)))
对于简单的LDAP身份验证,使用自定义组搜索过滤器。
搜索过滤器值可以包含
{UA}
和{UD}
表示用户名和完整用户DN的符号。例如,{UA}
被替换为用户名(例如)"admin"
,而{UD}
被替换为使用完整DN(例如)"uid=admin,ou=People,dc=example,dc=com"
。以下值是默认值,它同时支持OpenLDAP和Active Directory:(|(&(objectClass=posixGroup)(memberUid={UA})) (&(objectClass=group)(member={UD})))
在某些情况下,对于用户方案,
memberOf
是一个简单的用户属性,不包含组信息。为了提高灵活性,{GA}
可以在组搜索属性中使用可选的前缀。任何带有{GA}前缀的组属性都将被视为具有组名称的用户属性。例如,{GA}MemberOf
如果值为,则如果组值是DN,则将返回来自组DN的第一个属性值作为组名。uthentication_ldap_simple_init_pool_size
属性 值 命令行格式 --authentication-ldap-simple-init-pool-size=#
系统变量 uthentication_ldap_simple_init_pool_size
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 10
最低值 0
最大值 32767
对于简单的LDAP认证,是到LDAP服务器的连接池的初始大小。根据对LDAP服务器的并发身份验证请求的平均数量,选择此变量的值。
该插件将
uthentication_ldap_simple_init_pool_size
和uthentication_ldap_simple_max_pool_size
一起用于连接池管理:- 身份验证插件初始化时,它将创建
uthentication_ldap_simple_init_pool_size
连接,除非uthentication_ldap_simple_max_pool_size=0
禁用池。 - 如果当前连接池中没有空闲连接时插件接收到确认请求,则插件可以创建新连接,最大连接数为所指定
uthentication_ldap_simple_max_pool_size
。 - 如果插件在池大小已达到最大值且没有可用连接时收到请求,则认证失败。
- 插件卸载后,它将关闭所有池连接。
更改插件系统变量设置可能不会影响池中已有的连接。例如,修改LDAP服务器主机,端口或TLS设置不会影响现有连接。但是,如果原始变量值无效并且无法初始化连接池,则插件将尝试为下一个LDAP请求重新初始化池。在这种情况下,新的系统变量值将用于重新初始化尝试。
如果
uthentication_ldap_simple_max_pool_size=0
要禁用池,则插件打开的每个LDAP连接都使用系统变量当时具有的值。- 身份验证插件初始化时,它将创建
uthentication_ldap_simple_log_status
属性 值 命令行格式 --authentication-ldap-simple-log-status=#
系统变量 uthentication_ldap_simple_log_status
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 1
最低值 1
最大值(>= 8.0.18) 6
最大值(<= 8.0.17) 5
对于简单的LDAP身份验证,写入错误日志的消息的日志记录级别。下表显示了允许的级别值及其含义。
表6.25 authentication_ldap_simple_log_status的日志级别
期权价值 记录的消息类型 1
无讯息 2
错误讯息 3
错误和警告消息 4
错误,警告和信息消息 5
与上一级别相同,另外还有来自MySQL的调试消息 6
与上一级别相同,另外还有来自LDAP库的调试消息 日志级别6自MySQL 8.0.18起可用。
uthentication_ldap_simple_max_pool_size
属性 值 命令行格式 --authentication-ldap-simple-max-pool-size=#
系统变量 uthentication_ldap_simple_max_pool_size
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 1000
最低值 0
最大值 32767
对于简单的LDAP认证,是到LDAP服务器的连接池的最大大小。要禁用连接池,请将此变量设置为0。
该变量与结合使用
uthentication_ldap_simple_init_pool_size
。请参阅该变量的描述。uthentication_ldap_simple_server_host
属性 值 命令行格式 --authentication-ldap-simple-server-host=host_name
系统变量 uthentication_ldap_simple_server_host
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 对于简单的LDAP身份验证,LDAP服务器主机。此变量的允许值取决于身份验证方法:
- 对于
uthentication_ldap_simple_auth_method_name=SIMPLE
:LDAP服务器主机可以是主机名或IP地址。 对于
uthentication_ldap_simple_auth_method_name=AD-FOREST
。LDAP服务器主机可以是Active Directory域名。例如,对于LDAP服务器URL为ldap://example.mem.local:389
,服务器名称可以为mem.local
。Active Directory林设置可以具有多个域(LDAP服务器IP),可以使用DNS查找这些域。在Unix和类似Unix的系统上,可能需要进行一些其他设置才能为您的DNS服务器配置SRV记录,这些记录为Active Directory域指定LDAP服务器。假设您的配置具有以下属性:
- 提供有关Active Directory域信息的名称服务器具有IP地址
10.172.166.100
。 - 该LDAP服务器都有名称
ldap1.mem.local
通过ldap3.mem.local
和IP地址10.172.166.101
通过10.172.166.103
。
您希望可以使用SRV搜索发现LDAP服务器。例如,在命令行上,如下所示的命令应列出LDAP服务器:
host -t SRV _ldap._tcp.mem.local
执行DNS配置,如下所示:
添加一行以
/etc/resolv.conf
指定提供有关Active Directory域信息的名称服务器:nameserver 10.172.166.100
使用LDAP服务器的SRV记录为名称服务器配置适当的区域文件:
_ldap._tcp.mem.local. 86400 IN SRV 0 100 389 ldap1.mem.local. _ldap._tcp.mem.local. 86400 IN SRV 0 100 389 ldap2.mem.local. _ldap._tcp.mem.local. 86400 IN SRV 0 100 389 ldap3.mem.local.
/etc/hosts
如果无法解析服务器主机,则可能还需要为LDAP服务器指定IP地址。例如,将以下行添加到文件中:10.172.166.101 ldap1.mem.local 10.172.166.102 ldap2.mem.local 10.172.166.103 ldap3.mem.local
使用如上所述配置的DNS,服务器端LDAP插件可以发现LDAP服务器,并尝试在所有域中进行身份验证,直到身份验证成功或没有更多服务器为止。
Windows不需要如上所述的设置。给定LDAP服务器主机的
uthentication_ldap_simple_server_host
值,Windows LDAP库将搜索所有域并尝试进行身份验证。- 提供有关Active Directory域信息的名称服务器具有IP地址
- 对于
uthentication_ldap_simple_server_port
属性 值 命令行格式 --authentication-ldap-simple-server-port=port_num
系统变量 uthentication_ldap_simple_server_port
范围 Global 动态 是 SET_VAR
提示适用没有 类型 整数 默认值 389
最低值 1
最大值 32376
对于简单的LDAP认证,请使用LDAP服务器的TCP / IP端口号。
从MySQL 8.0.14开始,如果LDAP端口号配置为636或3269,则插件将使用LDAPS(基于SSL的LDAP)而不是LDAP。(LDAPS与有所不同
startTLS
。)uthentication_ldap_simple_tls
属性 值 命令行格式 --authentication-ldap-simple-tls[={OFF|ON}]
系统变量 uthentication_ldap_simple_tls
范围 Global 动态 是 SET_VAR
提示适用没有 类型 布尔型 默认值 OFF
对于简单的LDAP身份验证,插件到LDAP服务器的连接是否安全。如果启用此变量,则插件将使用TLS安全地连接到LDAP服务器。如果启用此变量,则可能还希望设置该
uthentication_ldap_simple_ca_path
变量。MySQL LDAP插件支持StartTLS方法,该方法在普通LDAP连接之上初始化TLS。该
ldaps
方法已被弃用,MySQL不支持该方法。uthentication_ldap_simple_user_search_attr
属性 值 命令行格式 --authentication-ldap-simple-user-search-attr=value
系统变量 uthentication_ldap_simple_user_search_attr
范围 Global 动态 是 SET_VAR
提示适用没有 类型 string 默认值 uid
对于简单的LDAP身份验证,该属性的名称指定LDAP目录条目中的用户名。如果未提供用户专有名称,则认证插件将使用此属性搜索名称。例如,如果
uthentication_ldap_simple_user_search_attr
值为uid
,则搜索用户名会user1
发现uid
值为的条目user1
。