GSLルールの例

これらのデフォルトのセキュリティグループ(削除できない)には、ルールを含める必要はありません。
SecurityGroup where name='default'should have inboundRules.length=0 and outboundRules.length=0
デフォルトのセキュリティグループを破棄するセキュリティグループの場合と同じです(削除できません)。
SecurityGroup where not name='default'should have vpc
セキュリティグループに参照セキュリティグループがあるかどうかを確認します。
SecurityGroup should have inboundRules with [scope like '%sg%'] or outboundRules with [scope like '%sg%']
セキュリティグループが空で、参照するセキュリティグループがあるかどうかを確認します。
SecurityGroup where name != 'default' should not have networkAssetsStats contain-all [count = 0] and (inboundRules with [scope like '%sg%'] or outboundRules with [scope like '%sg%'])

すべてのインスタンスが EC2 classic ではなく VPC 内で実行されていることを確認します。
Instance should have vpc
サポート対象リージョンでのみ実行
Instance should have region in ('us_west_2','us_east_1')
配カラム/コレクションの長さを問い合わせます。
Instance where nics.length>1 should have tags contain[key='router']
ここでは、nics のいずれかでpublicIpAddress プロパティの存在をテストし、inboundRules のポートとスコープの両方に対して複雑な一致を作成します。
isPublicCIDR()
は、このスコープがパブリックIP/CIDR かどうかを判断するための内部機能であることを注します。Instance where nics contains[publicIpAddress] should not have inboundRules with[port=22 and scope isPublicCIDR()]
承認された値のリストに対してプロパティを照合する方法を表示する
Instance where platform='linux' should have image in ('ami-05355a6c','ami-12345')
類似であるが、少し複雑であり、ここでは、タグのうちの少なくとも1つは、その条件を満たすべきである
Instance should have tags with [key in ('owner', 'Application', 'application', 'app', 'ApprovedBy')]
before() とafter() は、過去の事象を指定するために負の数字を受け取るべきであることを注します。
Instance where launchTime before(-3,'months') should have tags with [key='ApprovedBy']

バケットポリシーがすべてのアップロードがサーバ側で暗号化されているかどうかを示します。
S3Bucket should have policy.Statement contain [Effect='Deny' and (Action='s3:PutObject' and Condition.Null.s3:x-amz-server-side-encryption='true')])
S3 バケットがパブリックにアクセスできないことを確認します。特定の送信元IP を許可する条件がないことを確認します。
S3Bucket should not have (acl.grants contain [uri like http://acs.amazonaws.com/groups/global or policy.Statement contain [Effect='Allow' and (Principal='*' or Principal.AWS='*') and not Condition.IpAddress.aws:SourceIp])
特定の IAM ポリシーが適用されていることを確認します。たとえば、SSL のみのアクセスを強制する IAM ポリシーが S3 バケットに適用されていることを確認します。
実施するIAMポリシー:
{ "Sid": "SSLOnlyAccess", "Effect": "Deny", "Principal": { "AWS": "*" }, "Action": "s3:*", "Condition": { "Bool": { "aws:SecureTransport": false } }, "Resource": "arn:aws:s3:::mys3/*" }
ルール構文:
S3Bucket should have policy.Statement contain [Sid = 'SSLOnlyAccess' and Effect='Deny' and Action = 's3:*' and Principal.AWS = '*' and Condition.Bool.aws:SecureTransport = 'false']
S3 バケットをパブリックに公開せず、特定のソース IP または VPC のアクセス条件を許可するようにします。
S3Bucket should not have ( acl.grants contain [uri like http://acs.amazonaws.com/groups/global/] or policy.Statement contain [Effect='Allow' and (Principal='*' or Principal.AWS='*') and not (Condition.StringEquals.aws:sourceVpce = '<vpc-id>' or Condition.IpAddress.aws:SourceIp = '1.2.3.4/32' ) ])
このルールは、「allow」のポリシーステートメントを持ち、AWS ARNにARNに「s3:*」が含まれているS3バケット、またはプリンシパルに「*」が含まれているS3バケットでは失敗します。
S3Bucket should not have policy.Statement contain [Effect='Allow' and (Principal.AWS contain [$ regexMatch /s3:\*/i] or Principal='*')]

特定の IAM ロールに特定の IAM ポリシー、エフェクト、指定されたアクションの少なくとも 1 つがあるかどうかを確認します。
action 節の違いを確認します。この例では、テストがアクションの一覧を確認するため、"
Action contain
" を使用します。IamRole should have combinedPolicies contain[id='arn:aws:iam::<ID>:policy/PowerUsers' and policyDocument.Statement contain [Effect='Deny' and Action contain ['iam:\*'] ] ]
このルールは、AWS IAM ポリシーが SourceIp を使用する (MFA が有効になっている) ことをアサートします。
IamPolicy where document.Statement contain [(Effect='Allow' and Action='sts:AssumeRole')] should have document.Statement contain [Condition.ForAnyValue:IpAddress.aws:SourceIp contain-all [ $ in ('123.22.91.00/24', '123.22.92.00/24' )] and Condition.BoolIfExists.aws:MultiFactorAuthPresent='true' ]

特定のCVE (Meltdown およびSpectre プロセッサの脆弱性) をチェックします。
Instance should not have scanners.findings contain [ ruleId in ( 'CVE-2017-5754','CVE-2017-5753', 'CVE-2017-5715') ]
過去7日間にインスペクタスキャンが完了したことを確認します。
Instance should have scanners.scans contain [source = 'Inspector' and startTime after(-7, 'days') and state in ('COMPLETED', 'COMPLETED_WITH_ERRORS') ]
インスタンスに重大度の高い結果が含まれていないことを確認します。
Instance should not have scanners.findings contain-any [ruleSeverity='High']

ELB に単純な名前またはタグがないことを確認する
ELB where not (name like '%FOO%' or name like '%BAR%') or tags with [value like '%we%'] should not have isPublicCIDR=true