説明
DocumentDB クラスターの MasterUserPassword は既定値のない NoEcho パラメータで渡します。Secrets Manager に管理させる場合は MasterUserPassword を省略し、ManageMasterUserPassword を有効にしてください。
想定される影響
マスターパスワードが漏えいすると、クラスターに接続できる人にデータを読み取り、変更、削除されるおそれがあります。
対処方法
漏えいした値はクラスター側で変更し、利用するアプリケーションにも新しい値を反映して接続を確認します。ログや出力には残さないでください。
例
例は新規クラスター用です。既存のサブネットグループと対応するエンジンバージョンを指定し、DB インスタンスとアクセス規則は別途設定します。ParentMasterPassword は /、"、@ を除く印字可能な ASCII 文字 8~100 文字で指定してください。
変更前
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DBSubnetGroupName:
Type: String
EngineVersion:
Type: String
Resources:
NewAmpApp:
Type: AWS::DocDB::DBCluster
Properties:
BackupRetentionPeriod: 8
DBClusterIdentifier: sample-cluster
DBSubnetGroupName: !Ref DBSubnetGroupName
EngineVersion: !Ref EngineVersion
DeletionProtection: true
MasterUsername: docdbadmin
MasterUserPassword: "asDjskjs73!!"
Port: 27017
PreferredBackupWindow: 07:34-08:04
PreferredMaintenanceWindow: sat:04:51-sat:05:21
StorageEncrypted: true
変更後
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ParentMasterPassword:
Type: String
NoEcho: true
MinLength: 8
MaxLength: 100
DBSubnetGroupName:
Type: String
EngineVersion:
Type: String
Resources:
NewAmpApp:
Type: AWS::DocDB::DBCluster
Properties:
BackupRetentionPeriod: 8
DBClusterIdentifier: sample-cluster
DBSubnetGroupName: !Ref DBSubnetGroupName
EngineVersion: !Ref EngineVersion
DeletionProtection: true
MasterUsername: docdbadmin
MasterUserPassword: !Ref ParentMasterPassword
Port: 27017
PreferredBackupWindow: 07:34-08:04
PreferredMaintenanceWindow: sat:04:51-sat:05:21
StorageEncrypted: true