inspec 4.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +63 -0
- data/inspec.gemspec +36 -0
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +11 -0
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/inspec-plugin-template.gemspec +43 -0
- data/lib/plugins/inspec-init/templates/profiles/aws/README.md +192 -0
- data/lib/plugins/inspec-init/templates/profiles/aws/attributes.yml +2 -0
- data/lib/plugins/inspec-init/templates/profiles/aws/controls/example.rb +39 -0
- data/lib/plugins/inspec-init/templates/profiles/aws/inspec.yml +22 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/README.md +56 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/controls/example.rb +14 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/inspec.yml +14 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/README.md +66 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/attributes.yml +2 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/controls/example.rb +27 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/inspec.yml +19 -0
- data/lib/resource_support/aws.rb +76 -0
- data/lib/resource_support/aws/aws_backend_base.rb +12 -0
- data/lib/resource_support/aws/aws_backend_factory_mixin.rb +12 -0
- data/lib/resource_support/aws/aws_plural_resource_mixin.rb +24 -0
- data/lib/resource_support/aws/aws_resource_mixin.rb +69 -0
- data/lib/resource_support/aws/aws_singular_resource_mixin.rb +27 -0
- data/lib/resources/aws/aws_billing_report.rb +107 -0
- data/lib/resources/aws/aws_billing_reports.rb +74 -0
- data/lib/resources/aws/aws_cloudtrail_trail.rb +97 -0
- data/lib/resources/aws/aws_cloudtrail_trails.rb +51 -0
- data/lib/resources/aws/aws_cloudwatch_alarm.rb +67 -0
- data/lib/resources/aws/aws_cloudwatch_log_metric_filter.rb +105 -0
- data/lib/resources/aws/aws_config_delivery_channel.rb +74 -0
- data/lib/resources/aws/aws_config_recorder.rb +99 -0
- data/lib/resources/aws/aws_ebs_volume.rb +127 -0
- data/lib/resources/aws/aws_ebs_volumes.rb +69 -0
- data/lib/resources/aws/aws_ec2_instance.rb +162 -0
- data/lib/resources/aws/aws_ec2_instances.rb +69 -0
- data/lib/resources/aws/aws_ecs_cluster.rb +88 -0
- data/lib/resources/aws/aws_eks_cluster.rb +105 -0
- data/lib/resources/aws/aws_elb.rb +85 -0
- data/lib/resources/aws/aws_elbs.rb +84 -0
- data/lib/resources/aws/aws_flow_log.rb +106 -0
- data/lib/resources/aws/aws_iam_access_key.rb +112 -0
- data/lib/resources/aws/aws_iam_access_keys.rb +153 -0
- data/lib/resources/aws/aws_iam_group.rb +62 -0
- data/lib/resources/aws/aws_iam_groups.rb +56 -0
- data/lib/resources/aws/aws_iam_password_policy.rb +121 -0
- data/lib/resources/aws/aws_iam_policies.rb +57 -0
- data/lib/resources/aws/aws_iam_policy.rb +311 -0
- data/lib/resources/aws/aws_iam_role.rb +60 -0
- data/lib/resources/aws/aws_iam_root_user.rb +82 -0
- data/lib/resources/aws/aws_iam_user.rb +145 -0
- data/lib/resources/aws/aws_iam_users.rb +160 -0
- data/lib/resources/aws/aws_kms_key.rb +100 -0
- data/lib/resources/aws/aws_kms_keys.rb +58 -0
- data/lib/resources/aws/aws_rds_instance.rb +74 -0
- data/lib/resources/aws/aws_route_table.rb +67 -0
- data/lib/resources/aws/aws_route_tables.rb +64 -0
- data/lib/resources/aws/aws_s3_bucket.rb +142 -0
- data/lib/resources/aws/aws_s3_bucket_object.rb +87 -0
- data/lib/resources/aws/aws_s3_buckets.rb +52 -0
- data/lib/resources/aws/aws_security_group.rb +314 -0
- data/lib/resources/aws/aws_security_groups.rb +71 -0
- data/lib/resources/aws/aws_sns_subscription.rb +82 -0
- data/lib/resources/aws/aws_sns_topic.rb +57 -0
- data/lib/resources/aws/aws_sns_topics.rb +60 -0
- data/lib/resources/aws/aws_sqs_queue.rb +66 -0
- data/lib/resources/aws/aws_subnet.rb +92 -0
- data/lib/resources/aws/aws_subnets.rb +56 -0
- data/lib/resources/aws/aws_vpc.rb +77 -0
- data/lib/resources/aws/aws_vpcs.rb +55 -0
- data/lib/resources/azure/azure_backend.rb +379 -0
- data/lib/resources/azure/azure_generic_resource.rb +55 -0
- data/lib/resources/azure/azure_resource_group.rb +151 -0
- data/lib/resources/azure/azure_virtual_machine.rb +262 -0
- data/lib/resources/azure/azure_virtual_machine_data_disk.rb +131 -0
- metadata +202 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b0617ca52a1e32ccc79646ed1afcbabe5ee38fa846bde842ce6217f12ef9b0be
|
4
|
+
data.tar.gz: 2a34c28543888a356b94d085b98210f784eac9316ee342a59d547185583a44d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d247307b6ca0194a10259fa68b5eadc7f98488663b4acd413e4225848192f7524c24f1932a19237bc15101fd637e47b2123f95f98ae2ae657835a1bcd8f9ad8c
|
7
|
+
data.tar.gz: d08bf61ff1f9c9ac1729e56193793686814118cbe60c0d9029067da3578a23d9a85acb8e34cc69db54ab8fe934b593f387abb53b2ea818b3861ef5c05b2c0700
|
data/Gemfile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "inspec", path: "."
|
4
|
+
|
5
|
+
# This dependency is NOT used for normal gem deployment
|
6
|
+
# - instead, inspec-bin gemspec-depends on inspec
|
7
|
+
#
|
8
|
+
# However, AppBundler requires a top-level Gemfile.lock with inspec-bin
|
9
|
+
# in it in order to package the executable. Hence the odd backwards dependency.
|
10
|
+
gem "inspec-bin", path: "./inspec-bin"
|
11
|
+
|
12
|
+
gem "ffi", ">= 1.9.14", "!= 1.13.0"
|
13
|
+
|
14
|
+
group :omnibus do
|
15
|
+
gem "rb-readline"
|
16
|
+
gem "appbundler"
|
17
|
+
gem "ed25519" # ed25519 ssh key support done here as its a native gem we can't put in the gemspec
|
18
|
+
gem "bcrypt_pbkdf" # ed25519 ssh key support done here as its a native gem we can't put in the gemspec
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "chefstyle", "~> 0.13.0"
|
23
|
+
gem "minitest", "~> 5.5"
|
24
|
+
gem "minitest-sprint", "~> 1.0"
|
25
|
+
gem "rake", ">= 10"
|
26
|
+
gem "simplecov", ["~> 0.10", "<=0.18.2"]
|
27
|
+
gem "concurrent-ruby", "~> 1.0"
|
28
|
+
gem "mocha", "~> 1.1"
|
29
|
+
gem "ruby-progressbar", "~> 1.8"
|
30
|
+
gem "webmock", "~> 3.0"
|
31
|
+
gem "m"
|
32
|
+
gem "pry", "~> 0.10"
|
33
|
+
gem "pry-byebug"
|
34
|
+
gem "html-proofer", platforms: :ruby # do not attempt to run proofer on windows
|
35
|
+
end
|
36
|
+
|
37
|
+
group :integration do
|
38
|
+
gem "berkshelf"
|
39
|
+
gem "test-kitchen"
|
40
|
+
gem "kitchen-vagrant"
|
41
|
+
gem "chef", "< 15"
|
42
|
+
gem "chef-zero", "< 15"
|
43
|
+
gem "kitchen-inspec"
|
44
|
+
gem "kitchen-ec2"
|
45
|
+
gem "kitchen-dokken"
|
46
|
+
gem "git"
|
47
|
+
end
|
48
|
+
|
49
|
+
# gems for Maintainers.md generation
|
50
|
+
group :maintenance do
|
51
|
+
gem "tomlrb"
|
52
|
+
|
53
|
+
# To sync maintainers with github
|
54
|
+
gem "octokit"
|
55
|
+
gem "netrc"
|
56
|
+
end
|
57
|
+
|
58
|
+
group :deploy do
|
59
|
+
gem "inquirer"
|
60
|
+
end
|
61
|
+
|
62
|
+
# add these additional dependencies into Gemfile.local
|
63
|
+
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
data/inspec.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "inspec/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "inspec"
|
7
|
+
spec.version = Inspec::VERSION
|
8
|
+
spec.authors = ["Chef InSpec Team"]
|
9
|
+
spec.email = ["inspec@chef.io"]
|
10
|
+
spec.summary = "Infrastructure and compliance testing."
|
11
|
+
spec.description = "InSpec provides a framework for creating end-to-end infrastructure tests. You can use it for integration or even compliance testing. Create fully portable test profiles and use them in your workflow to ensure stability and security. Integrate InSpec in your change lifecycle for local testing, CI/CD, and deployment verification."
|
12
|
+
spec.homepage = "https://github.com/inspec/inspec"
|
13
|
+
spec.license = "Apache-2.0"
|
14
|
+
spec.require_paths = ["lib"]
|
15
|
+
|
16
|
+
spec.required_ruby_version = "~> 2.4"
|
17
|
+
|
18
|
+
# ONLY the aws/azure/gcp files. The rest will come in from inspec-core
|
19
|
+
# the gemspec is necessary for appbundler so don't remove it
|
20
|
+
spec.files =
|
21
|
+
Dir.glob("{{lib,etc}/**/*,Gemfile,inspec.gemspec}")
|
22
|
+
.grep(/aws|azure|gcp|gemspec|Gemfile|inspec.gemspec/)
|
23
|
+
.reject { |f| File.directory?(f) }
|
24
|
+
|
25
|
+
spec.add_dependency "inspec-core", "= #{Inspec::VERSION}"
|
26
|
+
|
27
|
+
spec.add_dependency "train", "~> 3.0"
|
28
|
+
|
29
|
+
# Used for Azure profile until integrated into train
|
30
|
+
spec.add_dependency "faraday_middleware", "~> 0.12.2"
|
31
|
+
|
32
|
+
# Train plugins we ship with InSpec
|
33
|
+
spec.add_dependency "train-habitat", "~> 0.1"
|
34
|
+
spec.add_dependency "train-aws", "~> 0.1"
|
35
|
+
spec.add_dependency "train-winrm", "~> 0.2"
|
36
|
+
end
|
data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/inspec-plugin-template.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# As plugins are usually packaged and distributed as a RubyGem,
|
2
|
+
# we have to provide a .gemspec file, which controls the gembuild
|
3
|
+
# and publish process. This is a fairly generic gemspec.
|
4
|
+
|
5
|
+
# It is traditional in a gemspec to dynamically load the current version
|
6
|
+
# from a file in the source tree. The next three lines make that happen.
|
7
|
+
lib = File.expand_path('../lib', __FILE__)
|
8
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
9
|
+
require '<%= plugin_name %>/version'
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
# Importantly, all InSpec plugins must be prefixed with `inspec-` (most
|
13
|
+
# plugins) or `train-` (plugins which add new connectivity features).
|
14
|
+
spec.name = '<%= plugin_name %>'
|
15
|
+
|
16
|
+
# It is polite to namespace your plugin under InspecPlugins::YourPluginInCamelCase
|
17
|
+
spec.version = InspecPlugins::<%= module_name %>::VERSION
|
18
|
+
spec.authors = ['<%= author_name %>']
|
19
|
+
spec.email = ['<%= author_email %>']
|
20
|
+
spec.summary = '<%= summary %>'
|
21
|
+
spec.description = '<%= description %>'
|
22
|
+
spec.homepage = '<%= homepage %>'
|
23
|
+
spec.license = '<%= license_name %>'
|
24
|
+
|
25
|
+
# Though complicated-looking, this is pretty standard for a gemspec.
|
26
|
+
# It just filters what will actually be packaged in the gem (leaving
|
27
|
+
# out tests, etc)
|
28
|
+
spec.files = %w{
|
29
|
+
README.md <%= snake_case %>.gemspec Gemfile
|
30
|
+
} + Dir.glob(
|
31
|
+
'lib/**/*', File::FNM_DOTMATCH
|
32
|
+
).reject { |f| File.directory?(f) }
|
33
|
+
spec.require_paths = ['lib']
|
34
|
+
|
35
|
+
# If you rely on any other gems, list them here with any constraints.
|
36
|
+
# This is how `inspec plugin install` is able to manage your dependencies.
|
37
|
+
# For example, perhaps you are writing a thing that talks to AWS, and you
|
38
|
+
# want to ensure you have `aws-sdk` in a certain version.
|
39
|
+
|
40
|
+
# All plugins should mention inspec, > 2.2.78
|
41
|
+
# 2.2.78 included the v2 Plugin API
|
42
|
+
spec.add_dependency 'inspec', '>=2.2.78', '<4.0.0'
|
43
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
# Example InSpec Profile For AWS
|
2
|
+
|
3
|
+
This example shows the implementation of an InSpec profile for AWS.
|
4
|
+
|
5
|
+
## Create a profile
|
6
|
+
|
7
|
+
```
|
8
|
+
$ inspec init profile --platform aws my-profile
|
9
|
+
|
10
|
+
─────────────────────────── InSpec Code Generator ───────────────────────────
|
11
|
+
|
12
|
+
Creating new profile at /Users/spaterson/my-profile
|
13
|
+
• Creating directory libraries
|
14
|
+
• Creating file README.md
|
15
|
+
• Creating directory controls
|
16
|
+
• Creating file controls/example.rb
|
17
|
+
• Creating file inspec.yml
|
18
|
+
• Creating file attributes.yml
|
19
|
+
• Creating file libraries/.gitkeep
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
## Optionally update `attributes.yml` to point to your custom VPC
|
24
|
+
|
25
|
+
```
|
26
|
+
aws_vpc_id: 'custom-vpc-id'
|
27
|
+
```
|
28
|
+
|
29
|
+
The related control will simply be skipped if this is not provided. See the [InSpec DSL documentation](https://www.inspec.io/docs/reference/dsl_inspec/) for more details on conditional execution using `only_if`.
|
30
|
+
|
31
|
+
## Run the tests
|
32
|
+
|
33
|
+
### With a VPC Identifier
|
34
|
+
|
35
|
+
With a supplied VPC identifier in `attributes.yml` both of the example controls will run. The 'aws-single-vpc-exists-check' control will only check for a VPC identifier in the currently configured AWS SDK region e.g. `eu-west-2` in the below:
|
36
|
+
|
37
|
+
```
|
38
|
+
$ cd my-profile/
|
39
|
+
$ inspec exec . -t aws:// --attrs attributes.yml
|
40
|
+
|
41
|
+
Profile: AWS InSpec Profile (my-profile)
|
42
|
+
Version: 0.1.0
|
43
|
+
Target: aws://eu-west-2
|
44
|
+
|
45
|
+
✔ aws-single-vpc-exists-check: Check to see if custom VPC exists.
|
46
|
+
✔ VPC vpc-1ea06476 should exist
|
47
|
+
✔ aws-vpcs-check: Check in all the VPCs for default sg not allowing 22 inwards
|
48
|
+
✔ EC2 Security Group sg-067cd21e928c3a2f1 should allow in {:port=>22}
|
49
|
+
✔ EC2 Security Group sg-9bb3b9f3 should allow in {:port=>22}
|
50
|
+
✔ aws-vpcs-multi-region-status-check: Check AWS VPCs in all regions have status "available"
|
51
|
+
✔ VPC vpc-6458b70d in eu-north-1 should exist
|
52
|
+
✔ VPC vpc-6458b70d in eu-north-1 should be available
|
53
|
+
✔ VPC vpc-8d1390e5 in ap-south-1 should exist
|
54
|
+
✔ VPC vpc-8d1390e5 in ap-south-1 should be available
|
55
|
+
✔ VPC vpc-07a71d6e in eu-west-3 should exist
|
56
|
+
✔ VPC vpc-07a71d6e in eu-west-3 should be available
|
57
|
+
✔ VPC vpc-021630e2e767412b5 in eu-west-2 should exist
|
58
|
+
✔ VPC vpc-021630e2e767412b5 in eu-west-2 should be available
|
59
|
+
✔ VPC vpc-1ea06476 in eu-west-2 should exist
|
60
|
+
✔ VPC vpc-1ea06476 in eu-west-2 should be available
|
61
|
+
✔ VPC vpc-169dee70 in eu-west-1 should exist
|
62
|
+
✔ VPC vpc-169dee70 in eu-west-1 should be available
|
63
|
+
✔ VPC vpc-01ac7ba0be447a1c4 in eu-west-1 should exist
|
64
|
+
✔ VPC vpc-01ac7ba0be447a1c4 in eu-west-1 should be available
|
65
|
+
✔ VPC vpc-09ff83d71da9d2b6e in eu-west-1 should exist
|
66
|
+
✔ VPC vpc-09ff83d71da9d2b6e in eu-west-1 should be available
|
67
|
+
✔ VPC vpc-0ebccac2337a90f13 in eu-west-1 should exist
|
68
|
+
✔ VPC vpc-0ebccac2337a90f13 in eu-west-1 should be available
|
69
|
+
✔ VPC vpc-c2a53da4 in eu-west-1 should exist
|
70
|
+
✔ VPC vpc-c2a53da4 in eu-west-1 should be available
|
71
|
+
✔ VPC vpc-4fb3f127 in ap-northeast-2 should exist
|
72
|
+
✔ VPC vpc-4fb3f127 in ap-northeast-2 should be available
|
73
|
+
✔ VPC vpc-0804856f in ap-northeast-1 should exist
|
74
|
+
✔ VPC vpc-0804856f in ap-northeast-1 should be available
|
75
|
+
✔ VPC vpc-ccb917ab in sa-east-1 should exist
|
76
|
+
✔ VPC vpc-ccb917ab in sa-east-1 should be available
|
77
|
+
✔ VPC vpc-0afcc60c70a30a615 in ca-central-1 should exist
|
78
|
+
✔ VPC vpc-0afcc60c70a30a615 in ca-central-1 should be available
|
79
|
+
✔ VPC vpc-20a25048 in ca-central-1 should exist
|
80
|
+
✔ VPC vpc-20a25048 in ca-central-1 should be available
|
81
|
+
✔ VPC vpc-5896143f in ap-southeast-1 should exist
|
82
|
+
✔ VPC vpc-5896143f in ap-southeast-1 should be available
|
83
|
+
✔ VPC vpc-47972220 in ap-southeast-2 should exist
|
84
|
+
✔ VPC vpc-47972220 in ap-southeast-2 should be available
|
85
|
+
✔ VPC vpc-071b6f0c69d1d0311 in eu-central-1 should exist
|
86
|
+
✔ VPC vpc-071b6f0c69d1d0311 in eu-central-1 should be available
|
87
|
+
✔ VPC vpc-807dfdeb in eu-central-1 should exist
|
88
|
+
✔ VPC vpc-807dfdeb in eu-central-1 should be available
|
89
|
+
✔ VPC vpc-0be54a71311bc362d in eu-central-1 should exist
|
90
|
+
✔ VPC vpc-0be54a71311bc362d in eu-central-1 should be available
|
91
|
+
✔ VPC vpc-f060cd8b in us-east-1 should exist
|
92
|
+
✔ VPC vpc-f060cd8b in us-east-1 should be available
|
93
|
+
✔ VPC vpc-0c3a7e116c58d714b in us-east-1 should exist
|
94
|
+
✔ VPC vpc-0c3a7e116c58d714b in us-east-1 should be available
|
95
|
+
✔ VPC vpc-047bff6c in us-east-2 should exist
|
96
|
+
✔ VPC vpc-047bff6c in us-east-2 should be available
|
97
|
+
✔ VPC vpc-93dd6ef4 in us-west-1 should exist
|
98
|
+
✔ VPC vpc-93dd6ef4 in us-west-1 should be available
|
99
|
+
✔ VPC vpc-2c0a6a55 in us-west-2 should exist
|
100
|
+
✔ VPC vpc-2c0a6a55 in us-west-2 should be available
|
101
|
+
|
102
|
+
|
103
|
+
Profile: Amazon Web Services Resource Pack (inspec-aws)
|
104
|
+
Version: 0.1.0
|
105
|
+
Target: aws://eu-west-2
|
106
|
+
|
107
|
+
No tests executed.
|
108
|
+
|
109
|
+
Profile Summary: 3 successful controls, 0 control failures, 0 controls skipped
|
110
|
+
Test Summary: 53 successful, 0 failures, 0 skipped
|
111
|
+
```
|
112
|
+
|
113
|
+
|
114
|
+
### Without Supplying a VPC Identifier
|
115
|
+
|
116
|
+
If no VPC identifier is supplied, the 'aws-single-vpc-exists-check' control is skipped and the other control runs. The `attributes.yml` file does not have to be specified to InSpec in this case.
|
117
|
+
|
118
|
+
```
|
119
|
+
$ cd my-profile/
|
120
|
+
$ inspec exec . -t aws://
|
121
|
+
|
122
|
+
Profile: AWS InSpec Profile (my-profile)
|
123
|
+
Version: 0.1.0
|
124
|
+
Target: aws://eu-west-2
|
125
|
+
|
126
|
+
↺ aws-single-vpc-exists-check: Check to see if custom VPC exists.
|
127
|
+
↺ Skipped control due to only_if condition.
|
128
|
+
✔ aws-vpcs-check: Check in all the VPCs for default sg not allowing 22 inwards
|
129
|
+
✔ EC2 Security Group sg-067cd21e928c3a2f1 should allow in {:port=>22}
|
130
|
+
✔ EC2 Security Group sg-9bb3b9f3 should allow in {:port=>22}
|
131
|
+
✔ aws-vpcs-multi-region-status-check: Check AWS VPCs in all regions have status "available"
|
132
|
+
✔ VPC vpc-6458b70d in eu-north-1 should exist
|
133
|
+
✔ VPC vpc-6458b70d in eu-north-1 should be available
|
134
|
+
✔ VPC vpc-8d1390e5 in ap-south-1 should exist
|
135
|
+
✔ VPC vpc-8d1390e5 in ap-south-1 should be available
|
136
|
+
✔ VPC vpc-07a71d6e in eu-west-3 should exist
|
137
|
+
✔ VPC vpc-07a71d6e in eu-west-3 should be available
|
138
|
+
✔ VPC vpc-021630e2e767412b5 in eu-west-2 should exist
|
139
|
+
✔ VPC vpc-021630e2e767412b5 in eu-west-2 should be available
|
140
|
+
✔ VPC vpc-1ea06476 in eu-west-2 should exist
|
141
|
+
✔ VPC vpc-1ea06476 in eu-west-2 should be available
|
142
|
+
✔ VPC vpc-169dee70 in eu-west-1 should exist
|
143
|
+
✔ VPC vpc-169dee70 in eu-west-1 should be available
|
144
|
+
✔ VPC vpc-01ac7ba0be447a1c4 in eu-west-1 should exist
|
145
|
+
✔ VPC vpc-01ac7ba0be447a1c4 in eu-west-1 should be available
|
146
|
+
✔ VPC vpc-09ff83d71da9d2b6e in eu-west-1 should exist
|
147
|
+
✔ VPC vpc-09ff83d71da9d2b6e in eu-west-1 should be available
|
148
|
+
✔ VPC vpc-0ebccac2337a90f13 in eu-west-1 should exist
|
149
|
+
✔ VPC vpc-0ebccac2337a90f13 in eu-west-1 should be available
|
150
|
+
✔ VPC vpc-c2a53da4 in eu-west-1 should exist
|
151
|
+
✔ VPC vpc-c2a53da4 in eu-west-1 should be available
|
152
|
+
✔ VPC vpc-4fb3f127 in ap-northeast-2 should exist
|
153
|
+
✔ VPC vpc-4fb3f127 in ap-northeast-2 should be available
|
154
|
+
✔ VPC vpc-0804856f in ap-northeast-1 should exist
|
155
|
+
✔ VPC vpc-0804856f in ap-northeast-1 should be available
|
156
|
+
✔ VPC vpc-ccb917ab in sa-east-1 should exist
|
157
|
+
✔ VPC vpc-ccb917ab in sa-east-1 should be available
|
158
|
+
✔ VPC vpc-0afcc60c70a30a615 in ca-central-1 should exist
|
159
|
+
✔ VPC vpc-0afcc60c70a30a615 in ca-central-1 should be available
|
160
|
+
✔ VPC vpc-20a25048 in ca-central-1 should exist
|
161
|
+
✔ VPC vpc-20a25048 in ca-central-1 should be available
|
162
|
+
✔ VPC vpc-5896143f in ap-southeast-1 should exist
|
163
|
+
✔ VPC vpc-5896143f in ap-southeast-1 should be available
|
164
|
+
✔ VPC vpc-47972220 in ap-southeast-2 should exist
|
165
|
+
✔ VPC vpc-47972220 in ap-southeast-2 should be available
|
166
|
+
✔ VPC vpc-071b6f0c69d1d0311 in eu-central-1 should exist
|
167
|
+
✔ VPC vpc-071b6f0c69d1d0311 in eu-central-1 should be available
|
168
|
+
✔ VPC vpc-807dfdeb in eu-central-1 should exist
|
169
|
+
✔ VPC vpc-807dfdeb in eu-central-1 should be available
|
170
|
+
✔ VPC vpc-0be54a71311bc362d in eu-central-1 should exist
|
171
|
+
✔ VPC vpc-0be54a71311bc362d in eu-central-1 should be available
|
172
|
+
✔ VPC vpc-f060cd8b in us-east-1 should exist
|
173
|
+
✔ VPC vpc-f060cd8b in us-east-1 should be available
|
174
|
+
✔ VPC vpc-0c3a7e116c58d714b in us-east-1 should exist
|
175
|
+
✔ VPC vpc-0c3a7e116c58d714b in us-east-1 should be available
|
176
|
+
✔ VPC vpc-047bff6c in us-east-2 should exist
|
177
|
+
✔ VPC vpc-047bff6c in us-east-2 should be available
|
178
|
+
✔ VPC vpc-93dd6ef4 in us-west-1 should exist
|
179
|
+
✔ VPC vpc-93dd6ef4 in us-west-1 should be available
|
180
|
+
✔ VPC vpc-2c0a6a55 in us-west-2 should exist
|
181
|
+
✔ VPC vpc-2c0a6a55 in us-west-2 should be available
|
182
|
+
|
183
|
+
|
184
|
+
Profile: Amazon Web Services Resource Pack (inspec-aws)
|
185
|
+
Version: 0.1.0
|
186
|
+
Target: aws://eu-west-2
|
187
|
+
|
188
|
+
No tests executed.
|
189
|
+
|
190
|
+
Profile Summary: 2 successful controls, 0 control failures, 1 control skipped
|
191
|
+
Test Summary: 52 successful, 0 failures, 1 skipped
|
192
|
+
```
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# copyright: 2018, The Authors
|
2
|
+
|
3
|
+
title "Sample Section"
|
4
|
+
|
5
|
+
aws_vpc_id = attribute("aws_vpc_id", default: "", description: "Optional AWS VPC identifier.")
|
6
|
+
|
7
|
+
# You add controls here
|
8
|
+
control "aws-single-vpc-exists-check" do # A unique ID for this control.
|
9
|
+
only_if { aws_vpc_id != "" } # Only run this control if the `aws_vpc_id` attribute is provided.
|
10
|
+
impact 1.0 # The criticality, if this control fails.
|
11
|
+
title "Check to see if custom VPC exists." # A human-readable title.
|
12
|
+
describe aws_vpc(aws_vpc_id) do # The test itself.
|
13
|
+
it { should exist }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Plural resources can be inspected to check for specific resource details.
|
18
|
+
control "aws-vpcs-check" do
|
19
|
+
impact 1.0
|
20
|
+
title "Check in all the VPCs for default sg not allowing 22 inwards"
|
21
|
+
aws_vpcs.vpc_ids.each do |vpc_id|
|
22
|
+
describe aws_security_group(vpc_id: vpc_id, group_name: "default") do
|
23
|
+
it { should allow_in(port: 22) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
control "aws-vpcs-multi-region-status-check" do # A unique ID for this control.
|
29
|
+
impact 1.0 # The criticality, if this control fails.
|
30
|
+
title 'Check AWS VPCs in all regions have status "available"' # A human-readable title.
|
31
|
+
aws_regions.region_names.each do |region| # Loop over all available AWS regions
|
32
|
+
aws_vpcs(aws_region: region).vpc_ids.each do |vpc| # Find all VPCs in a single AWS region
|
33
|
+
describe aws_vpc(aws_region: region, vpc_id: vpc) do # The test itself.
|
34
|
+
it { should exist } # Confirms AWS VPC exists
|
35
|
+
it { should be_available } # Confirms AWS VPC has status "available"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: <%= name %>
|
2
|
+
title: AWS InSpec Profile
|
3
|
+
maintainer: The Authors
|
4
|
+
copyright: The Authors
|
5
|
+
copyright_email: you@example.com
|
6
|
+
license: Apache-2.0
|
7
|
+
summary: An InSpec Compliance Profile For AWS
|
8
|
+
version: 0.1.0
|
9
|
+
inspec_version: '~> 4'
|
10
|
+
attributes:
|
11
|
+
- name: aws_vpc_id
|
12
|
+
required: false
|
13
|
+
# Below is deliberately left as a default empty string to allow the profile to run when this is not provided.
|
14
|
+
# Please see the README for more details.
|
15
|
+
default: ''
|
16
|
+
description: 'Optional Custom AWS VPC Id'
|
17
|
+
type: string
|
18
|
+
depends:
|
19
|
+
- name: inspec-aws
|
20
|
+
url: https://github.com/inspec/inspec-aws/archive/master.tar.gz
|
21
|
+
supports:
|
22
|
+
- platform: aws
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Example InSpec Profile For Azure
|
2
|
+
|
3
|
+
This example shows the implementation of an InSpec profile for Azure. See [https://github.com/inspec/inspec-azure](https://github.com/inspec/inspec-azure) for details on how to configure credentials for your subscription.
|
4
|
+
|
5
|
+
## Create a profile
|
6
|
+
|
7
|
+
```
|
8
|
+
$ inspec init profile --platform azure my-profile
|
9
|
+
|
10
|
+
─────────────────────────── InSpec Code Generator ───────────────────────────
|
11
|
+
|
12
|
+
Creating new profile at /Users/spaterson/my-profile
|
13
|
+
• Creating directory libraries
|
14
|
+
• Creating file README.md
|
15
|
+
• Creating directory controls
|
16
|
+
• Creating file controls/example.rb
|
17
|
+
• Creating file inspec.yml
|
18
|
+
• Creating file libraries/.gitkeep
|
19
|
+
|
20
|
+
```
|
21
|
+
|
22
|
+
## Run the tests
|
23
|
+
|
24
|
+
```
|
25
|
+
$ cd my-profile/
|
26
|
+
$ inspec exec . -t azure://
|
27
|
+
|
28
|
+
|
29
|
+
Profile: Azure InSpec Profile (my-profile)
|
30
|
+
Version: 0.1.0
|
31
|
+
Target: azure://12345abc-987d-654e-fg21-abcdef23324r
|
32
|
+
|
33
|
+
× azure-virtual-machines-exist-check: Check resource groups to see if any VMs exist. (4 failed)
|
34
|
+
× Azure Virtual Machines should exist
|
35
|
+
expected Azure Virtual Machines to exist
|
36
|
+
× Azure Virtual Machines should exist
|
37
|
+
expected Azure Virtual Machines to exist
|
38
|
+
× Azure Virtual Machines should exist
|
39
|
+
expected Azure Virtual Machines to exist
|
40
|
+
× Azure Virtual Machines should exist
|
41
|
+
expected Azure Virtual Machines to exist
|
42
|
+
✔ Azure Virtual Machines should exist
|
43
|
+
✔ Azure Virtual Machines should exist
|
44
|
+
✔ Azure Virtual Machines should exist
|
45
|
+
|
46
|
+
|
47
|
+
Profile: Azure Resource Pack (inspec-azure)
|
48
|
+
Version: 1.2.0
|
49
|
+
Target: azure://12345abc-987d-654e-fg21-abcdef23324r
|
50
|
+
|
51
|
+
No tests executed.
|
52
|
+
|
53
|
+
Profile Summary: 0 successful controls, 1 control failure, 0 controls skipped
|
54
|
+
Test Summary: 3 successful, 4 failures, 0 skipped
|
55
|
+
|
56
|
+
```
|