기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
RabbitMQ용 Amazon MQ에 LDAP 인증 및 권한 부여 사용
이 자습서에서는를 사용하여 RabbitMQ용 Amazon MQ 브로커에 대한 LDAP 인증 및 권한 부여를 구성하는 방법을 설명합니다 AWS Managed Microsoft AD.
LDAP 인증 및 권한 부여를 구성하기 위한 사전 조건
RabbitMQ LDAP 통합용 Amazon MQ용 CDK 스택을 배포하여이 자습서에 필요한 AWS 리소스를 설정할 수 있습니다. AWS Amazon MQ RabbitMQ AWS Managed Microsoft AD
이 CDK 스택은 LDAP 사용자 및 그룹 AWS Managed Microsoft AD, Network Load Balancer, 인증서 및 IAM 역할을 포함하여 필요한 모든 AWS 리소스를 자동으로 생성합니다. 스택에서 생성한 리소스의 전체 목록은 패키지 README를 참조하세요.
CDK 스택을 사용하는 대신 리소스를 수동으로 설정하는 경우 RabbitMQ용 Amazon MQ 브로커에 LDAP를 구성하기 전에 동등한 인프라가 있는지 확인합니다.
Amazon MQ를 설정하기 위한 사전 조건
AWS CLI 버전 >= 2.28.23: 브로커 생성 중에 사용자 이름과 암호를 선택적으로 추가할 수 있습니다.
AWS CLI를 사용하여 RabbitMQ에서 LDAP 구성
이 절차에서는 AWS CLI를 사용하여 필요한 리소스를 생성하고 구성합니다. 다음 절차에서는 configurationID 및 개정, <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" } -
다음 예제와 같이 라는 구성 파일을 생성
rabbitmq.conf하여 LDAP를 인증 및 권한 부여 방법으로 사용합니다. 템플릿의 모든 자리 표시자 값(로 표시됨${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 스택에서 생성한 테스트 사용자 중 하나를 사용하여 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"}'