AWS WAF セキュリティオートメーションソリューション2.2.0

記事タイトルとURLをコピーする

AWS WAF セキュリティオートメーションソリューションという簡単にAWS WAFを導入できるCloudFormationテンプレートがありますが、気がついたらバージョンアップしてました。

調べてみると、確かに日本語でも情報でていますね。
AWS WAF セキュリティオートメーションソリューションにモニタリングダッシュボードが導入されました

2019年1月29日現在で、バージョン2.2.0の環境が作成されます。
GitHubを見ると、やはり2018年12月末に2.2.0になったことが確認できます。
https://github.com/awslabs/aws-waf-security-automations

以下で従来バージョンとの違いをみていきます。

モニタリングダッシュボードの追加

日本語情報にある通りなんですが、CloudWatchにダッシュボードが追加されました。
BlockRequestsとAllowedRequestsが確認できます。
(上記画像は実際にまだアクセスが無いのでカウントされていません。)

ALB用とCloudFront用のテンプレートが1つに統合

以前はCloudFront用とALB用でCloudFormationテンプレートが分かれていたのですが、1つになりました。
これを使えばOKです。
https://s3.amazonaws.com/solutions-reference/aws-waf-security-automations/latest/aws-waf-security-automations.template

とはいえ、実際に試してみると、内部的にはCloudFormationのネスト機能で、2つのテンプレートを1つにまとめているようです。

AlbStackとCloudFrontStackがあり、別のところからファイルを取ってくる仕様になってました。

Resources:
  AlbStack:
    Type: 'AWS::CloudFormation::Stack'
    Condition: AlbEndpoint
    Properties:
      TemplateURL: !Join
        - '/'
        - - 'https://s3.amazonaws.com'
          - !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], !Ref 'AWS::Region']]
          - !FindInMap ["SourceCode", "General", "KeyPrefix"]
          - 'aws-waf-security-automations-alb.template'
      Parameters:
        SqlInjectionProtectionParam: !Ref SqlInjectionProtectionParam
        CrossSiteScriptingProtectionParam: !Ref CrossSiteScriptingProtectionParam
        ActivateHttpFloodProtectionParam: !Ref ActivateHttpFloodProtectionParam
        ActivateScannersProbesProtectionParam: !Ref ActivateScannersProbesProtectionParam
        ActivateReputationListsProtectionParam: !Ref ActivateReputationListsProtectionParam
        ActivateBadBotProtectionParam: !Ref ActivateBadBotProtectionParam
        AccessLogBucket: !Ref AccessLogBucket
        WafApiType: 'waf-regional'
        WafArnPrefix: !Join ['', ['arn:aws:waf-regional:', !Ref 'AWS::Region',':']]
        ParentStackName: !Ref 'AWS::StackName'

  CloudFrontStack:
    Type: 'AWS::CloudFormation::Stack'
    Condition: CloudFrontEndpoint
    Properties:
      TemplateURL: !Join
        - '/'
        - - 'https://s3.amazonaws.com'
          - !Join ["-", [!FindInMap ["SourceCode", "General", "S3Bucket"], !Ref 'AWS::Region']]
          - !FindInMap ["SourceCode", "General", "KeyPrefix"]
          - 'aws-waf-security-automations-cloudfront.template'
      Parameters:
        SqlInjectionProtectionParam: !Ref SqlInjectionProtectionParam
        CrossSiteScriptingProtectionParam: !Ref CrossSiteScriptingProtectionParam
        ActivateHttpFloodProtectionParam: !Ref ActivateHttpFloodProtectionParam
        ActivateScannersProbesProtectionParam: !Ref ActivateScannersProbesProtectionParam
        ActivateReputationListsProtectionParam: !Ref ActivateReputationListsProtectionParam
        ActivateBadBotProtectionParam: !Ref ActivateBadBotProtectionParam
        AccessLogBucket: !Ref AccessLogBucket
        WafApiType: 'waf'
        WafArnPrefix: 'arn:aws:waf::'
        ParentStackName: !Ref 'AWS::StackName'

設定画面

Endpoint Type だけ追加ですね。
CloudFrontかALBが選択できます。
(ALBを選択すればAPI Gatewayでも動かせると思いますが、まだ試していないです。)

WebACLの中身

v2.1 v2.2.0
Whitelist Rule Whitelist Rule
Blacklist Rule Blacklist Rule
Http Flood Rule Http Flood Rule
Scans Probes Rule Scanners & Probes Rule
WAF IP Reputation Lists Rule #1 WAF IP Reputation Lists Rule
WAF IP Reputation Lists Rule #2  
Bad Bot Rule Bad Bot Rule
SQL Injection Rule SQL Injection Rule
XSS Rule XSS Rule

全体的にリソース名にランダム値がつくようになってしまったのですが、それを除外したルール名を上記に記載しました。
v2.1では9つあったルールが、v2.2.0では8つになりました。
一つのWebACLには10のルールしかつけられないという制限があるので、ユーザー独自のルールやマネージメントルールを追加しやすいように少し余裕を持たせたのかもしれません。

その他は基本的には変わっていませんでした。
(もしかしたらLambda Functionの中身などは変わっているかもしれません。)

まとめ

セキュリティオートメーション のテンプレートは、更新されないと思っていたのですが、時々更新されるようです。

渡辺 信秀(記事一覧)

2017年入社 / 地味な内容を丁寧に書きたい