Directory Service Simple AD の平文パスワード

Simple AD の管理者パスワードをテンプレートやパラメータの既定値に保存しないでください。

説明

新しい Simple AD ディレクトリの Administrator パスワードは、既定値のない NoEcho パラメータで渡します。テンプレート、Outputs、Metadata に値を残さないでください。

想定される影響

履歴から漏えいしたパスワードを使うと、ディレクトリへの接続元からユーザーやグループを変更できるおそれがあります。

対処方法

既存のディレクトリでは、Directory Service の ResetUserPassword で漏えいした Administrator のパスワードをリセットします。CloudFormation の Password プロパティを変更するとディレクトリが置き換わります。

例

VpcId と、その VPC 内の別々のアベイラビリティーゾーンにある 2 つのサブネットを指定します。作成時にはポリシーを満たすパスワードを ParentMasterPassword で安全に渡してください。

変更前

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

変更後

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

参考資料