-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/forced_containerd_version
- Loading branch information
Showing
83 changed files
with
1,039 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ jobs: | |
with: | ||
go-version: 1.17 | ||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected].0 | ||
uses: goreleaser/[email protected].1 | ||
with: | ||
version: v0.160.0 | ||
args: release --rm-dist --snapshot --skip-validate --config="./.goreleaser-apispec.yml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ jobs: | |
with: | ||
go-version: 1.17 | ||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected].0 | ||
uses: goreleaser/[email protected].1 | ||
with: | ||
version: v0.160.0 | ||
args: release --rm-dist --snapshot --skip-validate --config="./.goreleaser-nightly.yml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ jobs: | |
with: | ||
go-version: 1.17 | ||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected].0 | ||
uses: goreleaser/[email protected].1 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
assets/queries/ansible/aws/db_security_group_has_public_ip/query.rego
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
assets/queries/ansible/aws/db_security_group_has_public_ip/test/positive.yaml
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...ts/queries/ansible/aws/db_security_group_has_public_ip/test/positive_expected_result.json
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...ecurity_group_has_public_ip/metadata.json → ..._group_has_public_interface/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
assets/queries/ansible/aws/ec2_group_has_public_interface/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package Cx | ||
|
||
import data.generic.ansible as ans_lib | ||
import data.generic.common as common_lib | ||
|
||
modules := {"amazon.aws.ec2_group", "ec2_group"} | ||
|
||
CxPolicy[result] { | ||
task := ans_lib.tasks[id][t] | ||
ec2_instance = task[modules[m]] | ||
ans_lib.checkState(ec2_instance) | ||
|
||
rule := ec2_instance.rules[idx] | ||
|
||
cidrs := {"cidr_ip": "0.0.0.0/0", "cidr_ipv6" : "::/0"} | ||
|
||
cidrValue := cidrs[cidr] | ||
|
||
rule[cidr] == cidrValue | ||
|
||
result := { | ||
"documentId": id, | ||
"searchKey": sprintf("name={{%s}}.{{%s}}.rules.%s", [task.name, modules[m], cidr]), | ||
"issueType": "IncorrectValue", | ||
"keyExpectedValue": sprintf("'ec2_group.rules.%s' is not %s", [cidr, cidrValue]), | ||
"keyActualValue": sprintf("'ec2_group.rules.%s' is %s", [cidr, rule[cidr]]), | ||
"searchLine": common_lib.build_search_line(["playbooks", t, modules[m], "rules", idx, cidr], []), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
assets/queries/ansible/aws/ec2_group_has_public_interface/test/positive.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- name: create minimal aurora instance in default VPC and default subnet group | ||
community.aws.rds_instance: | ||
engine: aurora | ||
db_instance_identifier: ansible-test-aurora-db-instance | ||
instance_type: db.t2.small | ||
password: "{{ password }}" | ||
username: "{{ username }}" | ||
cluster_id: ansible-test-cluster | ||
db_security_groups: ["example"] | ||
- name: example ec2 group | ||
ec2_group: | ||
name: example | ||
description: an example EC2 group | ||
vpc_id: 12345 | ||
region: eu-west-1a | ||
aws_secret_key: SECRET | ||
aws_access_key: ACCESS | ||
rules: | ||
- proto: tcp | ||
from_port: 80 | ||
to_port: 80 | ||
cidr_ip: 0.0.0.0/0 |
8 changes: 8 additions & 0 deletions
8
assets/queries/ansible/aws/ec2_group_has_public_interface/test/positive_expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"queryName": "EC2 Group Has Public Interface", | ||
"severity": "HIGH", | ||
"line": 22, | ||
"fileName": "positive.yaml" | ||
} | ||
] |
11 changes: 11 additions & 0 deletions
11
assets/queries/ansible/aws/ec2_not_ebs_optimized/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": "338b6cab-961d-4998-bb49-e5b6a11c9a5c", | ||
"queryName": "EC2 Not EBS Optimized", | ||
"severity": "INFO", | ||
"category": "Best Practices", | ||
"descriptionText": "It's considered a best practice for an EC2 instance to use an EBS optimized instance. This provides the best performance for your EBS volumes by minimizing contention between Amazon EBS I/O and other traffic from your instance", | ||
"descriptionUrl": "https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_module.html#parameter-ebs_optimized", | ||
"platform": "Ansible", | ||
"descriptionID": "a99c1fe0", | ||
"cloudProvider": "aws" | ||
} |
39 changes: 39 additions & 0 deletions
39
assets/queries/ansible/aws/ec2_not_ebs_optimized/query.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package Cx | ||
|
||
import data.generic.ansible as ans_lib | ||
import data.generic.common as common_lib | ||
|
||
CxPolicy[result] { | ||
task := ans_lib.tasks[id][t] | ||
modules := {"amazon.aws.ec2", "ec2"} | ||
ec2 := task[modules[m]] | ||
ans_lib.checkState(ec2) | ||
|
||
not common_lib.valid_key(ec2, "ebs_optimized") | ||
|
||
result := { | ||
"documentId": id, | ||
"searchKey": sprintf("name={{%s}}.{{%s}}", [task.name, modules[m]]), | ||
"issueType": "MissingAttribute", | ||
"keyExpectedValue": "ec2 to have ebs_optimized set to true.", | ||
"keyActualValue": "ec2 doesn't have ebs_optimized set to true.", | ||
} | ||
} | ||
|
||
CxPolicy[result] { | ||
task := ans_lib.tasks[id][t] | ||
modules := {"amazon.aws.ec2", "ec2"} | ||
ec2 := task[modules[m]] | ||
ans_lib.checkState(ec2) | ||
|
||
ec2["ebs_optimized"] == false | ||
|
||
result := { | ||
"documentId": id, | ||
"searchKey": sprintf("name={{%s}}.{{%s}}", [task.name, modules[m]]), | ||
"issueType": "IncorrectValue", | ||
"keyExpectedValue": "ec2 to have ebs_optimized set to true.", | ||
"keyActualValue": "ec2 ebs_optimized is set to false.", | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
assets/queries/ansible/aws/ec2_not_ebs_optimized/test/negative.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- name: example2 | ||
amazon.aws.ec2: | ||
key_name: mykey | ||
instance_type: t2.micro | ||
image: ami-123456 | ||
wait: yes | ||
group: my_sg | ||
count: 3 | ||
vpc_subnet_id: subnet-29e63245 | ||
ebs_optimized: true |
9 changes: 9 additions & 0 deletions
9
assets/queries/ansible/aws/ec2_not_ebs_optimized/test/positive1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- name: example | ||
amazon.aws.ec2: | ||
key_name: mykey | ||
instance_type: t2.micro | ||
image: ami-123456 | ||
wait: yes | ||
group: default | ||
count: 3 | ||
vpc_subnet_id: subnet-29e63245 |
10 changes: 10 additions & 0 deletions
10
assets/queries/ansible/aws/ec2_not_ebs_optimized/test/positive2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- name: example2 | ||
amazon.aws.ec2: | ||
key_name: mykey | ||
instance_type: t2.micro | ||
image: ami-123456 | ||
wait: yes | ||
group: default | ||
count: 3 | ||
vpc_subnet_id: subnet-29e63245 | ||
ebs_optimized: false |
14 changes: 14 additions & 0 deletions
14
assets/queries/ansible/aws/ec2_not_ebs_optimized/test/positive_expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"queryName": "EC2 Not EBS Optimized", | ||
"severity": "INFO", | ||
"line": 2, | ||
"fileName": "positive1.yaml" | ||
}, | ||
{ | ||
"queryName": "EC2 Not EBS Optimized", | ||
"severity": "INFO", | ||
"line": 2, | ||
"fileName": "positive2.yaml" | ||
} | ||
] |
2 changes: 1 addition & 1 deletion
2
...ecurity_group_has_public_ip/metadata.json → ...nstance_publicly_accessible/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
...ies/cloudFormation/aws/db_instance_publicly_accessible/test/positive_expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"queryName": "DB Instance Publicly Accessible", | ||
"severity": "HIGH", | ||
"line": 69, | ||
"fileName": "positive1.yaml" | ||
}, | ||
{ | ||
"queryName": "DB Instance Publicly Accessible", | ||
"severity": "HIGH", | ||
"line": 61, | ||
"fileName": "positive2.json" | ||
} | ||
] |
Oops, something went wrong.