0
0

More than 1 year has passed since last update.

AWS CloudFormation S3バケットでSSL/TLSアクセス強制

Posted at

S3バケットに対して、より安全にアクセスしたい。

  • SSL/TLSアクセスを強制したい
    • S3には、HTTPSのみならずHTTPのエンドポイントも存在する
  • TLSv1.2以降を強制したい

CloudFormation例

当たり前ではあるが、ダメなものをとにかく弾けばOK。

# ...略...
Resources:
  MyS3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      # ...略...

  MyS3BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref MyS3Bucket
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Deny
            Principal: '*'
            Action: 's3:*'
            Resource:
              - !GetAtt MyS3Bucket.Arn
              - !Sub ${MyS3Bucket.Arn}/*
            Condition:
              Bool:
                'aws:SecureTransport': 'false'
          - Effect: Deny
            Principal: '*'
            Action: 's3:*'
            Resource:
              - !GetAtt MyS3Bucket.Arn
              - !Sub ${MyS3Bucket.Arn}/*
            Condition:
              NumericLessThan:
                's3:TlsVersion': '1.2'
# ...略...
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0