설명
MongoDbSettings.Password에는 MongoDB 계정의 비밀번호를 기본값 없이 전달하세요. !Ref로 참조해도 파라미터의 Default에 적은 값은 템플릿에 그대로 남습니다.
잠재적 영향
이 값이 노출되면 원본 MongoDB에 연결할 수 있는 사람이 마이그레이션 계정의 권한으로 데이터를 읽을 수 있습니다.
해결 방법
직접 지정하는 비밀번호는 NoEcho: true로 가리고 로그·출력에 남기지 마세요. Secrets Manager를 쓰면 사용자 이름, 비밀번호, 서버, 포트를 생략하고 MongoDbSettings에 SecretsManagerSecretId와 SecretsManagerAccessRoleArn을 지정하세요. 노출된 비밀번호는 MongoDB에서 교체한 뒤 DMS 자격 증명을 갱신하고 연결을 시험하세요.
예시
두 예시는 admin 데이터베이스에서 기존 사용자를 인증합니다. 원본 서버와 사용자 이름을 지정하고 MasterMongoDBPassword에 현재 비밀번호를 입력하세요. 이 파라미터를 바꿔도 MongoDB 계정의 비밀번호는 변경되지 않습니다.
변경 전
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
MongoDBServer:
Type: String
ParentMasterUsername:
Type: String
MasterMongoDBPassword:
Type: String
Default: "as@3djdkDjskjs73!!"
Resources:
NewAmpApp1:
Type: AWS::DMS::Endpoint
Properties:
EngineName: mongodb
EndpointType: source
SslMode: require
MongoDbSettings:
AuthType: password
AuthSource: admin
Password: !Ref MasterMongoDBPassword
Port: 27017
ServerName: !Ref MongoDBServer
Username: !Ref ParentMasterUsername
변경 후
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
MongoDBServer:
Type: String
ParentMasterUsername:
Type: String
MasterMongoDBPassword:
Type: String
NoEcho: true
Resources:
NewAmpApp1:
Type: AWS::DMS::Endpoint
Properties:
EngineName: mongodb
EndpointType: source
SslMode: require
MongoDbSettings:
AuthType: password
AuthSource: admin
Password: !Ref MasterMongoDBPassword
Port: 27017
ServerName: !Ref MongoDBServer
Username: !Ref ParentMasterUsername