Description
For a new Simple AD directory, supply the Administrator password through a NoEcho parameter without a default. Keep it out of the template, Outputs and Metadata.
Potential impact
An exposed password in template history can let someone who can reach the directory change its users or groups.
Remediation
For an existing directory, use Directory Service ResetUserPassword to reset an exposed Administrator password. Changing the CloudFormation Password property replaces the directory.
Examples
Supply VpcId and two subnets in different Availability Zones within that VPC. For the new directory, securely provide a policy-compliant password through ParentMasterPassword.
Before
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
VpcId:
Type: AWS::EC2::VPC::Id
DirectorySubnets:
Type: List<AWS::EC2::Subnet::Id>
Resources:
NewAmpApp1:
Type: AWS::DirectoryService::SimpleAD
Properties:
Name: corp.example.com
Password: "asDjskjs73!!"
ShortName: CORP
Size: Small
VpcSettings:
VpcId: !Ref VpcId
SubnetIds: !Ref DirectorySubnets
After
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ParentMasterPassword:
Type: String
NoEcho: true
MinLength: 8
MaxLength: 64
VpcId:
Type: AWS::EC2::VPC::Id
DirectorySubnets:
Type: List<AWS::EC2::Subnet::Id>
Resources:
NewAmpApp1:
Type: AWS::DirectoryService::SimpleAD
Properties:
Name: corp.example.com
Password: !Ref ParentMasterPassword
ShortName: CORP
Size: Small
VpcSettings:
VpcId: !Ref VpcId
SubnetIds: !Ref DirectorySubnets