如何使用 LDAP 为 AD 组配置 RabbitMQ?
How to configure RabbitMQ with LDAP for AD Groups?
我已经设法使用 LDAP 配置 RabbitMQ 并对其进行身份验证,如果它是针对单个 AD 帐户的话。我正在使用以下配置:
RabbitMQ 配置文件:
auth_backends,[{rabbit_auth_backend_ldap, rabbit_auth_backend_internal},rabbit_auth_backend_internal]
在 RabbitMQ 管理中,我手动创建了一个没有设置密码的用户名(有效)。但是,假设我有一个 AD 组(称为“Rabbit 用户组”),其中有 3 个用户(User1、User2、User3)。
“兔子用户组”的位置在:
sample.companyname.com > City Name (OU) > Groups (OU) > IT Groups (OU) > "Rabbit User Group" (Security Group)
我应该如何在 RabbitMQ 管理和配置文件中配置它,以便在我更新特定组后,该组内的所有成员都能够进行身份验证并拥有相同的权限(例如,只有这个组有管理员权限)在 RabbitMQ 中?
我想避免在 RabbitMQ 管理中手动创建每个单独的用户进行身份验证?
我已将以下内容添加到我的 RabbitMQ 配置文件中
{
tag_queries, [
{administrator,{in_group,'CN="Rabbit User Group",OU="City Name", OU=Groups, OU="IT Group",DC=sample,DC=companyname,DC=com',"uniqueMember"}},
{management, {constant, true}}
]
}
并尝试在没有密码的情况下在 RabbitMQ 管理中创建一个名为“Rabbit User Group”的用户名。但是当我尝试以“User1”身份登录时,我无法登录。
这是我的整体配置文件:
[
{
rabbit,
[
{
auth_backends,[{rabbit_auth_backend_ldap, rabbit_auth_backend_internal},rabbit_auth_backend_internal]
}
]
},
{
rabbitmq_auth_backend_ldap,
[
{servers, ["sample.companyname.com","192.168.63.123"]},
{dn_lookup_attribute, "userPrincipalName"},
{dn_lookup_base, "DC=AS,DC=companyname,DC=com"},
{user_dn_pattern, "${username}@as.companyname.com"},
{use_ssl, false},
{port, 636},
{log, true},
{
tag_queries, [
{administrator,{in_group,'CN="Rabbit User Group",OU="City Name", OU=Groups, OU="IT Group",DC=sample,DC=companyname,DC=com',"uniqueMember"}},
{management, {constant, true}}
]
}
]%% rabbitmq_auth_backend_ldap,
}
].
您需要将“dn_lookup_attribute”设置为 distinguishedName (DN) 而不是 userPrincipalName / sAMAccountName,这样它将使用此用户的 DN 在 in_group 中进行成员检查。如下图:
{dn_lookup_attribute, "distinguishedName"},
{user_dn_pattern, "CN=${username},OU=Users,DC=sample,DC=companyname,DC=com"},
而不是:
{dn_lookup_attribute, "userPrincipalName"},
{user_dn_pattern, "${username}@as.companyname.com"},
Microsoft Active Directory 和 OpenLDAP 是不同的 LDAP 服务风格,并且具有不同的组用户列表属性。用户列表的 Microsoft Active Directory 组称为“成员”,而 OpenLDAP 组称为“uniqueMember”。
整体配置文件:
[
{
rabbit,
[
{
auth_backends, [rabbit_auth_backend_ldap, rabbit_auth_backend_internal]
}
]
},
{
rabbitmq_auth_backend_ldap,
[
{servers, ["sample.companyname.com","192.168.63.123"]},
{dn_lookup_attribute, "distinguishedName"},
{dn_lookup_base, "DC=AS,DC=companyname,DC=com"},
{user_dn_pattern, "CN=${username},OU=Users,DC=sample,DC=companyname,DC=com"},
{use_ssl, false},
{port, 636},
{log, true},
{
tag_queries, [
{administrator,{in_group,"CN=Rabbit User Group,OU=City Name, OU=Groups, OU=IT Group,DC=sample,DC=companyname,DC=com","member"}},
{management, {constant, true}}
]
}
]%% rabbitmq_auth_backend_ldap,
}
].
我已经设法使用 LDAP 配置 RabbitMQ 并对其进行身份验证,如果它是针对单个 AD 帐户的话。我正在使用以下配置:
RabbitMQ 配置文件:
auth_backends,[{rabbit_auth_backend_ldap, rabbit_auth_backend_internal},rabbit_auth_backend_internal]
在 RabbitMQ 管理中,我手动创建了一个没有设置密码的用户名(有效)。但是,假设我有一个 AD 组(称为“Rabbit 用户组”),其中有 3 个用户(User1、User2、User3)。
“兔子用户组”的位置在:
sample.companyname.com > City Name (OU) > Groups (OU) > IT Groups (OU) > "Rabbit User Group" (Security Group)
我应该如何在 RabbitMQ 管理和配置文件中配置它,以便在我更新特定组后,该组内的所有成员都能够进行身份验证并拥有相同的权限(例如,只有这个组有管理员权限)在 RabbitMQ 中?
我想避免在 RabbitMQ 管理中手动创建每个单独的用户进行身份验证?
我已将以下内容添加到我的 RabbitMQ 配置文件中
{
tag_queries, [
{administrator,{in_group,'CN="Rabbit User Group",OU="City Name", OU=Groups, OU="IT Group",DC=sample,DC=companyname,DC=com',"uniqueMember"}},
{management, {constant, true}}
]
}
并尝试在没有密码的情况下在 RabbitMQ 管理中创建一个名为“Rabbit User Group”的用户名。但是当我尝试以“User1”身份登录时,我无法登录。
这是我的整体配置文件:
[
{
rabbit,
[
{
auth_backends,[{rabbit_auth_backend_ldap, rabbit_auth_backend_internal},rabbit_auth_backend_internal]
}
]
},
{
rabbitmq_auth_backend_ldap,
[
{servers, ["sample.companyname.com","192.168.63.123"]},
{dn_lookup_attribute, "userPrincipalName"},
{dn_lookup_base, "DC=AS,DC=companyname,DC=com"},
{user_dn_pattern, "${username}@as.companyname.com"},
{use_ssl, false},
{port, 636},
{log, true},
{
tag_queries, [
{administrator,{in_group,'CN="Rabbit User Group",OU="City Name", OU=Groups, OU="IT Group",DC=sample,DC=companyname,DC=com',"uniqueMember"}},
{management, {constant, true}}
]
}
]%% rabbitmq_auth_backend_ldap,
}
].
您需要将“dn_lookup_attribute”设置为 distinguishedName (DN) 而不是 userPrincipalName / sAMAccountName,这样它将使用此用户的 DN 在 in_group 中进行成员检查。如下图:
{dn_lookup_attribute, "distinguishedName"},
{user_dn_pattern, "CN=${username},OU=Users,DC=sample,DC=companyname,DC=com"},
而不是:
{dn_lookup_attribute, "userPrincipalName"},
{user_dn_pattern, "${username}@as.companyname.com"},
Microsoft Active Directory 和 OpenLDAP 是不同的 LDAP 服务风格,并且具有不同的组用户列表属性。用户列表的 Microsoft Active Directory 组称为“成员”,而 OpenLDAP 组称为“uniqueMember”。
整体配置文件:
[
{
rabbit,
[
{
auth_backends, [rabbit_auth_backend_ldap, rabbit_auth_backend_internal]
}
]
},
{
rabbitmq_auth_backend_ldap,
[
{servers, ["sample.companyname.com","192.168.63.123"]},
{dn_lookup_attribute, "distinguishedName"},
{dn_lookup_base, "DC=AS,DC=companyname,DC=com"},
{user_dn_pattern, "CN=${username},OU=Users,DC=sample,DC=companyname,DC=com"},
{use_ssl, false},
{port, 636},
{log, true},
{
tag_queries, [
{administrator,{in_group,"CN=Rabbit User Group,OU=City Name, OU=Groups, OU=IT Group,DC=sample,DC=companyname,DC=com","member"}},
{management, {constant, true}}
]
}
]%% rabbitmq_auth_backend_ldap,
}
].