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
data/docs/habitat.md
DELETED
@@ -1,193 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: InSpec Integration with Habitat
|
3
|
-
---
|
4
|
-
|
5
|
-
# Habitat Integration
|
6
|
-
|
7
|
-
InSpec provides an easy method to create an executable Habitat package for an InSpec profile. When run via the Habitat Supervisor, the package will run InSpec with your profile and write out its findings to a JSON file. This provides the ability to ship your compliance controls alongside your Habitat-packaged application and continuously run InSpec, providing you *Continuous Compliance.*
|
8
|
-
|
9
|
-
## What is Habitat
|
10
|
-
|
11
|
-
Habitat by Chef is our new Application Automation tool that aims to make it easy, safe, and fast to build, deploy, and manage applications. From build dependencies, runtime dependencies, dynamic configuration, and service discovery (just to name a few), Habitat packages the automation with the application instead of relying on an underlying platform.
|
12
|
-
|
13
|
-
To learn more about Habitat and try our demos and tutorials, visit [https://www.habitat.sh](https://www.habitat.sh).
|
14
|
-
|
15
|
-
## Using the Habitat Integration
|
16
|
-
|
17
|
-
After creating a Habitat package for an InSpec profile (see CLI commands below) and uploading the package to a Habitat Depot or manually distributing to a host, start the Habitat Supervisor with your package:
|
18
|
-
|
19
|
-
```bash
|
20
|
-
hab start adamleff/inspec-profile-frontend1
|
21
|
-
```
|
22
|
-
|
23
|
-
The Habitat Supervisor will install InSpec and execute your profile in a loop. By default, the loop runs every 300 seconds but can be changed via the `sleep_time` configuration value:
|
24
|
-
|
25
|
-
```bash
|
26
|
-
HAB_INSPEC_PROFILE_FRONTEND1="sleep_time = 60" hab start adamleff/inspec-profile-frontend1
|
27
|
-
```
|
28
|
-
|
29
|
-
The Habitat Supervisor will display output like this:
|
30
|
-
|
31
|
-
```text
|
32
|
-
hab start adamleff/inspec-profile-frontend1
|
33
|
-
∵ Missing package for core/hab-sup/0.17.0
|
34
|
-
» Installing core/hab-sup/0.17.0
|
35
|
-
↓ Downloading core/hab-sup/0.17.0/20170214235450
|
36
|
-
1.68 MB / 1.68 MB - [=========================================================================] 100.00 % 7.43 MB/s
|
37
|
-
|
38
|
-
... more Habitat output here ...
|
39
|
-
|
40
|
-
hab-sup(MN): Starting adamleff/inspec-profile-frontend1/0.1.0/20170328173005
|
41
|
-
hab-sup(CS): adamleff/inspec-profile-frontend1/0.1.0/20170328173005 is not installed
|
42
|
-
↓ Downloading adamleff-20160617201047 public origin key
|
43
|
-
79 B / 79 B | [===============================================================================] 100.00 % 2.64 MB/s
|
44
|
-
☑ Cached adamleff-20160617201047 public origin key
|
45
|
-
↓ Downloading chef/inspec/1.17.0/20170321214949
|
46
|
-
16.93 MB / 16.93 MB / [======================================================================] 100.00 % 10.49 MB/s
|
47
|
-
|
48
|
-
... more Habitat output here ...
|
49
|
-
|
50
|
-
★ Install of adamleff/inspec-profile-frontend1/0.1.0/20170328173005 complete with 9 new packages installed.
|
51
|
-
hab-sup(MR): Butterfly Member ID d9bd761e18c144469d755b1b97406eb2
|
52
|
-
hab-sup(MR): Starting butterfly on 0.0.0.0:9638
|
53
|
-
hab-sup(MR): Starting http-gateway on 0.0.0.0:9631
|
54
|
-
inspec-profile-frontend1.default(SR): Initializing
|
55
|
-
inspec-profile-frontend1.default(SV): Starting process as user=hab, group=hab
|
56
|
-
inspec-profile-frontend1.default(O): Executing InSpec for adamleff/inspec-profile-frontend1
|
57
|
-
inspec-profile-frontend1.default(O): InSpec run completed successfully.
|
58
|
-
inspec-profile-frontend1.default(O): sleeping for 300 seconds
|
59
|
-
```
|
60
|
-
|
61
|
-
The above sample output shows the supervisor starting, downloading the necessary dependencies for the supervisor and the InSpec profile, and then shows the supervisor running InSpec successfully.
|
62
|
-
|
63
|
-
InSpec will write a JSON file in the `${svc_var_path}/inspec_results` directory containing the results of the last InSpec run. For example, for the `adamleff/inspec-profile-frontend1` package, the InSpec results will be at:
|
64
|
-
|
65
|
-
```text
|
66
|
-
/hab/svc/inspec-profile-frontend1/var/inspec_results/inspec-profile-frontend1.json
|
67
|
-
```
|
68
|
-
|
69
|
-
## InSpec Habitat CLI Commands
|
70
|
-
|
71
|
-
### inspec habitat profile create
|
72
|
-
|
73
|
-
Create a Habitat package for an InSpec profile. InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. The resulting package will be saved to the current working directory.
|
74
|
-
|
75
|
-
The package file will be named:
|
76
|
-
|
77
|
-
```text
|
78
|
-
HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
|
79
|
-
```
|
80
|
-
|
81
|
-
For example:
|
82
|
-
|
83
|
-
```text
|
84
|
-
adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
|
85
|
-
```
|
86
|
-
|
87
|
-
#### Syntax
|
88
|
-
|
89
|
-
```bash
|
90
|
-
inspec habitat profile create PROFILE_DIRECTORY
|
91
|
-
```
|
92
|
-
|
93
|
-
Example:
|
94
|
-
|
95
|
-
```bash
|
96
|
-
inspec habitat profile create ~/profiles/frontend1
|
97
|
-
```
|
98
|
-
|
99
|
-
### inspec habitat profile create
|
100
|
-
|
101
|
-
Create a Habitat package for an InSpec profile. InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. The resulting package will be saved to the current working directory.
|
102
|
-
|
103
|
-
The package can then be manually uploaded to a Habitat Depot or manually distributed to a host and installed via `hab pkg install`.
|
104
|
-
|
105
|
-
The package file will be named:
|
106
|
-
|
107
|
-
```text
|
108
|
-
HABITAT_ORIGIN-inspec-profile-PROFILE_NAME-PROFILE_VERSION-BUILD_ID-x86_64-linux.hart
|
109
|
-
```
|
110
|
-
|
111
|
-
For example:
|
112
|
-
|
113
|
-
```text
|
114
|
-
adamleff-inspec-profile-frontend1-0.1.0-20170328173005-x86_64-linux.hart
|
115
|
-
```
|
116
|
-
|
117
|
-
#### Syntax
|
118
|
-
|
119
|
-
```bash
|
120
|
-
inspec habitat profile create PROFILE_DIRECTORY
|
121
|
-
```
|
122
|
-
|
123
|
-
#### Example
|
124
|
-
|
125
|
-
```bash
|
126
|
-
inspec habitat profile create ~/profiles/frontend1
|
127
|
-
```
|
128
|
-
|
129
|
-
#### Example Output
|
130
|
-
|
131
|
-
```text
|
132
|
-
$ habitat profile create ~/profiles/frontend1
|
133
|
-
[2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
|
134
|
-
[2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
|
135
|
-
[2017-03-28T13:29:32-04:00] INFO: Copying profile contents to the work directory...
|
136
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating Habitat plan at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/plan.sh...
|
137
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating a Habitat run hook at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/hooks/run...
|
138
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating Habitat's default.toml configuration...
|
139
|
-
[2017-03-28T13:29:32-04:00] INFO: Building our Habitat artifact...
|
140
|
-
hab-studio: Destroying Studio at /hab/studios/src (default)
|
141
|
-
hab-studio: Creating Studio at /hab/studios/src (default)
|
142
|
-
hab-studio: Importing adamleff secret origin key
|
143
|
-
» Importing origin key from standard input
|
144
|
-
★ Imported secret origin key adamleff-20160617201047.
|
145
|
-
» Installing core/hab-backline
|
146
|
-
↓ Downloading core/hab-backline/0.19.0/20170311034116
|
147
|
-
2.17 KB / 2.17 KB / [=========================================================================] 100.00 % 4.33 MB/s
|
148
|
-
|
149
|
-
... more Habitat output here...
|
150
|
-
|
151
|
-
[2017-03-28T13:30:18-04:00] INFO: Copying artifact to /Users/aleff...
|
152
|
-
```
|
153
|
-
|
154
|
-
### inspec habitat profile upload
|
155
|
-
|
156
|
-
Create and then upload a Habitat package for an InSpec profile. Like the `inspec habitat profile create` command, InSpec will validate the profile, fetch and vendor any dependencies (if necessary), and build the Habitat package with a dependency on the latest InSpec. However, instead of saving the package locally to the workstation, InSpec will upload it to the depot defined in the `HAB_DEPOT` environment variable. If `HAB_DEPOT` is not defined, the package will be uploaded to the public Habitat depot at [https://app.habitat.sh](https://app.habitat.sh).
|
157
|
-
|
158
|
-
#### Syntax
|
159
|
-
|
160
|
-
```bash
|
161
|
-
inspec habitat profile upload PROFILE_DIRECTORY
|
162
|
-
```
|
163
|
-
|
164
|
-
#### Example
|
165
|
-
|
166
|
-
```bash
|
167
|
-
inspec habitat profile upload ~/profiles/frontend1
|
168
|
-
```
|
169
|
-
|
170
|
-
#### Example Output
|
171
|
-
|
172
|
-
```text
|
173
|
-
[2017-03-28T13:29:32-04:00] INFO: Creating a Habitat artifact for profile: /Users/aleff/profiles/frontend1
|
174
|
-
[2017-03-28T13:29:32-04:00] INFO: Checking to see if Habitat is installed...
|
175
|
-
[2017-03-28T13:29:32-04:00] INFO: Copying profile contents to the work directory...
|
176
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating Habitat plan at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/plan.sh...
|
177
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating a Habitat run hook at /var/folders/v5/z54gb76j2rs3wrn65hmtyf1r0000gp/T/inspec-habitat-exporter20170328-4932-kg2ltd/habitat/hooks/run...
|
178
|
-
[2017-03-28T13:29:32-04:00] INFO: Generating Habitat's default.toml configuration...
|
179
|
-
[2017-03-28T13:29:32-04:00] INFO: Building our Habitat artifact...
|
180
|
-
hab-studio: Destroying Studio at /hab/studios/src (default)
|
181
|
-
hab-studio: Creating Studio at /hab/studios/src (default)
|
182
|
-
hab-studio: Importing adamleff secret origin key
|
183
|
-
» Importing origin key from standard input
|
184
|
-
★ Imported secret origin key adamleff-20160617201047.
|
185
|
-
» Installing core/hab-backline
|
186
|
-
↓ Downloading core/hab-backline/0.19.0/20170311034116
|
187
|
-
2.17 KB / 2.17 KB / [=========================================================================] 100.00 % 4.33 MB/s
|
188
|
-
|
189
|
-
... more Habitat output here...
|
190
|
-
|
191
|
-
[2017-03-28T13:30:18-04:00] INFO: Uploading the Habitat artifact to our Depot...
|
192
|
-
[2017-03-28T13:30:23-04:00] INFO: Upload complete!
|
193
|
-
```
|
data/docs/inspec_and_friends.md
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: InSpec and friends
|
3
|
-
---
|
4
|
-
|
5
|
-
# InSpec and friends
|
6
|
-
|
7
|
-
This page looks at projects that are similar to InSpec to explain how they
|
8
|
-
relate to each other.
|
9
|
-
|
10
|
-
## RSpec
|
11
|
-
|
12
|
-
RSpec is an awesome framework that is widely used by software engineers to test
|
13
|
-
Ruby code. It enables test-driven development (TDD) and helps developers to write
|
14
|
-
better code every day.
|
15
|
-
|
16
|
-
InSpec is built on top of RSpec and uses it as the underlying foundation
|
17
|
-
to execute tests. It uses the key strengths of RSpec, easily execute
|
18
|
-
tests and a DSL to write tests, but extends the functionality for use as
|
19
|
-
compliance audits. InSpec ships with custom audit resources that make it
|
20
|
-
easy to write audit checks and with the ability to run those checks on
|
21
|
-
remote servers. These audit resources provided know the differences
|
22
|
-
between operating systems and help you abstract from the local operating
|
23
|
-
system, similar to other resources you might use in your Chef recipes.
|
24
|
-
|
25
|
-
A complete InSpec rule looks like:
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
control "sshd-11" do
|
29
|
-
impact 1.0
|
30
|
-
title "Server: Set protocol version to SSHv2"
|
31
|
-
desc "Set the SSH protocol version to 2. Don't use legacy
|
32
|
-
insecure SSHv1 connections anymore."
|
33
|
-
tag security: "level-1"
|
34
|
-
tag "openssh-server"
|
35
|
-
ref "Server Security Guide v.1.0", url: "http://..."
|
36
|
-
|
37
|
-
describe sshd_config do
|
38
|
-
its('Protocol') { should eq('2') }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
```
|
42
|
-
|
43
|
-
That said, InSpec is not RSpec. Some key differences:
|
44
|
-
|
45
|
-
* In InSpec, `describe` blocks should not be nested; instead use `control` blocks to describe a higher-level grouping of tests.
|
46
|
-
* The RSpec `shared_example` construct is not supported. Instead, create a simple custom resource that executes repetitious tasks.
|
47
|
-
* InSpec is aimed at compliance practitioners and infrastructure testers, so our focus is providing a few, well-supported, easy-to-use [universal matchers](https://www.inspec.io/docs/reference/matchers/), such as `cmp`. In contrast, RSpec is a tool designed for software engineers. It thus supports a very large range of matchers, to enable testing of software engineering constructs such as exceptions, Object Oriented Programming relationships, and so on.
|
48
|
-
* While InSpec uses parts of the RSpec project and codebase, it is a separate project from InSpec. Rspec's release schedule and feature set are beyond the control of the InSpec team. While it is possible to use many of the RSpec core features within InSpec profiles, InSpec can only guarantee that the features described at [docs.inspec.io](https://docs.inspec.io) will function correctly. Some RSpec core functionality may be removed in future versions of InSpec as needed to ensure stability in the InSpec project.
|
49
|
-
|
50
|
-
## Serverspec
|
51
|
-
|
52
|
-
Serverspec is the first extension of RSpec that enabled
|
53
|
-
users to run RSpec tests on servers to verify deployed artifacts. It was
|
54
|
-
created in March 2013 by Gosuke Miyashita and has been widely adopted.
|
55
|
-
It is also one of the core test frameworks within test-kitchen and has
|
56
|
-
been widely used within the Chef ecosystem. InSpec takes lessons learned
|
57
|
-
implementing and using Serverspec and builds on them to make auditing
|
58
|
-
and compliance easier.
|
59
|
-
|
60
|
-
Lessons learned from Serverspec include:
|
61
|
-
|
62
|
-
* IT, compliance, and security professional require metadata beyond what Serverspec offers, such as criticality, to fully describe controls.
|
63
|
-
* Setting up and running the same tests across multiple machines must be easy.
|
64
|
-
* It must be easy to locate, debug, and extend operating system-dependent code.
|
65
|
-
* It must be easy to extend the language and create custom resources.
|
66
|
-
* It must run multiple tests simultaneously.
|
67
|
-
* Support for Windows is a first-class requirement.
|
68
|
-
* A command line interface (CLI) is required for faster iteration of test code.
|
69
|
-
|
70
|
-
You can also watch this [podcast](http://foodfightshow.org/2016/02/inspec.html) to find out more on the relationship of InSpec and Serverspec.
|
71
|
-
|
72
|
-
### How is InSpec different from Serverspec
|
73
|
-
|
74
|
-
One of the key differences is that InSpec targets more user groups. It
|
75
|
-
is optimized for DevOps, Security, and Compliance professionals.
|
76
|
-
Additional metadata, such as impact, title, and description, make it
|
77
|
-
easier to fully describe the controls which makes it easier to share the
|
78
|
-
controls with other departments. This enables Security departments to
|
79
|
-
prioritize rules. DevOps teams use this information to focus on the most
|
80
|
-
critical issues to remediate.
|
81
|
-
|
82
|
-
```ruby
|
83
|
-
control "sshd-11" do
|
84
|
-
impact 1.0
|
85
|
-
title "Server: Set protocol version to SSHv2"
|
86
|
-
desc "Set the SSH protocol version to 2. Don't use legacy
|
87
|
-
insecure SSHv1 connections anymore."
|
88
|
-
tag security: "level-1"
|
89
|
-
tag "openssh-server"
|
90
|
-
ref "Server Security Guide v.1.0" url: "http://..."
|
91
|
-
|
92
|
-
describe sshd_config do
|
93
|
-
its('Protocol') { should cmp 2 }
|
94
|
-
end
|
95
|
-
end
|
96
|
-
```
|
97
|
-
|
98
|
-
**Why not fork Serverspec?**
|
99
|
-
|
100
|
-
InSpec started as an extension of Serverspec. As the extension grew, it
|
101
|
-
became clear that a new library was required. Creating and maintaining a
|
102
|
-
fork was not practical so a new project was born.
|
103
|
-
|
104
|
-
**Will InSpec only work on machines managed by Chef?**
|
105
|
-
|
106
|
-
No, InSpec can be used on any machine. It doesn’t matter if that machine
|
107
|
-
was configured by Chef or configured lovingly by the hands of your local
|
108
|
-
System Administrator.
|
109
|
-
|
110
|
-
**Is InSpec a replacement of Serverspec?**
|
111
|
-
|
112
|
-
InSpec is intended to be a drop-in replacement of Serverspec. Popular
|
113
|
-
Serverspec resources have been ported to InSpec. It changed some
|
114
|
-
behaviour as documented in our migration guide.
|
data/docs/matchers.md
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: InSpec Universal Matchers Reference
|
3
|
-
---
|
4
|
-
|
5
|
-
# InSpec Universal Matchers Reference
|
6
|
-
|
7
|
-
InSpec uses matchers to help compare resource values to expectations.
|
8
|
-
The following matchers are available:
|
9
|
-
|
10
|
-
You may also use any matcher provided by [RSpec::Expectations](https://relishapp.com/rspec/rspec-expectations/docs), but those matchers are outside of InSpec's [scope of support](https://www.inspec.io/docs/reference/inspec_and_friends/#rspec).
|
11
|
-
|
12
|
-
The following InSpec-supported universal matchers are available:
|
13
|
-
|
14
|
-
* [`be`](#be) - make numeric comparisons
|
15
|
-
* [`be_in`](#be_in) - look for the property value in a list
|
16
|
-
* [`cmp`](#cmp) - general-use equality (try this first)
|
17
|
-
* [`eq`](#eq) - type-specific equality
|
18
|
-
* [`include`](#include) - look for an expected value in a list-valued property
|
19
|
-
* [`match`](#match) - look for patterns in text using regular expressions
|
20
|
-
|
21
|
-
See [Explore InSpec resources](https://learn.chef.io/modules/explore-inspec-resources#/) on Learn Chef Rally to learn more about InSpec's built-in matchers.
|
22
|
-
|
23
|
-
## be
|
24
|
-
|
25
|
-
This matcher can be followed by many different comparison operators.
|
26
|
-
Always make sure to use numbers, not strings, for these comparisons.
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
describe file('/proc/cpuinfo') do
|
30
|
-
its('size') { should be >= 10 }
|
31
|
-
its('size') { should be < 1000 }
|
32
|
-
end
|
33
|
-
```
|
34
|
-
|
35
|
-
## cmp
|
36
|
-
|
37
|
-
Unlike `eq`, `cmp` is a matcher for less-restrictive comparisons. It will
|
38
|
-
try to fit the actual value to the type you are comparing it to. This is
|
39
|
-
meant to relieve the user from having to write type-casts and
|
40
|
-
resolutions.
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
describe sshd_config do
|
44
|
-
its('Protocol') { should cmp 2 }
|
45
|
-
end
|
46
|
-
|
47
|
-
describe passwd.uid(0) do
|
48
|
-
its('users') { should cmp 'root' }
|
49
|
-
end
|
50
|
-
```
|
51
|
-
|
52
|
-
`cmp` behaves in the following way:
|
53
|
-
|
54
|
-
* Compare strings to numbers
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
describe sshd_config do
|
58
|
-
its('Protocol') { should eq '2' }
|
59
|
-
|
60
|
-
its('Protocol') { should cmp '2' }
|
61
|
-
its('Protocol') { should cmp 2 }
|
62
|
-
end
|
63
|
-
```
|
64
|
-
|
65
|
-
* String comparisons are not case-sensitive
|
66
|
-
|
67
|
-
```ruby
|
68
|
-
describe auditd_conf do
|
69
|
-
its('log_format') { should cmp 'raw' }
|
70
|
-
its('log_format') { should cmp 'RAW' }
|
71
|
-
end
|
72
|
-
```
|
73
|
-
|
74
|
-
* Recognize versions embedded in strings
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
describe package(curl) do
|
78
|
-
its('version') { should cmp > '7.35.0-1ubuntu2.10' }
|
79
|
-
end
|
80
|
-
```
|
81
|
-
|
82
|
-
* Compare arrays with only one entry to a value
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
describe passwd.uids(0) do
|
86
|
-
its('users') { should cmp 'root' }
|
87
|
-
its('users') { should cmp ['root'] }
|
88
|
-
end
|
89
|
-
```
|
90
|
-
|
91
|
-
* Single-value arrays of strings may also be compared to a regex
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
describe auditd_conf do
|
95
|
-
its('log_format') { should cmp /raw/i }
|
96
|
-
end
|
97
|
-
```
|
98
|
-
|
99
|
-
* Improved printing of octal comparisons
|
100
|
-
|
101
|
-
```ruby
|
102
|
-
describe file('/proc/cpuinfo') do
|
103
|
-
its('mode') { should cmp '0345' }
|
104
|
-
end
|
105
|
-
|
106
|
-
expected: 0345
|
107
|
-
got: 0444
|
108
|
-
```
|
109
|
-
|
110
|
-
## eq
|
111
|
-
|
112
|
-
Test for exact equality of two values.
|
113
|
-
|
114
|
-
```ruby
|
115
|
-
describe sshd_config do
|
116
|
-
its('RSAAuthentication') { should_not eq 'no' }
|
117
|
-
its('Protocol') { should eq '2' }
|
118
|
-
end
|
119
|
-
```
|
120
|
-
|
121
|
-
`eq` fails if types don't match. Please keep this in mind, when comparing
|
122
|
-
configuration entries that are numbers:
|
123
|
-
|
124
|
-
```ruby
|
125
|
-
its('Port') { should eq '22' } # ok
|
126
|
-
|
127
|
-
its('Port') { should eq 22 }
|
128
|
-
# fails: '2' != 2 (string vs int)
|
129
|
-
```
|
130
|
-
|
131
|
-
For less restrictive comparisons, please use `cmp`.
|
132
|
-
|
133
|
-
## include
|
134
|
-
|
135
|
-
Verifies if a value is included in a list.
|
136
|
-
|
137
|
-
```ruby
|
138
|
-
describe passwd do
|
139
|
-
its('users') { should include 'my_user' }
|
140
|
-
end
|
141
|
-
```
|
142
|
-
|
143
|
-
## be_in
|
144
|
-
|
145
|
-
Verifies that an item is included in a list.
|
146
|
-
|
147
|
-
```ruby
|
148
|
-
describe resource do
|
149
|
-
its('item') { should be_in LIST }
|
150
|
-
end
|
151
|
-
```
|
152
|
-
|
153
|
-
## match
|
154
|
-
|
155
|
-
Check if a string matches a regular expression.
|
156
|
-
|
157
|
-
```ruby
|
158
|
-
describe sshd_config do
|
159
|
-
its('Ciphers') { should_not match /cbc/ }
|
160
|
-
end
|
161
|
-
```
|