cfn-nag 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfn_nag.rb +18 -4
- data/lib/json_rules/loadbalancer_rules.rb +7 -0
- data/lib/violation.rb +4 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 292f48533183f6f2b074d57757ec5771db23a597
|
4
|
+
data.tar.gz: c253df7e9188ef34a47f832b2b055eaf41649e55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 840362bbf552584f4f080a572e15d73bdfb4013008c6eb5ae56008f96c78a28db6d30790e56a7484bbcd4d2e5c015594aa03d8f53ad77a39e0bdee9f53ca1203
|
7
|
+
data.tar.gz: a661ea828ffcb4ead2f2827d0b9c56cac24b08f0c025ef753a5b245f98e84a9ccdf62972b0b51b2b44fd84ce9307b16ddbffd6f0cb4c801877be1b0342b5b655
|
data/lib/cfn_nag.rb
CHANGED
@@ -11,19 +11,29 @@ class CfnNag
|
|
11
11
|
def audit(input_json_path:,
|
12
12
|
output_format:'txt')
|
13
13
|
|
14
|
+
aggregate_results = audit_results input_json_path: input_json_path,
|
15
|
+
output_format: output_format
|
16
|
+
|
17
|
+
aggregate_results.inject(0) { |total_failure_count, results| total_failure_count + results[:file_results][:failure_count] }
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_results(input_json_path:,
|
21
|
+
output_format:'txt')
|
22
|
+
|
14
23
|
templates = discover_templates(input_json_path)
|
15
24
|
|
16
25
|
aggregate_results = []
|
17
26
|
templates.each do |template|
|
18
27
|
aggregate_results << {
|
19
|
-
|
20
|
-
|
28
|
+
filename: template,
|
29
|
+
file_results: audit_file(input_json_path: template)
|
21
30
|
}
|
22
31
|
end
|
23
32
|
|
24
|
-
|
33
|
+
render_results(aggregate_results: aggregate_results,
|
34
|
+
output_format: output_format)
|
25
35
|
|
26
|
-
aggregate_results
|
36
|
+
aggregate_results
|
27
37
|
end
|
28
38
|
|
29
39
|
def self.configure_logging(opts)
|
@@ -39,6 +49,10 @@ class CfnNag
|
|
39
49
|
|
40
50
|
private
|
41
51
|
|
52
|
+
def render_results(aggregate_results:,output_format:)
|
53
|
+
results_renderer(output_format).new.render(aggregate_results)
|
54
|
+
end
|
55
|
+
|
42
56
|
def audit_file(input_json_path:)
|
43
57
|
@stop_processing = false
|
44
58
|
@violations = []
|
@@ -0,0 +1,7 @@
|
|
1
|
+
warning jq: '[.Resources|with_entries(.value.LogicalResourceId = .key)[] | select(.Type == "AWS::ElasticLoadBalancing::LoadBalancer")|'\
|
2
|
+
'select(.Properties.AccessLoggingPolicy == null)]|map(.LogicalResourceId) ',
|
3
|
+
message: 'Elastic Load Balancer should have access logging configured'
|
4
|
+
|
5
|
+
warning jq: '[.Resources|with_entries(.value.LogicalResourceId = .key)[] | select(.Type == "AWS::ElasticLoadBalancing::LoadBalancer")|'\
|
6
|
+
'select(.Properties.AccessLoggingPolicy?.Enabled == false)]|map(.LogicalResourceId) ',
|
7
|
+
message: 'Elastic Load Balancer should have access logging enabled'
|
data/lib/violation.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn-nag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- someguy
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/json_rules/ebs_rules.rb
|
56
56
|
- lib/json_rules/iam_policy_rules.rb
|
57
57
|
- lib/json_rules/iam_user_rules.rb
|
58
|
+
- lib/json_rules/loadbalancer_rules.rb
|
58
59
|
- lib/json_rules/port_rules.rb
|
59
60
|
- lib/model/cfn_model.rb
|
60
61
|
- lib/model/iam_user_parser.rb
|