翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
Amazon MQ for RabbitMQ での LDAP 認証と認可の使用
このチュートリアルでは、 を使用して Amazon MQ for RabbitMQ ブローカーの LDAP 認証と認可を設定する方法について説明します AWS Managed Microsoft AD。
LDAP 認証と認可を設定するための前提条件
このチュートリアルで必要な AWS リソースを設定するには、AWS Amazon MQ for RabbitMQ LDAP 統合用の CDK スタックを と AWS Managed Microsoft AD
この CDK スタックは、LDAP ユーザーとグループ AWS Managed Microsoft AD、Network Load Balancer、証明書、IAM ロールなど、必要なすべての AWS リソースを自動的に作成します。スタックによって作成されたリソースの完全なリストについては、パッケージ README を参照してください。
CDK スタックを使用する代わりにリソースを手動で設定する場合は、Amazon MQ for RabbitMQ ブローカーで LDAP を設定する前に、同等のインフラストラクチャが整っていることを確認してください。
Amazon MQ をセットアップするための前提条件
AWS CLI バージョン >= 2.28.23。ブローカーの作成時にユーザー名とパスワードをオプションで追加します。
CLI を使用した RabbitMQ での LDAP AWS の設定
この手順では、 CLI AWS を使用して必要なリソースを作成および設定します。次の手順では、configurationID や Revision、 <c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca> などのプレースホルダー値を実際の値に置き換え<2>てください。
-
次の例に示すように、
create-configurationAWS CLI コマンドを使用して新しい設定を作成します。aws mq create-configuration \ --name "rabbitmq-ldap-config" \ --engine-type "RABBITMQ" \ --engine-version "3.13"このコマンドでは、次の例のようなレスポンスが返されます。
{ "Arn": "arn:aws:mq:us-west-2:123456789012:configuration:c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "AuthenticationStrategy": "simple", "Created": "2025-07-17T16:03:01.759943+00:00", "Id": "c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "LatestRevision": { "Created": "2025-07-17T16:03:01.759000+00:00", "Description": "Auto-generated default for rabbitmq-ldap-config on RabbitMQ 3.13", "Revision": 1 }, "Name": "rabbitmq-ldap-config" } -
次の例に示すように、LDAP
rabbitmq.confを認証および認可方法として使用する という設定ファイルを作成します。テンプレート内のすべてのプレースホルダー値 ( でマーク) を${RabbitMqLdapTestStack.*}、デプロイされた AWS CDK 前提条件スタック出力または同等のインフラストラクチャの実際の値に置き換えます。auth_backends.1 = ldap # LDAP authentication settings - For more information, # see https://www.rabbitmq.com/docs/ldap#basic # FIXME: Replace the ${RabbitMqLdapTestStack.*} placeholders with actual values # from your deployed prerequisite CDK stack outputs. auth_ldap.servers.1 = ${RabbitMqLdapTestStack.NlbDnsName} auth_ldap.dn_lookup_bind.user_dn = ${RabbitMqLdapTestStack.DnLookupUserDn} auth_ldap.dn_lookup_base = ${RabbitMqLdapTestStack.DnLookupBase} auth_ldap.dn_lookup_attribute = ${RabbitMqLdapTestStack.DnLookupAttribute} auth_ldap.port = 636 auth_ldap.use_ssl = true auth_ldap.ssl_options.verify = verify_peer auth_ldap.log = network # AWS integration for secure credential retrieval # - see: https://github.com/amazon-mq/rabbitmq-aws # The aws plugin allows RabbitMQ to securely retrieve credentials and certificates # from AWS services. # Replace the ${RabbitMqLdapTestStack.*} placeholders with actual ARN values # from your deployed prerequisite CDK stack outputs. aws.arns.auth_ldap.ssl_options.cacertfile = ${RabbitMqLdapTestStack.CaCertArn} aws.arns.auth_ldap.dn_lookup_bind.password = ${RabbitMqLdapTestStack.DnLookupUserPasswordArn} aws.arns.assume_role_arn = ${RabbitMqLdapTestStack.AmazonMqAssumeRoleArn} # LDAP authorization queries - For more information, # see: https://www.rabbitmq.com/docs/ldap#authorisation # FIXME: Replace the ${RabbitMqLdapTestStack.*} placeholders with actual group DN # values from your deployed prerequisite CDK stack outputs # Uses Active Directory groups created by the prerequisite CDK stack auth_ldap.queries.tags = ''' [{administrator, {in_group, "${RabbitMqLdapTestStack.RabbitMqAdministratorsGroupDn}"}}, {management, {in_group, "${RabbitMqLdapTestStack.RabbitMqMonitoringUsersGroupDn}"}}] ''' # FIXME: This provides all authenticated users access to all vhosts # - update to restrict access as required auth_ldap.queries.vhost_access = ''' {constant, true} ''' # FIXME: This provides all authenticated users full access to all # queues and exchanges - update to restrict access as required auth_ldap.queries.resource_access = ''' {for, [ {permission, configure, {constant, true}}, {permission, write, {for, [{resource, queue, {constant, true}}, {resource, exchange, {constant, true}}]}}, {permission, read, {for, [{resource, exchange, {constant, true}}, {resource, queue, {constant, true}}]}} ] } ''' # FIXME: This provides all authenticated users access to all topics # - update to restrict access as required auth_ldap.queries.topic_access = ''' {for, [{permission, write, {constant, true}}, {permission, read, {constant, true}} ] } ''' -
次の例に示すように、
update-configurationAWS CLI コマンドを使用して設定を更新します。このコマンドでは、この手順のステップ 1 のレスポンスで受け取った設定 ID を追加します。例えば、c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca。aws mq update-configuration \ --configuration-id "<c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca>" \ --data "$(cat rabbitmq.conf | base64 --wrap=0)"このコマンドでは、次の例のようなレスポンスが返されます。
{ "Arn": "arn:aws:mq:us-west-2:123456789012:configuration:c-b600ac8e-8183-4f74-a713-983e59f30e3d", "Created": "2025-07-17T16:57:04.520931+00:00", "Id": "c-b600ac8e-8183-4f74-a713-983e59f30e3d", "LatestRevision": { "Created": "2025-07-17T16:57:39.172000+00:00", "Revision": 2 }, "Name": "rabbitmq-ldap-config", "Warnings": [] } -
この手順のステップ 2 で作成した LDAP 設定を使用してブローカーを作成します。これを行うには、次の例に示すように
create-brokerAWS CLI コマンドを使用します。このコマンドでは、ステップ 1 と 2 のレスポンスで取得した設定 ID とリビジョン番号をそれぞれ指定します。例えば、c-fa3390a5-7e01-4559-ae0c-eb15b38b22caと2です。aws mq create-broker \ --broker-name "rabbitmq-ldap-test-1" \ --engine-type "RABBITMQ" \ --engine-version "3.13" \ --host-instance-type "mq.m7g.large" \ --deployment-mode "CLUSTER_MULTI_AZ" \ --logs '{"General": true}' \ --publicly-accessible \ --configuration '{"Id": "<c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca>","Revision": <2>}'このコマンドでは、次の例のようなレスポンスが返されます。
{ "BrokerArn": "arn:aws:mq:us-west-2:123456789012:broker:rabbitmq-ldap-broker:b-2a1b5133-a10c-49d2-879b-8c176c34cf73", "BrokerId": "b-2a1b5133-a10c-49d2-879b-8c176c34cf73" }ブローカーの命名制限
前提条件の CDK スタックによって作成された IAM ロールは、ブローカー名を で始まるように制限します
rabbitmq-ldap-test。ブローカー名がこのパターンに従っているか、IAM ロールに ARN 解決のためにロールを引き受けるアクセス許可がないことを確認します。 -
次の例に示すように
describe-brokerAWS CLI コマンドを使用してRUNNING、ブローカーのステータスが からCREATION_IN_PROGRESSに移行していることを確認します。このコマンドでは、前のステップの結果で取得したブローカー ID を指定します (例:b-2a1b5133-a10c-49d2-879b-8c176c34cf73)。aws mq describe-broker \ --broker-id "<b-2a1b5133-a10c-49d2-879b-8c176c34cf73>"このコマンドでは、次の例のようなレスポンスが返されます。次のレスポンスは、
describe-brokerコマンドが返す完全な出力の省略バージョンです。このレスポンスは、ブローカーのステータスと、ブローカーの保護に使用される認証戦略を示します。この場合、config_managed認証戦略はブローカーが LDAP 認証方法を使用していることを示します。{ "AuthenticationStrategy": "config_managed", ..., "BrokerState": "RUNNING", ... } -
前提条件の CDK スタックによって作成されたテストユーザーの 1 人を使用して RabbitMQ アクセスを検証する
# FIXME: Replace ${RabbitMqLdapTestStack.ConsoleUserPasswordArn} with the actual ARN from your deployed prerequisite CDK stack outputs CONSOLE_PASSWORD=$(aws secretsmanager get-secret-value \ --secret-id ${RabbitMqLdapTestStack.ConsoleUserPasswordArn} \ --query 'SecretString' --output text) # FIXME: Replace BrokerConsoleURL with the actual ConsoleURL retrieved by # calling describe-broker for the broker created above # Call management API /api/overview (should succeed) curl -u RabbitMqConsoleUser:$CONSOLE_PASSWORD \ https://${BrokerConsoleURL}/api/overview # Try to create a user (should fail - console user only has monitoring permissions) curl -u RabbitMqConsoleUser:$CONSOLE_PASSWORD \ -X PUT https://${BrokerConsoleURL}/api/users/testuser \ -H "Content-Type: application/json" \ -d '{"password":"testpass","tags":"management"}'