inspec 2.3.10 → 2.3.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -13
- data/etc/plugin_filters.json +25 -0
- data/inspec.gemspec +3 -3
- data/lib/bundles/inspec-compliance/api.rb +3 -0
- data/lib/bundles/inspec-compliance/configuration.rb +3 -0
- data/lib/bundles/inspec-compliance/http.rb +3 -0
- data/lib/bundles/inspec-compliance/support.rb +3 -0
- data/lib/bundles/inspec-compliance/target.rb +3 -0
- data/lib/inspec/objects/attribute.rb +3 -0
- data/lib/inspec/plugin/v2.rb +3 -0
- data/lib/inspec/plugin/v2/filter.rb +62 -0
- data/lib/inspec/plugin/v2/installer.rb +21 -1
- data/lib/inspec/plugin/v2/loader.rb +4 -0
- data/lib/inspec/profile.rb +3 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +25 -3
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +65 -11
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +5 -1
- data/lib/resources/package.rb +1 -1
- metadata +5 -253
- data/MAINTAINERS.toml +0 -52
- data/docs/.gitignore +0 -2
- data/docs/README.md +0 -41
- data/docs/dev/control-eval.md +0 -62
- data/docs/dev/filtertable-internals.md +0 -353
- data/docs/dev/filtertable-usage.md +0 -533
- data/docs/dev/integration-testing.md +0 -31
- data/docs/dev/plugins.md +0 -323
- data/docs/dsl_inspec.md +0 -354
- data/docs/dsl_resource.md +0 -100
- data/docs/glossary.md +0 -381
- data/docs/habitat.md +0 -193
- data/docs/inspec_and_friends.md +0 -114
- data/docs/matchers.md +0 -161
- data/docs/migration.md +0 -293
- data/docs/platforms.md +0 -119
- data/docs/plugin_kitchen_inspec.md +0 -60
- data/docs/plugins.md +0 -57
- data/docs/profiles.md +0 -576
- data/docs/reporters.md +0 -170
- data/docs/resources/aide_conf.md.erb +0 -86
- data/docs/resources/apache.md.erb +0 -77
- data/docs/resources/apache_conf.md.erb +0 -78
- data/docs/resources/apt.md.erb +0 -81
- data/docs/resources/audit_policy.md.erb +0 -57
- data/docs/resources/auditd.md.erb +0 -89
- data/docs/resources/auditd_conf.md.erb +0 -78
- data/docs/resources/aws_cloudtrail_trail.md.erb +0 -165
- data/docs/resources/aws_cloudtrail_trails.md.erb +0 -96
- data/docs/resources/aws_cloudwatch_alarm.md.erb +0 -101
- data/docs/resources/aws_cloudwatch_log_metric_filter.md.erb +0 -164
- data/docs/resources/aws_config_delivery_channel.md.erb +0 -111
- data/docs/resources/aws_config_recorder.md.erb +0 -96
- data/docs/resources/aws_ebs_volume.md.erb +0 -76
- data/docs/resources/aws_ebs_volumes.md.erb +0 -86
- data/docs/resources/aws_ec2_instance.md.erb +0 -122
- data/docs/resources/aws_ec2_instances.md.erb +0 -89
- data/docs/resources/aws_elb.md.erb +0 -154
- data/docs/resources/aws_elbs.md.erb +0 -252
- data/docs/resources/aws_flow_log.md.erb +0 -128
- data/docs/resources/aws_iam_access_key.md.erb +0 -139
- data/docs/resources/aws_iam_access_keys.md.erb +0 -214
- data/docs/resources/aws_iam_group.md.erb +0 -74
- data/docs/resources/aws_iam_groups.md.erb +0 -92
- data/docs/resources/aws_iam_password_policy.md.erb +0 -92
- data/docs/resources/aws_iam_policies.md.erb +0 -97
- data/docs/resources/aws_iam_policy.md.erb +0 -264
- data/docs/resources/aws_iam_role.md.erb +0 -79
- data/docs/resources/aws_iam_root_user.md.erb +0 -86
- data/docs/resources/aws_iam_user.md.erb +0 -130
- data/docs/resources/aws_iam_users.md.erb +0 -289
- data/docs/resources/aws_kms_key.md.erb +0 -187
- data/docs/resources/aws_kms_keys.md.erb +0 -99
- data/docs/resources/aws_rds_instance.md.erb +0 -76
- data/docs/resources/aws_route_table.md.erb +0 -63
- data/docs/resources/aws_route_tables.md.erb +0 -65
- data/docs/resources/aws_s3_bucket.md.erb +0 -156
- data/docs/resources/aws_s3_bucket_object.md.erb +0 -99
- data/docs/resources/aws_s3_buckets.md.erb +0 -69
- data/docs/resources/aws_security_group.md.erb +0 -323
- data/docs/resources/aws_security_groups.md.erb +0 -107
- data/docs/resources/aws_sns_subscription.md.erb +0 -140
- data/docs/resources/aws_sns_topic.md.erb +0 -79
- data/docs/resources/aws_sns_topics.md.erb +0 -68
- data/docs/resources/aws_subnet.md.erb +0 -150
- data/docs/resources/aws_subnets.md.erb +0 -142
- data/docs/resources/aws_vpc.md.erb +0 -135
- data/docs/resources/aws_vpcs.md.erb +0 -135
- data/docs/resources/azure_generic_resource.md.erb +0 -183
- data/docs/resources/azure_resource_group.md.erb +0 -294
- data/docs/resources/azure_virtual_machine.md.erb +0 -357
- data/docs/resources/azure_virtual_machine_data_disk.md.erb +0 -234
- data/docs/resources/bash.md.erb +0 -85
- data/docs/resources/bond.md.erb +0 -100
- data/docs/resources/bridge.md.erb +0 -67
- data/docs/resources/bsd_service.md.erb +0 -77
- data/docs/resources/chocolatey_package.md.erb +0 -68
- data/docs/resources/command.md.erb +0 -176
- data/docs/resources/cpan.md.erb +0 -89
- data/docs/resources/cran.md.erb +0 -74
- data/docs/resources/crontab.md.erb +0 -103
- data/docs/resources/csv.md.erb +0 -64
- data/docs/resources/dh_params.md.erb +0 -221
- data/docs/resources/directory.md.erb +0 -40
- data/docs/resources/docker.md.erb +0 -240
- data/docs/resources/docker_container.md.erb +0 -113
- data/docs/resources/docker_image.md.erb +0 -104
- data/docs/resources/docker_plugin.md.erb +0 -80
- data/docs/resources/docker_service.md.erb +0 -124
- data/docs/resources/elasticsearch.md.erb +0 -252
- data/docs/resources/etc_fstab.md.erb +0 -135
- data/docs/resources/etc_group.md.erb +0 -85
- data/docs/resources/etc_hosts.md.erb +0 -88
- data/docs/resources/etc_hosts_allow.md.erb +0 -84
- data/docs/resources/etc_hosts_deny.md.erb +0 -84
- data/docs/resources/file.md.erb +0 -543
- data/docs/resources/filesystem.md.erb +0 -51
- data/docs/resources/firewalld.md.erb +0 -117
- data/docs/resources/gem.md.erb +0 -108
- data/docs/resources/group.md.erb +0 -71
- data/docs/resources/grub_conf.md.erb +0 -111
- data/docs/resources/host.md.erb +0 -96
- data/docs/resources/http.md.erb +0 -207
- data/docs/resources/iis_app.md.erb +0 -132
- data/docs/resources/iis_site.md.erb +0 -145
- data/docs/resources/inetd_conf.md.erb +0 -104
- data/docs/resources/ini.md.erb +0 -86
- data/docs/resources/interface.md.erb +0 -68
- data/docs/resources/iptables.md.erb +0 -74
- data/docs/resources/json.md.erb +0 -73
- data/docs/resources/kernel_module.md.erb +0 -130
- data/docs/resources/kernel_parameter.md.erb +0 -63
- data/docs/resources/key_rsa.md.erb +0 -95
- data/docs/resources/launchd_service.md.erb +0 -67
- data/docs/resources/limits_conf.md.erb +0 -85
- data/docs/resources/login_defs.md.erb +0 -81
- data/docs/resources/mount.md.erb +0 -79
- data/docs/resources/mssql_session.md.erb +0 -78
- data/docs/resources/mysql_conf.md.erb +0 -109
- data/docs/resources/mysql_session.md.erb +0 -84
- data/docs/resources/nginx.md.erb +0 -89
- data/docs/resources/nginx_conf.md.erb +0 -148
- data/docs/resources/npm.md.erb +0 -78
- data/docs/resources/ntp_conf.md.erb +0 -70
- data/docs/resources/oneget.md.erb +0 -63
- data/docs/resources/oracledb_session.md.erb +0 -103
- data/docs/resources/os.md.erb +0 -153
- data/docs/resources/os_env.md.erb +0 -101
- data/docs/resources/package.md.erb +0 -130
- data/docs/resources/packages.md.erb +0 -77
- data/docs/resources/parse_config.md.erb +0 -113
- data/docs/resources/parse_config_file.md.erb +0 -148
- data/docs/resources/passwd.md.erb +0 -151
- data/docs/resources/pip.md.erb +0 -77
- data/docs/resources/port.md.erb +0 -147
- data/docs/resources/postgres_conf.md.erb +0 -89
- data/docs/resources/postgres_hba_conf.md.erb +0 -103
- data/docs/resources/postgres_ident_conf.md.erb +0 -86
- data/docs/resources/postgres_session.md.erb +0 -79
- data/docs/resources/powershell.md.erb +0 -112
- data/docs/resources/processes.md.erb +0 -119
- data/docs/resources/rabbitmq_config.md.erb +0 -51
- data/docs/resources/registry_key.md.erb +0 -197
- data/docs/resources/runit_service.md.erb +0 -67
- data/docs/resources/security_policy.md.erb +0 -57
- data/docs/resources/service.md.erb +0 -131
- data/docs/resources/shadow.md.erb +0 -267
- data/docs/resources/ssh_config.md.erb +0 -83
- data/docs/resources/sshd_config.md.erb +0 -93
- data/docs/resources/ssl.md.erb +0 -129
- data/docs/resources/sys_info.md.erb +0 -52
- data/docs/resources/systemd_service.md.erb +0 -67
- data/docs/resources/sysv_service.md.erb +0 -67
- data/docs/resources/upstart_service.md.erb +0 -67
- data/docs/resources/user.md.erb +0 -150
- data/docs/resources/users.md.erb +0 -137
- data/docs/resources/vbscript.md.erb +0 -65
- data/docs/resources/virtualization.md.erb +0 -67
- data/docs/resources/windows_feature.md.erb +0 -69
- data/docs/resources/windows_hotfix.md.erb +0 -63
- data/docs/resources/windows_task.md.erb +0 -95
- data/docs/resources/wmi.md.erb +0 -91
- data/docs/resources/x509_certificate.md.erb +0 -161
- data/docs/resources/xinetd_conf.md.erb +0 -166
- data/docs/resources/xml.md.erb +0 -95
- data/docs/resources/yaml.md.erb +0 -79
- data/docs/resources/yum.md.erb +0 -108
- data/docs/resources/zfs_dataset.md.erb +0 -63
- data/docs/resources/zfs_pool.md.erb +0 -57
- data/docs/shared/matcher_be.md.erb +0 -1
- data/docs/shared/matcher_cmp.md.erb +0 -43
- data/docs/shared/matcher_eq.md.erb +0 -3
- data/docs/shared/matcher_include.md.erb +0 -1
- data/docs/shared/matcher_match.md.erb +0 -1
- data/docs/shell.md +0 -217
- data/docs/style.md +0 -178
- data/examples/README.md +0 -8
- data/examples/custom-resource/README.md +0 -3
- data/examples/custom-resource/controls/example.rb +0 -7
- data/examples/custom-resource/inspec.yml +0 -8
- data/examples/custom-resource/libraries/batsignal.rb +0 -20
- data/examples/custom-resource/libraries/gordon.rb +0 -21
- data/examples/inheritance/README.md +0 -65
- data/examples/inheritance/controls/example.rb +0 -14
- data/examples/inheritance/inspec.yml +0 -16
- data/examples/kitchen-ansible/.kitchen.yml +0 -25
- data/examples/kitchen-ansible/Gemfile +0 -19
- data/examples/kitchen-ansible/README.md +0 -53
- data/examples/kitchen-ansible/files/nginx.repo +0 -6
- data/examples/kitchen-ansible/tasks/main.yml +0 -16
- data/examples/kitchen-ansible/test/integration/default/default.yml +0 -5
- data/examples/kitchen-ansible/test/integration/default/web_spec.rb +0 -28
- data/examples/kitchen-chef/.kitchen.yml +0 -20
- data/examples/kitchen-chef/Berksfile +0 -3
- data/examples/kitchen-chef/Gemfile +0 -19
- data/examples/kitchen-chef/README.md +0 -27
- data/examples/kitchen-chef/metadata.rb +0 -7
- data/examples/kitchen-chef/recipes/default.rb +0 -6
- data/examples/kitchen-chef/recipes/nginx.rb +0 -30
- data/examples/kitchen-chef/test/integration/default/web_spec.rb +0 -28
- data/examples/kitchen-puppet/.kitchen.yml +0 -23
- data/examples/kitchen-puppet/Gemfile +0 -20
- data/examples/kitchen-puppet/Puppetfile +0 -25
- data/examples/kitchen-puppet/README.md +0 -53
- data/examples/kitchen-puppet/manifests/site.pp +0 -33
- data/examples/kitchen-puppet/metadata.json +0 -11
- data/examples/kitchen-puppet/modules/.gitkeep +0 -0
- data/examples/kitchen-puppet/test/integration/default/web_spec.rb +0 -28
- data/examples/meta-profile/README.md +0 -37
- data/examples/meta-profile/controls/example.rb +0 -13
- data/examples/meta-profile/inspec.yml +0 -13
- data/examples/plugins/inspec-resource-lister/Gemfile +0 -12
- data/examples/plugins/inspec-resource-lister/LICENSE +0 -13
- data/examples/plugins/inspec-resource-lister/README.md +0 -62
- data/examples/plugins/inspec-resource-lister/Rakefile +0 -40
- data/examples/plugins/inspec-resource-lister/inspec-resource-lister.gemspec +0 -45
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister.rb +0 -16
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/cli_command.rb +0 -70
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/plugin.rb +0 -55
- data/examples/plugins/inspec-resource-lister/lib/inspec-resource-lister/version.rb +0 -10
- data/examples/plugins/inspec-resource-lister/test/fixtures/README.md +0 -24
- data/examples/plugins/inspec-resource-lister/test/functional/README.md +0 -18
- data/examples/plugins/inspec-resource-lister/test/functional/inspec_resource_lister_test.rb +0 -110
- data/examples/plugins/inspec-resource-lister/test/helper.rb +0 -26
- data/examples/plugins/inspec-resource-lister/test/unit/README.md +0 -17
- data/examples/plugins/inspec-resource-lister/test/unit/cli_args_test.rb +0 -64
- data/examples/plugins/inspec-resource-lister/test/unit/plugin_def_test.rb +0 -51
- data/examples/profile-attribute.yml +0 -2
- data/examples/profile-attribute/README.md +0 -14
- data/examples/profile-attribute/controls/example.rb +0 -11
- data/examples/profile-attribute/inspec.yml +0 -8
- data/examples/profile-aws/controls/iam_password_policy_expiration.rb +0 -8
- data/examples/profile-aws/controls/iam_password_policy_max_age.rb +0 -8
- data/examples/profile-aws/controls/iam_root_user_mfa.rb +0 -8
- data/examples/profile-aws/controls/iam_users_access_key_age.rb +0 -8
- data/examples/profile-aws/controls/iam_users_console_users_mfa.rb +0 -8
- data/examples/profile-aws/inspec.yml +0 -11
- data/examples/profile-azure/controls/azure_resource_group_example.rb +0 -24
- data/examples/profile-azure/controls/azure_vm_example.rb +0 -29
- data/examples/profile-azure/inspec.yml +0 -11
- data/examples/profile-sensitive/README.md +0 -29
- data/examples/profile-sensitive/controls/sensitive-failures.rb +0 -9
- data/examples/profile-sensitive/controls/sensitive.rb +0 -9
- data/examples/profile-sensitive/inspec.yml +0 -8
- data/examples/profile/README.md +0 -48
- data/examples/profile/controls/example.rb +0 -24
- data/examples/profile/controls/gordon.rb +0 -36
- data/examples/profile/controls/meta.rb +0 -36
- data/examples/profile/inspec.yml +0 -11
- data/examples/profile/libraries/gordon_config.rb +0 -59
@@ -1,252 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the aws_elbs Resource
|
3
|
-
platform: aws
|
4
|
-
---
|
5
|
-
|
6
|
-
# aws\_elbs
|
7
|
-
|
8
|
-
Use the `aws_elbs` InSpec audit resource to test properties of AWS Elastic Load Balancers (ELBs, also known as a Classic Load Balancers) in bulk, or to search for a group of them based on their properties.
|
9
|
-
|
10
|
-
To audit a specific ELB in detail when its name is known, use `aws_elb` (singular).
|
11
|
-
|
12
|
-
<br>
|
13
|
-
|
14
|
-
## Availability
|
15
|
-
|
16
|
-
### Installation
|
17
|
-
|
18
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
19
|
-
|
20
|
-
### Version
|
21
|
-
|
22
|
-
This resource first became available in v2.2.10 of InSpec.
|
23
|
-
|
24
|
-
## Syntax
|
25
|
-
|
26
|
-
An `aws_elb` resource block uses an optional filter to select a group of ELBs and then tests that group.
|
27
|
-
|
28
|
-
# Check that you have at aleast one ELB
|
29
|
-
describe aws_elbs do
|
30
|
-
it { should exist }
|
31
|
-
end
|
32
|
-
|
33
|
-
# Ensure that you have at least one ELB in a specific VPC
|
34
|
-
describe aws_elb.where(vpc_id: 'vpc-12345678') do
|
35
|
-
it { should exist }
|
36
|
-
end
|
37
|
-
|
38
|
-
<br>
|
39
|
-
|
40
|
-
## Filter Criteria
|
41
|
-
|
42
|
-
Use filter criteria with `where` to search for ELBs by their properties. `where` may be used in method mode (as in `aws_elbs.where(criterion: value)`) or in block mode (as in `aws_elbs.where { any code here }`). Several criteria on this resource may only be used with block-mode, because they are list-based.
|
43
|
-
|
44
|
-
### availability\_zones
|
45
|
-
|
46
|
-
An array of strings identifying which availability zones in which the load balancer is located. This criterion must be used with block-mode `where`.
|
47
|
-
|
48
|
-
# Find ELBs with a footprint in us-east-2a
|
49
|
-
describe aws_elbs.where { availability_zones.include? 'us-east-2a' } do
|
50
|
-
it { should exist }
|
51
|
-
end
|
52
|
-
|
53
|
-
### dns\_name
|
54
|
-
|
55
|
-
Returns the FQDN of the load balancer. This is the hostname which is exposed to the world.
|
56
|
-
|
57
|
-
# Find ELBs that have the letter z in their DNS name
|
58
|
-
describe aws_elbs.where(dns_name: /z/) do
|
59
|
-
it { should exist }
|
60
|
-
end
|
61
|
-
|
62
|
-
### elb\_name
|
63
|
-
|
64
|
-
The name of the ELB within AWS. The ELB name is unique within the region. If you know the full ELB name, you should use the `aws_elb` resource instead, as it is much more efficient for testing a specific ELB.
|
65
|
-
|
66
|
-
# Find ELBs whose name ends in `prod`
|
67
|
-
describe aws_elbs.where(elb_name: /prod$/) do
|
68
|
-
it { should exist }
|
69
|
-
end
|
70
|
-
|
71
|
-
### external\_ports
|
72
|
-
|
73
|
-
An array of integers reflecting the public-facing ports on which the load balancer will be listening for traffic. This criterion must be used with block-mode `where`.
|
74
|
-
|
75
|
-
# Find ELBs listening on port 80
|
76
|
-
describe aws_elbs.where { external_ports.include? 80 } do
|
77
|
-
it { should exist }
|
78
|
-
end
|
79
|
-
|
80
|
-
### instance\_ids
|
81
|
-
|
82
|
-
An array of strings reflecting the instance IDs of the EC2 instances attached to the ELB. This criterion must be used with block-mode `where`.
|
83
|
-
|
84
|
-
# Find ELBs with at least 3 instances
|
85
|
-
describe aws_elbs.where { instance_ids.count > 2 } do
|
86
|
-
it { should exist }
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
### internal\_ports
|
91
|
-
|
92
|
-
An array of integers reflecting the EC2-facing ports on which the load balancer will be sending traffic to. This criterion must be used with block-mode `where`.
|
93
|
-
|
94
|
-
# Find ELBs sending traffic to port 80
|
95
|
-
describe aws_elbs.where { internal_ports.include? 80 } do
|
96
|
-
it { should exist }
|
97
|
-
end
|
98
|
-
|
99
|
-
### security\_group\_ids
|
100
|
-
|
101
|
-
An array of strings reflecting the security group IDs (firewall rule sets) assigned to the ELB. This criterion must be used with block-mode `where`.
|
102
|
-
|
103
|
-
# Find ELBs using a particular security group
|
104
|
-
describe aws_elbs.where { security_group_ids.include? 'sg-12345678' } do
|
105
|
-
it { should exist }
|
106
|
-
end
|
107
|
-
|
108
|
-
### subnet\_ids
|
109
|
-
|
110
|
-
An array of strings reflecting the subnet IDs on which the ELB is located. This criterion must be used with block-mode `where`.
|
111
|
-
|
112
|
-
# Find ELBs located on a particular subnet
|
113
|
-
describe aws_elbs.where { subnet_ids.include? 'subnet-12345678' } do
|
114
|
-
it { should exist }
|
115
|
-
end
|
116
|
-
|
117
|
-
### vpc\_id
|
118
|
-
|
119
|
-
A String reflecting the ID of the VPC in which the ELB is located.
|
120
|
-
|
121
|
-
# Find all ELBs in a specific VPC.
|
122
|
-
describe aws_elbs.where(vpc_id: 'vpc-12345678') do
|
123
|
-
it { should exist }
|
124
|
-
end
|
125
|
-
|
126
|
-
<br>
|
127
|
-
|
128
|
-
## Properties
|
129
|
-
|
130
|
-
### availability\_zones
|
131
|
-
|
132
|
-
An array of strings identifying which availability zones in which the selected load balancers are located. The array is de-duplicated.
|
133
|
-
|
134
|
-
# Ensure none of our ELBs are in us-east-1c
|
135
|
-
describe aws_elbs do
|
136
|
-
its('availability_zones') { should_not include 'us-east-1c' }
|
137
|
-
end
|
138
|
-
|
139
|
-
### count
|
140
|
-
|
141
|
-
Returns an integer reflecting the number of matched ELBs.
|
142
|
-
|
143
|
-
# Ensure we have 4 ELBs total.
|
144
|
-
describe aws_elbs do
|
145
|
-
its('count') { should cmp 4 }
|
146
|
-
end
|
147
|
-
|
148
|
-
### dns\_names
|
149
|
-
|
150
|
-
An array of FQDNs of the selected load balancers. These are the hostnames which are exposed to the world.
|
151
|
-
|
152
|
-
# Ensure none of the DNS names are an old name
|
153
|
-
describe aws_elbs do
|
154
|
-
its('dns_names') { should_not include 'some.horrid.name' }
|
155
|
-
end
|
156
|
-
|
157
|
-
### elb\_names
|
158
|
-
|
159
|
-
The names of the selected ELBs within AWS. The ELB name is unique within the region.
|
160
|
-
|
161
|
-
# You can use this to enumerate the ELBs for detailed tests
|
162
|
-
# Search using the plural, analyze using the singular.
|
163
|
-
aws_elbs.where { instance_ports.include? 80 }.elb_names.each do |elb_name|
|
164
|
-
describe aws_elb(elb_name) do
|
165
|
-
its('security_group_ids') { should include 'sg-12345678' }
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
### external\_ports
|
170
|
-
|
171
|
-
An array of integers reflecting the public-facing ports on which the selected load balancers will be listening for traffic. The array is de-duplicated.
|
172
|
-
|
173
|
-
# Ensure that the only ports we are listening on are 80 and 443
|
174
|
-
describe aws_elbs do
|
175
|
-
its('external_ports') { should include 80 }
|
176
|
-
its('external_ports') { should include 443 }
|
177
|
-
its('external_ports.count') { should cmp 2 }
|
178
|
-
end
|
179
|
-
|
180
|
-
|
181
|
-
### instance\_ids
|
182
|
-
|
183
|
-
An array of strings reflecting the instance IDs of the EC2 instances attached to the selected ELBs.
|
184
|
-
|
185
|
-
# Ensure there are 10-20 instances total attached to all ELBs
|
186
|
-
describe aws_elbs do
|
187
|
-
its('instance_ids.count') { should be >= 10 }
|
188
|
-
its('instance_ids.count') { should be <= 20 }
|
189
|
-
end
|
190
|
-
|
191
|
-
### internal\_ports
|
192
|
-
|
193
|
-
An array of integers reflecting the EC2-facing ports on which the selected load balancers will be sending traffic to. The array is de-duplicated.
|
194
|
-
|
195
|
-
# Ensure all ELBs only talk to port 80
|
196
|
-
describe aws_elbs do
|
197
|
-
its('internal_ports') { should contain 80 }
|
198
|
-
its('internal_ports.count') { should cmp 1 }
|
199
|
-
end
|
200
|
-
|
201
|
-
### security\_group\_ids
|
202
|
-
|
203
|
-
An array of strings reflecting the security group IDs (firewall rule sets) assigned to the selected ELBs. The array is de-duplicated.
|
204
|
-
|
205
|
-
# Ensure all ELBs are using one specific security group
|
206
|
-
describe aws_elbs do
|
207
|
-
its('security_group_ids') { should include 'sg-12345678' }
|
208
|
-
its('security_group_ids.count') { should cmp 1 }
|
209
|
-
end
|
210
|
-
|
211
|
-
### subnet\_ids
|
212
|
-
|
213
|
-
An array of strings reflecting the subnet IDs on which the selected ELBs are located. The array is de-duplicated.
|
214
|
-
|
215
|
-
# Ensure all ELBs are on a particular subnet
|
216
|
-
describe aws_elbs do
|
217
|
-
its('subnet_ids') { should include 'subnet-12345678' }
|
218
|
-
its('subnet_ids.count') { should cmp 1 }
|
219
|
-
end
|
220
|
-
|
221
|
-
### vpc\_ids
|
222
|
-
|
223
|
-
An array of strings reflecting the ID of the VPCs in which the selected ELBs are located. The array is de-duplicated.
|
224
|
-
|
225
|
-
# Ensure all ELBs are in one VPC
|
226
|
-
describe aws_elbs do
|
227
|
-
its('vpc_ids.count') { should cmp 1 }
|
228
|
-
end
|
229
|
-
|
230
|
-
## Matchers
|
231
|
-
|
232
|
-
This InSpec audit resource has the following resource-specific matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/).
|
233
|
-
|
234
|
-
### exists
|
235
|
-
|
236
|
-
The audit test will pass if at least one ELB was matched by the filter. Use with `should_not` to test for absence.
|
237
|
-
|
238
|
-
# We like z's in our DNS names
|
239
|
-
describe aws_elbs.where(dns_name: /z/) do
|
240
|
-
it { should exist }
|
241
|
-
end
|
242
|
-
|
243
|
-
# But k's are just awful
|
244
|
-
describe aws_elbs.where(dns_name: /k/) do
|
245
|
-
it { should_not exist }
|
246
|
-
end
|
247
|
-
|
248
|
-
## AWS Permissions
|
249
|
-
|
250
|
-
Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `elasticloadbalancing:DescribeLoadBalancers` action set to Allow.
|
251
|
-
|
252
|
-
You can find detailed documentation at [Authentication and Access Control for Your Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/load-balancer-authentication-access-control.html)
|
@@ -1,128 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the aws_flow_log Resource
|
3
|
-
platform: aws
|
4
|
-
---
|
5
|
-
|
6
|
-
# aws\_flow\_log
|
7
|
-
|
8
|
-
Use the `aws_flow_log` InSpec audit resource to test properties of a single Flow Log.
|
9
|
-
|
10
|
-
## Availability
|
11
|
-
|
12
|
-
### Installation
|
13
|
-
|
14
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
15
|
-
|
16
|
-
### Version
|
17
|
-
|
18
|
-
This resource first became available in v2.2.10 of InSpec.
|
19
|
-
|
20
|
-
## Syntax
|
21
|
-
|
22
|
-
describe aws_flow_log('fl-9c718cf5') do
|
23
|
-
it { should exist }
|
24
|
-
end
|
25
|
-
|
26
|
-
## Resource Parameters
|
27
|
-
### flow\_log\_id
|
28
|
-
|
29
|
-
This resource accepts a single parameter or other search terms. You may pass it as a string, or as the value in a hash:
|
30
|
-
|
31
|
-
describe aws_flow_log('fl-9c718cf5') do
|
32
|
-
it { should exist }
|
33
|
-
end
|
34
|
-
|
35
|
-
describe aws_flow_log(flow_log_id: 'fl-8905f8e0') do
|
36
|
-
it { should exist }
|
37
|
-
end
|
38
|
-
|
39
|
-
### subnet\_id
|
40
|
-
|
41
|
-
To search for a flow log by the associated subnet id:
|
42
|
-
|
43
|
-
describe aws_flow_log(subnet_id: 'subnet-c6a4319c') do
|
44
|
-
it { should exist }
|
45
|
-
end
|
46
|
-
|
47
|
-
### vpc\_id
|
48
|
-
|
49
|
-
To search for a flow log by the associated vpc id:
|
50
|
-
|
51
|
-
describe aws_flow_log(vpc_id: 'vpc-96cabaef') do
|
52
|
-
it { should exist }
|
53
|
-
end
|
54
|
-
|
55
|
-
## Properties
|
56
|
-
### flow\_log\_id
|
57
|
-
|
58
|
-
The `flow_log_id` property tests the name of the flow log.
|
59
|
-
|
60
|
-
describe aws_flow_log(subnet_id: 'subnet-c6a4319c') do
|
61
|
-
its('flow_log_id') { should cmp 'fl-9c718cf5' }
|
62
|
-
end
|
63
|
-
|
64
|
-
### log\_group\_name
|
65
|
-
|
66
|
-
The `log_group_name` property tests the name of the associated log group.
|
67
|
-
|
68
|
-
describe aws_flow_log('fl-9c718cf5') do
|
69
|
-
its('log_group_name') { should cmp 'test_log_group' }
|
70
|
-
end
|
71
|
-
|
72
|
-
### resource\_id
|
73
|
-
|
74
|
-
The `resource_id` property tests the id of the associated VPC, subnet, or network interface.
|
75
|
-
|
76
|
-
describe aws_flow_log('fl-9c718cf5') do
|
77
|
-
its('resource_id') { should cmp 'subnet-c6a4319c' }
|
78
|
-
end
|
79
|
-
|
80
|
-
### resource\_type
|
81
|
-
|
82
|
-
The `resource_type` property tests the type of resource the Flow Log is attached to.
|
83
|
-
The property will return `eni`, `subnet`, or `vpc`.
|
84
|
-
|
85
|
-
describe aws_flow_log('fl-9c718cf5') do
|
86
|
-
its('resource_type') { should cmp 'subnet' }
|
87
|
-
end
|
88
|
-
|
89
|
-
## Matchers
|
90
|
-
|
91
|
-
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
92
|
-
|
93
|
-
### exist
|
94
|
-
|
95
|
-
Indicates that the Flow Log provided was found. Use `should_not` to test for Flow Logs that should not exist.
|
96
|
-
|
97
|
-
describe aws_flow_log('should-be-there') do
|
98
|
-
it { should exist }
|
99
|
-
end
|
100
|
-
|
101
|
-
describe aws_flow_log('should-not-be-there') do
|
102
|
-
it { should_not exist }
|
103
|
-
end
|
104
|
-
|
105
|
-
### be\_attached\_to\_eni
|
106
|
-
|
107
|
-
Indicates that the Flow Log is attached to a ENI resource.
|
108
|
-
|
109
|
-
describe aws_flow_log('fl-9c718cf5') do
|
110
|
-
it { should be_attached_to_eni }
|
111
|
-
end
|
112
|
-
|
113
|
-
### be\_attached\_to\_subnet
|
114
|
-
|
115
|
-
Indicates that the Flow Log is attached to a subnet resource.
|
116
|
-
|
117
|
-
describe aws_flow_log('fl-9c718cf5') do
|
118
|
-
it { should be_attached_to_subnet }
|
119
|
-
end
|
120
|
-
|
121
|
-
### be\_attached\_to\_vpc
|
122
|
-
|
123
|
-
Indicates that the Flow Log is attached to a vpc resource.
|
124
|
-
|
125
|
-
describe aws_flow_log('fl-9c718cf5') do
|
126
|
-
it { should be_attached_to_vpc }
|
127
|
-
end
|
128
|
-
|
@@ -1,139 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: About the aws_iam_access_key Resource
|
3
|
-
platform: aws
|
4
|
-
---
|
5
|
-
|
6
|
-
# aws\_iam\_access\_key
|
7
|
-
|
8
|
-
Use the `aws_iam_access_key` InSpec audit resource to test properties of a single AWS IAM access key.
|
9
|
-
|
10
|
-
<br>
|
11
|
-
|
12
|
-
## Availability
|
13
|
-
|
14
|
-
### Installation
|
15
|
-
|
16
|
-
This resource is distributed along with InSpec itself. You can use it automatically.
|
17
|
-
|
18
|
-
### Version
|
19
|
-
|
20
|
-
This resource first became available in v2.0.16 of InSpec.
|
21
|
-
|
22
|
-
## Syntax
|
23
|
-
|
24
|
-
An `aws_iam_access_key` resource block declares the tests for a single AWS IAM access key. An access key is uniquely identified by its access key id.
|
25
|
-
|
26
|
-
# This is unique - the key will either exist or it won't, but it will never be an error.
|
27
|
-
describe aws_iam_access_key(access_key_id: 'AKIA12345678ABCD') do
|
28
|
-
it { should exist }
|
29
|
-
it { should_not be_active }
|
30
|
-
its('create_date') { should be > Time.now - 365 * 86400 }
|
31
|
-
its('last_used_date') { should be > Time.now - 90 * 86400 }
|
32
|
-
end
|
33
|
-
|
34
|
-
# id is an alias for access_key_id
|
35
|
-
describe aws_iam_access_key(id: 'AKIA12345678ABCD') do
|
36
|
-
# Same
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
Access keys are associated with IAM users, who may have zero, one or two access keys. You may also lookup an access key by username. If the user has more than one access key, an error occurs (You may use `aws_iam_access_keys` with the `username` resource parameter to access a user's keys when they have multiple keys.)
|
41
|
-
|
42
|
-
# This is not unique. If the user has zero or one keys, it is not an error.
|
43
|
-
# If they have two, it is an error.
|
44
|
-
describe aws_iam_access_key(username: 'roderick') do
|
45
|
-
it { should exist }
|
46
|
-
it { should be_active }
|
47
|
-
end
|
48
|
-
|
49
|
-
You may also use both username and access key id to ensure that a particular key is associated with a particular user.
|
50
|
-
|
51
|
-
describe aws_iam_access_key(username: 'roderick', access_key_id: 'AKIA12345678ABCD') do
|
52
|
-
it { should exist }
|
53
|
-
end
|
54
|
-
|
55
|
-
<br>
|
56
|
-
|
57
|
-
## Examples
|
58
|
-
|
59
|
-
The following examples show how to use this InSpec audit resource.
|
60
|
-
|
61
|
-
### Test that an IAM access key is not active
|
62
|
-
|
63
|
-
describe aws_iam_access_key(username: 'username', id: 'access-key-id') do
|
64
|
-
it { should_not be_active }
|
65
|
-
end
|
66
|
-
|
67
|
-
### Test that an IAM access key is older than one year
|
68
|
-
|
69
|
-
describe aws_iam_access_key(username: 'username', id: 'access-key-id') do
|
70
|
-
its('create_date') { should be > Time.now - 365 * 86400 }
|
71
|
-
end
|
72
|
-
|
73
|
-
### Test that an IAM access key has been used in the past 90 days
|
74
|
-
|
75
|
-
describe aws_iam_access_key(username: 'username', id: 'access-key-id') do
|
76
|
-
its('last_used_date') { should be > Time.now - 90 * 86400 }
|
77
|
-
end
|
78
|
-
|
79
|
-
<br>
|
80
|
-
|
81
|
-
## Properties
|
82
|
-
|
83
|
-
* `access_key_id`, `create_date`, `last_used_date`, `username`
|
84
|
-
|
85
|
-
<br>
|
86
|
-
|
87
|
-
## Property Examples
|
88
|
-
|
89
|
-
### access\_key\_id
|
90
|
-
|
91
|
-
The unique ID of this access key.
|
92
|
-
|
93
|
-
describe aws_iam_access_key(username: 'bob')
|
94
|
-
its('access_key_id') { should cmp 'AKIA12345678ABCD' }
|
95
|
-
end
|
96
|
-
|
97
|
-
### create\_date
|
98
|
-
|
99
|
-
The date and time, as a Ruby DateTime, at which the access key was created.
|
100
|
-
|
101
|
-
# Is the access key less than a year old?
|
102
|
-
describe aws_iam_access_key(username: 'bob')
|
103
|
-
its('create_date') { should be > Time.now - 365 * 86400 }
|
104
|
-
end
|
105
|
-
|
106
|
-
### last\_used\_date
|
107
|
-
|
108
|
-
The date and time, as a Ruby DateTime, at which the access key was last_used.
|
109
|
-
|
110
|
-
# Has the access key been used in the last year?
|
111
|
-
describe aws_iam_access_key(username: 'bob')
|
112
|
-
its('last_used_date') { should be > Time.now - 365 * 86400 }
|
113
|
-
end
|
114
|
-
|
115
|
-
### username
|
116
|
-
|
117
|
-
The IAM user that owns this key.
|
118
|
-
|
119
|
-
describe aws_iam_access_key(access_key_id: 'AKIA12345678ABCD')
|
120
|
-
its('username') { should cmp 'bob' }
|
121
|
-
end
|
122
|
-
|
123
|
-
<br>
|
124
|
-
|
125
|
-
## Matchers
|
126
|
-
|
127
|
-
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
128
|
-
|
129
|
-
### be\_active
|
130
|
-
|
131
|
-
The `be_active` matcher tests if the described IAM access key is active.
|
132
|
-
|
133
|
-
it { should be_active }
|
134
|
-
|
135
|
-
## AWS Permissions
|
136
|
-
|
137
|
-
Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `iam:ListAccessKeys` action with Effect set to Allow.
|
138
|
-
|
139
|
-
You can find detailed documentation at [Actions, Resources, and Condition Keys for Identity And Access Management](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_identityandaccessmanagement.html).
|