inspec 2.1.10 → 2.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -19
- data/Gemfile +1 -0
- data/docs/resources/aws_config_delivery_channel.md +79 -0
- data/docs/resources/aws_iam_users.md.erb +2 -2
- data/docs/resources/aws_kms_key.md.erb +171 -0
- data/docs/resources/aws_rds_instance.md.erb +60 -0
- data/docs/resources/yaml.md.erb +2 -2
- data/examples/kitchen-ansible/Gemfile +1 -1
- data/inspec.gemspec +1 -1
- data/lib/bundles/inspec-habitat/profile.rb +1 -0
- data/lib/inspec/profile.rb +3 -0
- data/lib/inspec/profile_context.rb +1 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/resource_support/aws.rb +3 -0
- data/lib/resources/aws/aws_config_delivery_channel.rb +76 -0
- data/lib/resources/aws/aws_kms_key.rb +96 -0
- data/lib/resources/aws/aws_rds_instance.rb +71 -0
- data/lib/resources/aws/aws_route_table.rb +5 -3
- data/lib/resources/azure/azure_virtual_machine_data_disk.rb +0 -2
- data/lib/resources/http.rb +2 -0
- data/lib/resources/nginx.rb +1 -1
- data/lib/resources/os_env.rb +0 -1
- data/lib/resources/pip.rb +49 -8
- data/lib/resources/powershell.rb +16 -3
- data/lib/resources/registry_key.rb +4 -3
- data/lib/utils/filter.rb +1 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cdce0354c3cafed2dcccede01e6a0bfb657a260
|
4
|
+
data.tar.gz: 56946a1e833a47bedb93542f07c62612bda4f69e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dbfa4bff6f9d0ef9e5df5d1996f6ad456c6946d69c7c5ebc202ed270f491efc813e8a52dd3a04ba86fd98ef084877c1031d503f7f97ae346af31ae3739e17e1
|
7
|
+
data.tar.gz: 28b4defab9878584b4731a70907cf07df0d370ab1f414ba0e5be7907160310c86db562251344c2a51452f877ca3f3af55880d39fed3bccf7c927e66936068f0b
|
data/CHANGELOG.md
CHANGED
@@ -1,35 +1,57 @@
|
|
1
1
|
# Change Log
|
2
2
|
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
3
|
-
<!-- latest_release 2.1.
|
4
|
-
## [v2.1.
|
3
|
+
<!-- latest_release 2.1.21 -->
|
4
|
+
## [v2.1.21](https://github.com/chef/inspec/tree/v2.1.21) (2018-03-29)
|
5
5
|
|
6
|
-
####
|
7
|
-
-
|
6
|
+
#### Bug Fixes
|
7
|
+
- Pw/pip windows bug [#2883](https://github.com/chef/inspec/pull/2883) ([pwelch](https://github.com/pwelch))
|
8
8
|
<!-- latest_release -->
|
9
9
|
|
10
|
-
<!-- release_rollup since=2.1.
|
11
|
-
### Changes since 2.1.
|
10
|
+
<!-- release_rollup since=2.1.10 -->
|
11
|
+
### Changes since 2.1.10 release
|
12
12
|
|
13
13
|
#### Merged Pull Requests
|
14
|
-
-
|
15
|
-
|
16
|
-
|
17
|
-
- Revise /etc/hosts for correctness and clarity [#2863](https://github.com/chef/inspec/pull/2863) ([TrevorBramble](https://github.com/TrevorBramble)) <!-- 2.1.7 -->
|
18
|
-
- Correct support platform for audit_policy [#2850](https://github.com/chef/inspec/pull/2850) ([pwelch](https://github.com/pwelch)) <!-- 2.1.4 -->
|
14
|
+
- Pin to Train 1.3.0. [#2898](https://github.com/chef/inspec/pull/2898) ([jquick](https://github.com/jquick)) <!-- 2.1.20 -->
|
15
|
+
- Add `pry-byebug` to our Gemfile. [#2889](https://github.com/chef/inspec/pull/2889) ([miah](https://github.com/miah)) <!-- 2.1.16 -->
|
16
|
+
- Mitigate trivial warning output on test [#2872](https://github.com/chef/inspec/pull/2872) ([eramoto](https://github.com/eramoto)) <!-- 2.1.15 -->
|
19
17
|
|
20
18
|
#### Enhancements
|
21
|
-
-
|
22
|
-
-
|
23
|
-
|
24
|
-
|
19
|
+
- powershell resource: Add support other OSs [#2894](https://github.com/chef/inspec/pull/2894) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 2.1.18 -->
|
20
|
+
- registry_key resource was returning an incorrect value [#2871](https://github.com/chef/inspec/pull/2871) ([omar-irizarry](https://github.com/omar-irizarry)) <!-- 2.1.14 -->
|
21
|
+
|
22
|
+
#### Bug Fixes
|
23
|
+
- Pw/pip windows bug [#2883](https://github.com/chef/inspec/pull/2883) ([pwelch](https://github.com/pwelch)) <!-- 2.1.21 -->
|
24
|
+
- Change route_table_id Regular Expression for correctness [#2885](https://github.com/chef/inspec/pull/2885) ([TrevorBramble](https://github.com/TrevorBramble)) <!-- 2.1.19 -->
|
25
|
+
- Pin concurrent-ruby to version 1.0 to fix kitchen-ansible example [#2879](https://github.com/chef/inspec/pull/2879) ([visibilityspots](https://github.com/visibilityspots)) <!-- 2.1.13 -->
|
25
26
|
|
26
27
|
#### New Resources
|
27
|
-
-
|
28
|
-
- New Skeletal Resource
|
29
|
-
-
|
28
|
+
- new resource: aws rds instance (singular) [#2866](https://github.com/chef/inspec/pull/2866) ([HackerShark](https://github.com/HackerShark)) <!-- 2.1.17 -->
|
29
|
+
- New Skeletal Resource aws_config_delivery_channel [#2641](https://github.com/chef/inspec/pull/2641) ([dromazmj](https://github.com/dromazmj)) <!-- 2.1.12 -->
|
30
|
+
- New Skeletal Resource aws_kms_key [#2746](https://github.com/chef/inspec/pull/2746) ([dromazmj](https://github.com/dromazmj)) <!-- 2.1.11 -->
|
30
31
|
<!-- release_rollup -->
|
31
32
|
|
32
33
|
<!-- latest_stable_release -->
|
34
|
+
## [v2.1.10](https://github.com/chef/inspec/tree/v2.1.10) (2018-03-22)
|
35
|
+
|
36
|
+
#### New Resources
|
37
|
+
- Skelatal resource: aws_s3_bucket_object [#2620](https://github.com/chef/inspec/pull/2620) ([dromazmj](https://github.com/dromazmj))
|
38
|
+
- New Skeletal Resource aws_sns_topics [#2696](https://github.com/chef/inspec/pull/2696) ([dromazmj](https://github.com/dromazmj))
|
39
|
+
- New Skeletal Resource aws_sns_subscription [#2697](https://github.com/chef/inspec/pull/2697) ([dromazmj](https://github.com/dromazmj))
|
40
|
+
|
41
|
+
#### Enhancements
|
42
|
+
- Upgrade Thor to version 0.20.0. [#2843](https://github.com/chef/inspec/pull/2843) ([jquick](https://github.com/jquick))
|
43
|
+
- Remove supports binding for generic resources [#2848](https://github.com/chef/inspec/pull/2848) ([jquick](https://github.com/jquick))
|
44
|
+
- Unify method in which file content is read across all resources [#2359](https://github.com/chef/inspec/pull/2359) ([eramoto](https://github.com/eramoto))
|
45
|
+
- Added support for proxy_command for remote SSH connections [#2385](https://github.com/chef/inspec/pull/2385) ([cbeckr](https://github.com/cbeckr))
|
46
|
+
|
47
|
+
#### Bug Fixes
|
48
|
+
- Correct support platform for audit_policy [#2850](https://github.com/chef/inspec/pull/2850) ([pwelch](https://github.com/pwelch))
|
49
|
+
- Revise /etc/hosts for correctness and clarity [#2863](https://github.com/chef/inspec/pull/2863) ([TrevorBramble](https://github.com/TrevorBramble))
|
50
|
+
|
51
|
+
#### Merged Pull Requests
|
52
|
+
- Remove obsolete mock [#2869](https://github.com/chef/inspec/pull/2869) ([TrevorBramble](https://github.com/TrevorBramble))
|
53
|
+
<!-- latest_stable_release -->
|
54
|
+
|
33
55
|
## [v2.1.0](https://github.com/chef/inspec/tree/v2.1.0) (2018-03-15)
|
34
56
|
|
35
57
|
#### Enhancements
|
@@ -42,7 +64,6 @@
|
|
42
64
|
#### Merged Pull Requests
|
43
65
|
- Docs: Describe support boundary between RSpec and InSpec [#2753](https://github.com/chef/inspec/pull/2753) ([clintoncwolfe](https://github.com/clintoncwolfe))
|
44
66
|
- Sort file list for unit tests [#2812](https://github.com/chef/inspec/pull/2812) ([eramoto](https://github.com/eramoto))
|
45
|
-
<!-- latest_stable_release -->
|
46
67
|
|
47
68
|
## [v2.0.45](https://github.com/chef/inspec/tree/v2.0.45) (2018-03-08)
|
48
69
|
|
data/Gemfile
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
title: About the aws_config_delivery_channel Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# aws_config_delivery_channel
|
6
|
+
|
7
|
+
The AWS Config service can monitor and record changes to your AWS resource configurations. A Delivery Channel can record the changes
|
8
|
+
to an S3 Bucket, an SNS or both.
|
9
|
+
|
10
|
+
Use the `aws_config_delivery_channel` InSpec audit resource to examine how the AWS Config service delivers those change notifications.
|
11
|
+
|
12
|
+
<br>
|
13
|
+
|
14
|
+
## Syntax
|
15
|
+
|
16
|
+
An `aws_config_delivery_channel` resource block declares the tests for a single AWS Config delivery channel.
|
17
|
+
|
18
|
+
describe aws_config_delivery_channel('my_channel') do
|
19
|
+
it { should exist }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe aws_config_delivery_channel(channel_name: 'my-channel') do
|
23
|
+
it { should exist }
|
24
|
+
end
|
25
|
+
|
26
|
+
<br>
|
27
|
+
|
28
|
+
## Examples
|
29
|
+
|
30
|
+
The following examples show how to use this InSpec audit resource.
|
31
|
+
|
32
|
+
### Test how frequent the channel writes configuration changes to the s3 bucket.
|
33
|
+
|
34
|
+
describe aws_config_delivery_channel(channel_name: 'my-recorder') do
|
35
|
+
its(delivery_frequency_in_hours) { should be > 3 }
|
36
|
+
end
|
37
|
+
|
38
|
+
## Properties
|
39
|
+
|
40
|
+
### s3_bucket_name
|
41
|
+
|
42
|
+
Provides the name of the s3 bucket that the channel sends configuration changes to. This is an optional value since a Delivery Channel can also talk to an SNS.
|
43
|
+
|
44
|
+
describe aws_config_delivery_channel(channel_name: 'my_channel')
|
45
|
+
its('s3_bucket_name') { should eq 'my_bucket' }
|
46
|
+
end
|
47
|
+
|
48
|
+
### s3_key_prefix
|
49
|
+
|
50
|
+
Provides the s3 object key prefix (or "path") under which configuration data will be recorded.
|
51
|
+
|
52
|
+
describe aws_config_delivery_channel(channel_name: 'my_channel')
|
53
|
+
its('s3_key_prefix') { should eq 'log/' }
|
54
|
+
end
|
55
|
+
|
56
|
+
### sns_topic_arn
|
57
|
+
|
58
|
+
Provides the ARN of the SNS topic for which the channel sends notifications about configuration changes.
|
59
|
+
|
60
|
+
describe aws_config_delivery_channel(channel_name: 'my_channel')
|
61
|
+
its('sns_topic_arn') { should eq 'arn:aws:sns:us-east-1:721741954427:sns_topic' }
|
62
|
+
end
|
63
|
+
|
64
|
+
### delivery_frequency_in_hours
|
65
|
+
|
66
|
+
Provides how often the AWS Config sends configuration changes to the s3 bucket in the delivery channel.
|
67
|
+
|
68
|
+
describe aws_config_delivery_channel(channel_name: 'my_channel')
|
69
|
+
its('delivery_frequency_in_hours') { should eq 24 }
|
70
|
+
its('delivery_frequency_in_hours') { should be > 24 }
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
<br>
|
75
|
+
|
76
|
+
## Matchers
|
77
|
+
|
78
|
+
This resource provides no matchers, aside from the standard exists matcher.
|
79
|
+
|
@@ -59,7 +59,7 @@ The following examples show how to use this InSpec audit resource.
|
|
59
59
|
|
60
60
|
console_users_with_unused_password = aws_iam_users
|
61
61
|
.where(has_console_password?: true)
|
62
|
-
.where(password_never_used?:
|
62
|
+
.where(password_never_used?: true)
|
63
63
|
|
64
64
|
describe console_users_with_unused_password do
|
65
65
|
it { should_not exist }
|
@@ -69,7 +69,7 @@ The following examples show how to use this InSpec audit resource.
|
|
69
69
|
|
70
70
|
console_users_with_used_password = aws_iam_users
|
71
71
|
.where(has_console_password?: true)
|
72
|
-
.where(password_ever_used?:
|
72
|
+
.where(password_ever_used?: true)
|
73
73
|
|
74
74
|
describe console_users_with_used_password do
|
75
75
|
it { should exist }
|
@@ -0,0 +1,171 @@
|
|
1
|
+
---
|
2
|
+
title: About the aws_kms_key Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# aws\_kms\_key
|
6
|
+
|
7
|
+
Use the `aws_kms_key` InSpec audit resource to test properties of a single AWS KMS Key.
|
8
|
+
|
9
|
+
Use aws_kms_key to verify the properties of a single key. Use aws_kms_keys to verify the properties of all or a group of keys.
|
10
|
+
|
11
|
+
AWS Key Management Service (AWS KMS) is a managed service that makes it easy for you to create and control the encryption keys used to encrypt your data. AWS KMS lets you create master keys that can never be exported from the service and which can be used to encrypt and decrypt data based on policies you define.
|
12
|
+
|
13
|
+
Each AWS KMS Key is uniquely identified by its key_id or arn.
|
14
|
+
|
15
|
+
<br>
|
16
|
+
|
17
|
+
## Syntax
|
18
|
+
|
19
|
+
An aws_kms_key resource block identifies a key by key_arn or the key id.
|
20
|
+
|
21
|
+
# Find a kms key by arn
|
22
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
23
|
+
it { should exist }
|
24
|
+
end
|
25
|
+
|
26
|
+
# Find a kms key by just the id
|
27
|
+
describe aws_kms_key('4321dcba-21io-23de-85he-ab0987654321') do
|
28
|
+
it { should exist }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Hash syntax for key arn
|
32
|
+
describe aws_kms_key(key_arn: 'arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
33
|
+
it { should exist }
|
34
|
+
end
|
35
|
+
|
36
|
+
<br>
|
37
|
+
|
38
|
+
## Examples
|
39
|
+
|
40
|
+
The following examples show how to use this InSpec audit resource.
|
41
|
+
|
42
|
+
### Test that the specified key does exist
|
43
|
+
|
44
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
45
|
+
it { should exist }
|
46
|
+
end
|
47
|
+
|
48
|
+
### Test that the specified key is enabled
|
49
|
+
|
50
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
51
|
+
it { should be_enabled }
|
52
|
+
end
|
53
|
+
|
54
|
+
### Test that the specified key is rotation enabled
|
55
|
+
|
56
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
57
|
+
it { should have_rotation_enabled }
|
58
|
+
end
|
59
|
+
|
60
|
+
<br>
|
61
|
+
|
62
|
+
## Properties
|
63
|
+
|
64
|
+
### key\_id
|
65
|
+
|
66
|
+
The globally unique identifier for the key.
|
67
|
+
|
68
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
69
|
+
its('key_id') { should cmp '4321dcba-21io-23de-85he-ab0987654321' }
|
70
|
+
end
|
71
|
+
|
72
|
+
### arn
|
73
|
+
|
74
|
+
The ARN identifier of the specified key. An ARN uniquely identifies the key within AWS.
|
75
|
+
|
76
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
77
|
+
its('arn') { should cmp "arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321" }
|
78
|
+
end
|
79
|
+
|
80
|
+
### creation_date
|
81
|
+
|
82
|
+
Specifies the date and time when the key was created.
|
83
|
+
|
84
|
+
# Makes sure that the key was created at least 10 days ago
|
85
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
86
|
+
its('creation_date') { should be < Time.now - 10 * 86400 }
|
87
|
+
end
|
88
|
+
|
89
|
+
### created\_days\_ago
|
90
|
+
|
91
|
+
Specifies the number of days since the key was created.
|
92
|
+
|
93
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
94
|
+
its('created_days_ago') { should be > 10 }
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
### key\_state
|
99
|
+
|
100
|
+
Specifies the state of the key one of "Enabled", "Disabled", "PendingDeletion", "PendingImport". To just check if the key is enabled or not, use the `be_enabled` matcher.
|
101
|
+
|
102
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
103
|
+
its('key_state') { should cmp "Enabled" }
|
104
|
+
end
|
105
|
+
|
106
|
+
### description
|
107
|
+
|
108
|
+
Specifies the description of the key.
|
109
|
+
|
110
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
111
|
+
its('description') { should cmp "key-description" }
|
112
|
+
end
|
113
|
+
|
114
|
+
### deletion\_time
|
115
|
+
|
116
|
+
Specifies the date and time after which AWS KMS deletes the key. This value is present only when KeyState is PendingDeletion , otherwise this value is nil.
|
117
|
+
|
118
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
119
|
+
its('deletion_time') { should cmp > Time.now + 7 * 86400 }
|
120
|
+
end
|
121
|
+
|
122
|
+
### invalidation\_time
|
123
|
+
|
124
|
+
Provides the date and time until the key is not valid. Once the key is not valid, AWS KMS deletes the key and it becomes unusable. This value will be null unless the keys Origin is EXTERNAL and its matcher have_key_expiration is set to true.
|
125
|
+
|
126
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
127
|
+
its('invalidation_time') { should cmp > Time.now + 7 * 86400 }
|
128
|
+
end
|
129
|
+
|
130
|
+
## Matchers
|
131
|
+
|
132
|
+
This InSpec audit resource has the following special matchers. For a full list of available matchers (such as `exist`) please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
133
|
+
|
134
|
+
### be\_enabled
|
135
|
+
|
136
|
+
The test will pass if the specified key's key_state is set to enabled.
|
137
|
+
|
138
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
139
|
+
it { should be_enabled }
|
140
|
+
end
|
141
|
+
|
142
|
+
### be\_external
|
143
|
+
Provides whether the source of the key's key material is external or not. If it is not external than it was created by AWS KMS. When it is external, the key material was imported from an existing key management infrastructure or the key lacks key material.
|
144
|
+
|
145
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
146
|
+
its { should be_external }
|
147
|
+
end
|
148
|
+
|
149
|
+
### be\_managed\_by\_aws
|
150
|
+
|
151
|
+
Provides whether or not the key manager is from AWS. If it is not managed by AWS, it is managed by the customer.
|
152
|
+
|
153
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
154
|
+
its { should be_managed_by_aws }
|
155
|
+
end
|
156
|
+
|
157
|
+
### have\_key\_expiration
|
158
|
+
|
159
|
+
Specifies whether the key's key material expires. This value is null unless the keys Origin is External.
|
160
|
+
|
161
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
162
|
+
its { should have_key_expiration }
|
163
|
+
end
|
164
|
+
|
165
|
+
### have\_rotation\_enabled
|
166
|
+
|
167
|
+
The test will pass if automatic rotation of the key material is enabled for the specified key.
|
168
|
+
|
169
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
170
|
+
it { should have_rotation_enabled }
|
171
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
title: About the aws_rds_instance Resource
|
3
|
+
---
|
4
|
+
|
5
|
+
# aws\_rds\_instance
|
6
|
+
|
7
|
+
Use the `aws_rds_instance` InSpec audit resource to test detailed properties of an individual RDS instance.
|
8
|
+
|
9
|
+
RDS gives you access to the capabilities of a MySQL, MariaDB, PostgreSQL, Microsoft SQL Server, Oracle, or Amazon Aurora database server.
|
10
|
+
|
11
|
+
<br>
|
12
|
+
|
13
|
+
## Syntax
|
14
|
+
|
15
|
+
An `aws_rds_instance` resource block uses resource parameters to search for an RDS instance, and then tests that RDS instance. If no RDS instances match, no error is raised, but the `exists` matcher will return `false` and all properties will be `nil`. If more than one RDS instance matches (due to vague search parameters), an error is raised.
|
16
|
+
|
17
|
+
# Ensure you have a RDS instance with a certain ID
|
18
|
+
# This is "safe" - RDS IDs are unique within an account
|
19
|
+
describe aws_rds_instance('test-instance-id') do
|
20
|
+
it { should exist }
|
21
|
+
end
|
22
|
+
|
23
|
+
# Ensure you have a RDS instance with a certain ID
|
24
|
+
# This uses hash syntax
|
25
|
+
describe aws_rds_instance(db_instance_identifier: 'test-instance-id') do
|
26
|
+
it { should exist }
|
27
|
+
end
|
28
|
+
|
29
|
+
<br>
|
30
|
+
|
31
|
+
## Examples
|
32
|
+
|
33
|
+
The following examples show how to use this InSpec audit resource.
|
34
|
+
|
35
|
+
As this is the initial release of `aws_rds_instance`, its limited functionality precludes examples.
|
36
|
+
|
37
|
+
<br>
|
38
|
+
|
39
|
+
## Resource Parameters
|
40
|
+
|
41
|
+
This InSpec resource accepts the following parameters, which are used to search for the RDS instance.
|
42
|
+
|
43
|
+
### exists
|
44
|
+
|
45
|
+
The control will pass if the specified RDS instance was found. Use should_not if you want to verify that the specified RDS instance does not exist.
|
46
|
+
|
47
|
+
# Using Hash syntax
|
48
|
+
describe aws_rds_instance(db_instance_identifier: 'test-instance-id') do
|
49
|
+
it { should exist }
|
50
|
+
end
|
51
|
+
|
52
|
+
# Using the instance id directly from the terraform file
|
53
|
+
describe aws_rds_instance(fixtures['rds_db_instance_id']) do
|
54
|
+
it { should exist }
|
55
|
+
end
|
56
|
+
|
57
|
+
# Make sure we don't have any RDS instances with the name 'nogood'
|
58
|
+
describe aws_rds_instance('nogood') do
|
59
|
+
it { should_not exist }
|
60
|
+
end
|
data/docs/resources/yaml.md.erb
CHANGED
@@ -40,7 +40,7 @@ Like the `json` resource, the `yaml` resource can read a file, run a command, or
|
|
40
40
|
its('state') { should eq 'open' }
|
41
41
|
end
|
42
42
|
|
43
|
-
describe yaml({ content: \"key1: value1\nkey2: value2\" }) do
|
43
|
+
describe yaml({ content: "\"key1: value1\nkey2: value2\"" }) do
|
44
44
|
its('key2') { should cmp 'value2' }
|
45
45
|
end
|
46
46
|
|
@@ -53,7 +53,7 @@ The following examples show how to use this InSpec audit resource.
|
|
53
53
|
### Test a kitchen.yml file driver
|
54
54
|
|
55
55
|
describe yaml('.kitchen.yaml') do
|
56
|
-
its('driver
|
56
|
+
its(['driver','name']) { should eq('vagrant') }
|
57
57
|
end
|
58
58
|
|
59
59
|
<br>
|
data/inspec.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.required_ruby_version = '>= 2.3'
|
28
28
|
|
29
|
-
spec.add_dependency 'train', '~> 1.
|
29
|
+
spec.add_dependency 'train', '~> 1.3'
|
30
30
|
spec.add_dependency 'thor', '~> 0.20'
|
31
31
|
spec.add_dependency 'json', '>= 1.8', '< 3.0'
|
32
32
|
spec.add_dependency 'method_source', '~> 0.8'
|
data/lib/inspec/profile.rb
CHANGED
@@ -115,6 +115,9 @@ module Inspec
|
|
115
115
|
@runner_context =
|
116
116
|
options[:profile_context] ||
|
117
117
|
Inspec::ProfileContext.for_profile(self, @backend, @attr_values)
|
118
|
+
|
119
|
+
@supports_platform = metadata.supports_platform?(@backend)
|
120
|
+
@supports_runtime = metadata.supports_runtime?
|
118
121
|
end
|
119
122
|
|
120
123
|
def name
|
@@ -38,6 +38,7 @@ module Inspec
|
|
38
38
|
# in the transitive dependency tree of the loaded profile.
|
39
39
|
@resource_registry = Inspec::Resource.new_registry
|
40
40
|
@library_eval_context = Inspec::LibraryEvalContext.create(@resource_registry, @require_loader)
|
41
|
+
@current_load = nil
|
41
42
|
end
|
42
43
|
|
43
44
|
def dependencies
|
data/lib/inspec/version.rb
CHANGED
data/lib/resource_support/aws.rb
CHANGED
@@ -16,6 +16,7 @@ require 'resources/aws/aws_cloudtrail_trail'
|
|
16
16
|
require 'resources/aws/aws_cloudtrail_trails'
|
17
17
|
require 'resources/aws/aws_cloudwatch_alarm'
|
18
18
|
require 'resources/aws/aws_cloudwatch_log_metric_filter'
|
19
|
+
require 'resources/aws/aws_config_delivery_channel'
|
19
20
|
require 'resources/aws/aws_config_recorder'
|
20
21
|
require 'resources/aws/aws_ec2_instance'
|
21
22
|
require 'resources/aws/aws_iam_access_key'
|
@@ -29,7 +30,9 @@ require 'resources/aws/aws_iam_role'
|
|
29
30
|
require 'resources/aws/aws_iam_root_user'
|
30
31
|
require 'resources/aws/aws_iam_user'
|
31
32
|
require 'resources/aws/aws_iam_users'
|
33
|
+
require 'resources/aws/aws_kms_key'
|
32
34
|
require 'resources/aws/aws_kms_keys'
|
35
|
+
require 'resources/aws/aws_rds_instance'
|
33
36
|
require 'resources/aws/aws_route_table'
|
34
37
|
require 'resources/aws/aws_s3_bucket'
|
35
38
|
require 'resources/aws/aws_s3_bucket_object'
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class AwsConfigDeliveryChannel < Inspec.resource(1)
|
2
|
+
name 'aws_config_delivery_channel'
|
3
|
+
desc 'Verifies settings for AWS Config Delivery Channel'
|
4
|
+
example "
|
5
|
+
describe aws_config_delivery_channel do
|
6
|
+
it { should exist }
|
7
|
+
its('s3_bucket_name') { should eq 'my_bucket' }
|
8
|
+
its('sns_topic_arn') { should eq arn:aws:sns:us-east-1:721741954427:sns_topic' }
|
9
|
+
end
|
10
|
+
"
|
11
|
+
supports platform: 'aws'
|
12
|
+
|
13
|
+
include AwsSingularResourceMixin
|
14
|
+
attr_reader :channel_name, :s3_bucket_name, :s3_key_prefix, :sns_topic_arn,
|
15
|
+
:delivery_frequency_in_hours
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
"Config_Delivery_Channel: #{@channel_name}"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def validate_params(raw_params)
|
24
|
+
validated_params = check_resource_param_names(
|
25
|
+
raw_params: raw_params,
|
26
|
+
allowed_params: [:channel_name],
|
27
|
+
allowed_scalar_name: :channel_name,
|
28
|
+
allowed_scalar_type: String,
|
29
|
+
)
|
30
|
+
|
31
|
+
# Make sure channel_name is given as param
|
32
|
+
if validated_params[:channel_name].nil?
|
33
|
+
raise ArgumentError, 'You must provide a channel_name to aws_config_delivery_channel'
|
34
|
+
end
|
35
|
+
|
36
|
+
validated_params
|
37
|
+
end
|
38
|
+
|
39
|
+
def fetch_from_api
|
40
|
+
backend = BackendFactory.create(inspec_runner)
|
41
|
+
query = { delivery_channel_names: [@channel_name] }
|
42
|
+
catch_aws_errors do
|
43
|
+
@resp = backend.describe_delivery_channels(query)
|
44
|
+
end
|
45
|
+
@exists = !@resp.empty?
|
46
|
+
return unless @exists
|
47
|
+
|
48
|
+
@channel = @resp.delivery_channels.first.to_h
|
49
|
+
@channel_name = @channel[:name]
|
50
|
+
@s3_bucket_name = @channel[:s3_bucket_name]
|
51
|
+
@s3_key_prefix = @channel[:s3_key_prefix]
|
52
|
+
@sns_topic_arn = @channel[:sns_topic_arn]
|
53
|
+
@delivery_frequency_in_hours = @channel[:config_snapshot_delivery_properties][:delivery_frequency] unless @channel[:config_snapshot_delivery_properties].nil?
|
54
|
+
frequencies = {
|
55
|
+
'One_Hour' => 1,
|
56
|
+
'TwentyFour_Hours' => 24,
|
57
|
+
'Three_Hours' => 3,
|
58
|
+
'Six_Hours' => 6,
|
59
|
+
'Twelve_Hours' => 12,
|
60
|
+
}
|
61
|
+
@delivery_frequency_in_hours = frequencies[@delivery_frequency_in_hours]
|
62
|
+
end
|
63
|
+
|
64
|
+
class Backend
|
65
|
+
class AwsClientApi < AwsBackendBase
|
66
|
+
BackendFactory.set_default_backend(self)
|
67
|
+
self.aws_client_class = Aws::ConfigService::Client
|
68
|
+
|
69
|
+
def describe_delivery_channels(query)
|
70
|
+
aws_service_client.describe_delivery_channels(query)
|
71
|
+
rescue Aws::ConfigService::Errors::NoSuchDeliveryChannelException
|
72
|
+
return {}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
class AwsKmsKey < Inspec.resource(1)
|
2
|
+
name 'aws_kms_key'
|
3
|
+
desc 'Verifies settings for an individual AWS KMS Key'
|
4
|
+
example "
|
5
|
+
describe aws_kms_key('arn:aws:kms:us-east-1::key/4321dcba-21io-23de-85he-ab0987654321') do
|
6
|
+
it { should exist }
|
7
|
+
end
|
8
|
+
"
|
9
|
+
|
10
|
+
supports platform: 'aws'
|
11
|
+
|
12
|
+
include AwsSingularResourceMixin
|
13
|
+
attr_reader :key_id, :arn, :creation_date, :key_usage, :key_state, :description,
|
14
|
+
:deletion_date, :valid_to, :external, :has_key_expiration, :managed_by_aws,
|
15
|
+
:has_rotation_enabled, :enabled
|
16
|
+
# Use aliases for matchers
|
17
|
+
alias deletion_time deletion_date
|
18
|
+
alias invalidation_time valid_to
|
19
|
+
alias external? external
|
20
|
+
alias enabled? enabled
|
21
|
+
alias managed_by_aws? managed_by_aws
|
22
|
+
alias has_key_expiration? has_key_expiration
|
23
|
+
alias has_rotation_enabled? has_rotation_enabled
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
"KMS Key #{@key_id}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def created_days_ago
|
30
|
+
((Time.now - creation_date)/(24*60*60)).to_i unless creation_date.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def validate_params(raw_params)
|
36
|
+
validated_params = check_resource_param_names(
|
37
|
+
raw_params: raw_params,
|
38
|
+
allowed_params: [:key_id],
|
39
|
+
allowed_scalar_name: :key_id,
|
40
|
+
allowed_scalar_type: String,
|
41
|
+
)
|
42
|
+
|
43
|
+
if validated_params.empty?
|
44
|
+
raise ArgumentError, "You must provide the parameter 'key_id' to aws_kms_key."
|
45
|
+
end
|
46
|
+
|
47
|
+
validated_params
|
48
|
+
end
|
49
|
+
|
50
|
+
def fetch_from_api
|
51
|
+
backend = BackendFactory.create(inspec_runner)
|
52
|
+
|
53
|
+
query = { key_id: @key_id }
|
54
|
+
catch_aws_errors do
|
55
|
+
begin
|
56
|
+
resp = backend.describe_key(query)
|
57
|
+
|
58
|
+
@exists = true
|
59
|
+
@key = resp.key_metadata.to_h
|
60
|
+
@key_id = @key[:key_id]
|
61
|
+
@arn = @key[:arn]
|
62
|
+
@creation_date = @key[:creation_date]
|
63
|
+
@enabled = @key[:enabled]
|
64
|
+
@description = @key[:description]
|
65
|
+
@key_usage = @key[:key_usage]
|
66
|
+
@key_state = @key[:key_state]
|
67
|
+
@deletion_date = @key[:deletion_date]
|
68
|
+
@valid_to = @key[:valid_to]
|
69
|
+
@external = @key[:origin] == 'EXTERNAL'
|
70
|
+
@has_key_expiration = @key[:expiration_model] == 'KEY_MATERIAL_EXPIRES'
|
71
|
+
@managed_by_aws = @key[:key_manager] == 'AWS'
|
72
|
+
|
73
|
+
resp = backend.get_key_rotation_status(query)
|
74
|
+
@has_rotation_enabled = resp.key_rotation_enabled unless resp.empty?
|
75
|
+
rescue Aws::KMS::Errors::NotFoundException
|
76
|
+
@exists = false
|
77
|
+
return
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class Backend
|
83
|
+
class AwsClientApi < AwsBackendBase
|
84
|
+
BackendFactory.set_default_backend(self)
|
85
|
+
self.aws_client_class = Aws::KMS::Client
|
86
|
+
|
87
|
+
def describe_key(query)
|
88
|
+
aws_service_client.describe_key(query)
|
89
|
+
end
|
90
|
+
|
91
|
+
def get_key_rotation_status(query)
|
92
|
+
aws_service_client.get_key_rotation_status(query)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# author: Mohamed El-Sharkawi
|
2
|
+
class AwsRdsInstance < Inspec.resource(1)
|
3
|
+
name 'aws_rds_instance'
|
4
|
+
desc 'Verifies settings for an rds instance'
|
5
|
+
example "
|
6
|
+
describe aws_rds_instance(db_instance_identifier: 'test-instance-id') do
|
7
|
+
it { should exist }
|
8
|
+
end
|
9
|
+
"
|
10
|
+
supports platform: 'aws'
|
11
|
+
|
12
|
+
include AwsSingularResourceMixin
|
13
|
+
attr_reader :db_instance_identifier
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
"RDS Instance #{@db_instance_identifier}"
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def validate_params(raw_params)
|
22
|
+
validated_params = check_resource_param_names(
|
23
|
+
raw_params: raw_params,
|
24
|
+
allowed_params: [:db_instance_identifier],
|
25
|
+
allowed_scalar_name: :db_instance_identifier,
|
26
|
+
allowed_scalar_type: String,
|
27
|
+
)
|
28
|
+
if validated_params.empty? or !validated_params.key?(:db_instance_identifier)
|
29
|
+
raise ArgumentError, 'You must provide an id for the aws_rds_instance.'
|
30
|
+
end
|
31
|
+
|
32
|
+
if validated_params.key?(:db_instance_identifier) && validated_params[:db_instance_identifier] !~ /^[a-z]{1}[0-9a-z\-]{0,62}$/
|
33
|
+
raise ArgumentError, 'aws_rds_instance Database Instance ID must be in the format: start with a letter followed by up to 62 letters/numbers/hyphens.'
|
34
|
+
end
|
35
|
+
|
36
|
+
validated_params
|
37
|
+
end
|
38
|
+
|
39
|
+
def fetch_from_api
|
40
|
+
backend = BackendFactory.create(inspec_runner)
|
41
|
+
dsg_response = nil
|
42
|
+
catch_aws_errors do
|
43
|
+
begin
|
44
|
+
dsg_response = backend.describe_db_instances(db_instance_identifier: db_instance_identifier)
|
45
|
+
@exists = true
|
46
|
+
rescue Aws::RDS::Errors::DBInstanceNotFound
|
47
|
+
@exists = false
|
48
|
+
return
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if dsg_response.db_instances.empty?
|
53
|
+
@exists = false
|
54
|
+
return
|
55
|
+
end
|
56
|
+
|
57
|
+
@db_instance_identifier = dsg_response.db_instances[0].db_instance_identifier
|
58
|
+
end
|
59
|
+
|
60
|
+
# Uses the SDK API to really talk to AWS
|
61
|
+
class Backend
|
62
|
+
class AwsClientApi < AwsBackendBase
|
63
|
+
BackendFactory.set_default_backend(self)
|
64
|
+
self.aws_client_class = Aws::RDS::Client
|
65
|
+
|
66
|
+
def describe_db_instances(query)
|
67
|
+
aws_service_client.describe_db_instances(query)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -26,9 +26,11 @@ class AwsRouteTable < Inspec.resource(1)
|
|
26
26
|
allowed_scalar_type: String,
|
27
27
|
)
|
28
28
|
|
29
|
-
if validated_params.key?(:route_table_id) &&
|
30
|
-
|
31
|
-
|
29
|
+
if validated_params.key?(:route_table_id) &&
|
30
|
+
validated_params[:route_table_id] !~ /^rtb\-[0-9a-f]{8}$/
|
31
|
+
raise ArgumentError,
|
32
|
+
'aws_route_table Route Table ID must be in the' \
|
33
|
+
' format "rtb-" followed by 8 hexadecimal characters.'
|
32
34
|
end
|
33
35
|
|
34
36
|
validated_params
|
@@ -17,8 +17,6 @@ module Inspec::Resources
|
|
17
17
|
filter = FilterTable.create
|
18
18
|
filter.add_accessor(:where)
|
19
19
|
.add_accessor(:entries)
|
20
|
-
.add_accessor(:has_data_disks?)
|
21
|
-
.add_accessor(:count)
|
22
20
|
.add(:exists?) { |x| !x.entries.empty? }
|
23
21
|
.add(:disk, field: :disk)
|
24
22
|
.add(:number, field: :number)
|
data/lib/resources/http.rb
CHANGED
@@ -74,6 +74,7 @@ module Inspec::Resources
|
|
74
74
|
@http_method = http_method
|
75
75
|
@url = url
|
76
76
|
@opts = opts
|
77
|
+
@response = nil
|
77
78
|
end
|
78
79
|
|
79
80
|
private
|
@@ -152,6 +153,7 @@ module Inspec::Resources
|
|
152
153
|
'curl is not available on the target machine'
|
153
154
|
end
|
154
155
|
|
156
|
+
@ran_curl = false
|
155
157
|
@inspec = inspec
|
156
158
|
super(http_method, url, opts)
|
157
159
|
end
|
data/lib/resources/nginx.rb
CHANGED
@@ -34,7 +34,7 @@ module Inspec::Resources
|
|
34
34
|
read_content
|
35
35
|
end
|
36
36
|
|
37
|
-
%w{
|
37
|
+
%w{error_log_path http_client_body_temp_path http_fastcgi_temp_path http_log_path http_proxy_temp_path http_scgi_temp_path http_uwsgi_temp_path lock_path modules_path prefix sbin_path service version}.each do |property|
|
38
38
|
define_method(property.to_sym) do
|
39
39
|
@params[property.to_sym]
|
40
40
|
end
|
data/lib/resources/os_env.rb
CHANGED
data/lib/resources/pip.rb
CHANGED
@@ -26,7 +26,8 @@ module Inspec::Resources
|
|
26
26
|
def initialize(package_name, pip_path = nil)
|
27
27
|
@package_name = package_name
|
28
28
|
@pip_cmd = pip_path || default_pip_path
|
29
|
-
|
29
|
+
|
30
|
+
return skip_resource 'pip not found' if @pip_cmd.nil?
|
30
31
|
end
|
31
32
|
|
32
33
|
def info
|
@@ -34,8 +35,7 @@ module Inspec::Resources
|
|
34
35
|
|
35
36
|
@info = {}
|
36
37
|
@info[:type] = 'pip'
|
37
|
-
|
38
|
-
return @info if cmd.exit_status != 0
|
38
|
+
return @info unless cmd_successful?
|
39
39
|
|
40
40
|
params = SimpleConfig.new(
|
41
41
|
cmd.stdout,
|
@@ -62,19 +62,60 @@ module Inspec::Resources
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
+
def cmd
|
66
|
+
@__cmd ||= inspec.command("#{@pip_cmd} show #{@package_name}")
|
67
|
+
end
|
68
|
+
|
69
|
+
def cmd_successful?
|
70
|
+
return true if cmd.exit_status == 0
|
71
|
+
|
72
|
+
if cmd.exit_status != 0
|
73
|
+
# If pip on windows is not the latest, it will create a stderr value along with stdout
|
74
|
+
# Example:
|
75
|
+
# stdout: "Name: Jinja2\r\nVersion: 2.10..."
|
76
|
+
# stderr: "You are using pip version 9.0.1, however version 9.0.3 is available..."
|
77
|
+
if inspec.os.windows? && !cmd.stdout.empty?
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
false
|
83
|
+
end
|
84
|
+
|
85
|
+
# Paths of Python and Pip on windows
|
86
|
+
# {"Pip" => nil, "Python" => "/path/to/python"}
|
87
|
+
#
|
88
|
+
# @return [Hash] of windows_paths
|
89
|
+
def windows_paths
|
90
|
+
return @__windows_paths if @__windows_paths
|
91
|
+
cmd = inspec.command(
|
92
|
+
'New-Object -Type PSObject |
|
93
|
+
Add-Member -MemberType NoteProperty -Name Pip -Value (Invoke-Command -ScriptBlock {where.exe pip}) -PassThru |
|
94
|
+
Add-Member -MemberType NoteProperty -Name Python -Value (Invoke-Command -ScriptBlock {where.exe python}) -PassThru |
|
95
|
+
ConvertTo-Json',
|
96
|
+
)
|
97
|
+
|
98
|
+
@__windows_paths = JSON.parse(cmd.stdout)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Default path of python pip installation
|
102
|
+
#
|
103
|
+
# @return [String] of python pip path
|
65
104
|
def default_pip_path
|
66
105
|
return 'pip' unless inspec.os.windows?
|
67
106
|
|
107
|
+
# If python is not found, return with skip_resource
|
108
|
+
return skip_resource 'python not found' if windows_paths['Python'].nil?
|
109
|
+
|
68
110
|
# Pip is not on the default path for Windows, therefore we do some logic
|
69
111
|
# to find the binary on Windows
|
70
|
-
cmd = inspec.command('New-Object -Type PSObject | Add-Member -MemberType NoteProperty -Name Pip -Value (Invoke-Command -ScriptBlock {where.exe pip}) -PassThru | Add-Member -MemberType NoteProperty -Name Python -Value (Invoke-Command -ScriptBlock {where.exe python}) -PassThru | ConvertTo-Json')
|
71
112
|
begin
|
72
|
-
paths = JSON.parse(cmd.stdout)
|
73
113
|
# use pip if it on system path
|
74
|
-
pipcmd =
|
114
|
+
pipcmd = windows_paths['Pip']
|
75
115
|
# calculate path on windows
|
76
|
-
if defined?(
|
77
|
-
|
116
|
+
if defined?(windows_paths['Python']) && pipcmd.nil?
|
117
|
+
return nil if windows_paths['Pip'].nil?
|
118
|
+
pipdir = windows_paths['Python'].split('\\')
|
78
119
|
# remove python.exe
|
79
120
|
pipdir.pop
|
80
121
|
pipcmd = pipdir.push('Scripts').push('pip.exe').join('/')
|
data/lib/resources/powershell.rb
CHANGED
@@ -17,9 +17,22 @@ module Inspec::Resources
|
|
17
17
|
"
|
18
18
|
|
19
19
|
def initialize(script)
|
20
|
-
#
|
21
|
-
|
22
|
-
|
20
|
+
# PowerShell is the default shell on Windows, use the `command` resource
|
21
|
+
return super(script) if inspec.os.windows?
|
22
|
+
|
23
|
+
unless inspec.command('pwsh').exist?
|
24
|
+
raise Inspec::Exceptions::ResourceSkipped, 'Can not find `pwsh` command'
|
25
|
+
end
|
26
|
+
|
27
|
+
# Prevent progress stream from leaking into stderr
|
28
|
+
command = "$ProgressPreference='SilentlyContinue';" + script
|
29
|
+
|
30
|
+
# Encode as Base64 to remove any quotes/escapes/etc issues
|
31
|
+
command = command.encode('UTF-16LE', 'UTF-8')
|
32
|
+
command = Base64.strict_encode64(command)
|
33
|
+
|
34
|
+
# Use the `command` resource to execute the command via `pwsh`
|
35
|
+
super("pwsh -encodedCommand '#{command}'")
|
23
36
|
end
|
24
37
|
|
25
38
|
# we cannot determine if a command exists, because that does not work for scripts
|
@@ -163,10 +163,11 @@ module Inspec::Resources
|
|
163
163
|
$properties = New-Object -Type PSObject
|
164
164
|
$reg.Property | ForEach-Object {
|
165
165
|
$key = $_
|
166
|
-
|
166
|
+
$keytype = $key
|
167
|
+
if ("(default)".Equals($key)) { $keytype = '' }
|
167
168
|
$value = New-Object psobject -Property @{
|
168
|
-
"value" = $
|
169
|
-
"type" = $reg.GetValueKind($
|
169
|
+
"value" = $(Get-ItemProperty ('Registry::' + $path)).$key;
|
170
|
+
"type" = $reg.GetValueKind($keytype);
|
170
171
|
}
|
171
172
|
$properties | Add-Member NoteProperty $_ $value
|
172
173
|
}
|
data/lib/utils/filter.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -312,6 +312,7 @@ files:
|
|
312
312
|
- docs/resources/aws_cloudtrail_trails.md.erb
|
313
313
|
- docs/resources/aws_cloudwatch_alarm.md.erb
|
314
314
|
- docs/resources/aws_cloudwatch_log_metric_filter.md.erb
|
315
|
+
- docs/resources/aws_config_delivery_channel.md
|
315
316
|
- docs/resources/aws_config_recorder.md.erb
|
316
317
|
- docs/resources/aws_ec2_instance.md.erb
|
317
318
|
- docs/resources/aws_iam_access_key.md.erb
|
@@ -325,7 +326,9 @@ files:
|
|
325
326
|
- docs/resources/aws_iam_root_user.md.erb
|
326
327
|
- docs/resources/aws_iam_user.md.erb
|
327
328
|
- docs/resources/aws_iam_users.md.erb
|
329
|
+
- docs/resources/aws_kms_key.md.erb
|
328
330
|
- docs/resources/aws_kms_keys.md.erb
|
331
|
+
- docs/resources/aws_rds_instance.md.erb
|
329
332
|
- docs/resources/aws_route_table.md.erb
|
330
333
|
- docs/resources/aws_s3_bucket.md.erb
|
331
334
|
- docs/resources/aws_s3_bucket_object.md.erb
|
@@ -626,6 +629,7 @@ files:
|
|
626
629
|
- lib/resources/aws/aws_cloudtrail_trails.rb
|
627
630
|
- lib/resources/aws/aws_cloudwatch_alarm.rb
|
628
631
|
- lib/resources/aws/aws_cloudwatch_log_metric_filter.rb
|
632
|
+
- lib/resources/aws/aws_config_delivery_channel.rb
|
629
633
|
- lib/resources/aws/aws_config_recorder.rb
|
630
634
|
- lib/resources/aws/aws_ec2_instance.rb
|
631
635
|
- lib/resources/aws/aws_iam_access_key.rb
|
@@ -639,7 +643,9 @@ files:
|
|
639
643
|
- lib/resources/aws/aws_iam_root_user.rb
|
640
644
|
- lib/resources/aws/aws_iam_user.rb
|
641
645
|
- lib/resources/aws/aws_iam_users.rb
|
646
|
+
- lib/resources/aws/aws_kms_key.rb
|
642
647
|
- lib/resources/aws/aws_kms_keys.rb
|
648
|
+
- lib/resources/aws/aws_rds_instance.rb
|
643
649
|
- lib/resources/aws/aws_route_table.rb
|
644
650
|
- lib/resources/aws/aws_s3_bucket.rb
|
645
651
|
- lib/resources/aws/aws_s3_bucket_object.rb
|