Commit graph

4184 commits

Author SHA1 Message Date
Chef Expeditor
c716790972 Bump version to 1.40.12 by Chef Expeditor 2017-10-06 17:38:29 +00:00
Jared Quick
f9e0aaadba ssl resource: properly raise error when unable to determine if port is enabled (#2205)
* Move raise condition for host into enabled method

This is related to #1205. This will fix the ssl resource for now until
we redo the exceptions. Still looking around the code and need to build
some unit tests for the ssl resource.

My fix here is to move the raise condition till later in the flow,
specifically the enabled? method. This lets the raise get caught
accordingly without killing the other tests.

Signed-off-by: Jared Quick <jquick@chef.io>

* Remove authors from ssl resource test

Signed-off-by: Jared Quick <jquick@chef.io>
2017-10-06 19:38:22 +02:00
Chef Expeditor
fe506037c6 Bump version to 1.40.11 by Chef Expeditor 2017-10-06 17:36:25 +00:00
Adam Leff
a54bc98087 Fix loading profile files when executing multiple profiles (#2223)
When running `inspec exec` with multiple profiles, such as:

inspec exec profile1 profile2

... profile1 control calls to `inspec.profile.file` will incorrectly
try to pull files from profile2 because the RuntimeProfile object
is stored on the backend object, and we share the backend object.

This change ensures each profile has a unique backend object to ensure
the RuntimeProfile instance is not overwritten.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 19:36:13 +02:00
Chef Expeditor
b740c27163 Bump version to 1.40.10 by Chef Expeditor 2017-10-06 17:32:49 +00:00
Adam Leff
939ee5ecfc processes resource: support busybox ps (#2222)
This change enhances the processes resource to support the busybox
ps command which is common on Alpine, for example. The way we
map ps fields to the structs needed by FilterTable have also been
refactored to be more flexible so we can support multiple formats
in the future.

Also, the processes resource now allows the grep argument to be optional
thus allowing a user to query all resources without passing in a
match-all regex.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 19:32:39 +02:00
Chef Expeditor
999d115fb8 Bump version to 1.40.9 by Chef Expeditor 2017-10-06 17:32:26 +00:00
Jared Quick
3d346e779d Update shell resource help to return what is defined (#2219)
This fixes #1664. I refactored the help of the resource to build the
output depending on what is available.

Signed-off-by: Jared Quick <jquick@chef.io>
2017-10-06 19:32:16 +02:00
Chef Expeditor
70ae199949 Bump version to 1.40.8 by Chef Expeditor 2017-10-06 17:24:37 +00:00
Adam Leff
9d8c53cf31 Support symbol keys in ObjectTraverser (#2221)
As detected in #2036, it is not possible to extract values from
a YAML file if the key is a symbol. This change refactors ObjectTraverser
to support symbol keys before attempting to stringify them.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 19:24:31 +02:00
Adam Leff
359fd48af0 Update docs for the os resource (#2218)
The docs for the `os` resource did not have the proper parameters
listed and also improperly had `os[:debian]` examples instead of
`os.debian?`

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 15:44:32 +02:00
Chef Expeditor
b9fc73c42a Bump version to 1.40.7 by Chef Expeditor 2017-10-06 13:41:55 +00:00
Jared Quick
7bb7767dae Add nil check for sshd config file (#2217)
* Add nil check for sshd config file

This fixes #1778. There was a issue where if the user did not have read
permissions on /etc/ssh/sshd_config it would error out on the empty?
check. The fix here is to also look for nil on the file content. Along
with this I refactored the inspec file empty? check as it does not exist
and was also erroring during my testing.

Signed-off-by: Jared Quick <jquick@chef.io>

* Add emptyfile test object and refactor tests

Signed-off-by: Jared Quick <jquick@chef.io>
2017-10-06 15:41:48 +02:00
Chef Expeditor
3d04127385 Bump version to 1.40.6 by Chef Expeditor 2017-10-05 23:18:54 +00:00
Jason McDonald
8968fb0ea7 Add Segment tag to enable Google Analytics (#2220)
Signed off by: Jason McDonald <jason@chef.io>
2017-10-05 16:18:47 -07:00
Clinton Wolfe
90fc6affd2 Docs: describe custom matcher cmp on version strings (#2214)
* Docs update to describe using cmp for version matching on packages

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Add 'and' and force Travis to re-run checks

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-10-05 13:18:12 -04:00
Jerry Aldrich III
19ecd6eeeb Add instructions for building docs/ child pages (#2194)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-10-05 13:17:06 -04:00
Chef Expeditor
6a395a0233 Bump version to 1.40.5 by Chef Expeditor 2017-10-04 20:44:17 +00:00
Adam Leff
21ba43d6a5 http resource: properly execute tests on remote target (#2209)
Currently, the http resource always executes locally, even when scanning
a remote machine with `--target` which leads to undesireable behavior.

This change adds the ability to remotely execute tests with curl. This
behavior is currently opt-in with the `enable_remote_worker` flag, but
will become the default behavior in InSpec 2.0. Deprecation warnings
are emitted if the user is scanning a remote target but has not opted
in to the new behavior.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-04 22:44:09 +02:00
Chef Expeditor
4f091da9fa Bump version to 1.40.4 by Chef Expeditor 2017-10-04 20:43:26 +00:00
Adam Leff
97a9b3f42a Adding examples of using expect syntax (#2213)
As discussed during the Chef Community Summit 2017 in Seattle, many
more technical users wish to use `expect` syntax and wish to see
more examples of how to do so with InSpec resources.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-04 22:43:20 +02:00
Chef Expeditor
400aac9350 Bump version to 1.40.3 by Chef Expeditor 2017-10-04 20:43:01 +00:00
Jared Quick
01d97498d1 Add output for port/protocol for host resource. (#2202)
* Added output for port/protocol for host resource.

Signed-off-by: Jared Quick <jquick@chef.io>

* refactor with explicit return

This fixes #2085. Port and protocol are now shown in output of the host
resource if defined.

Signed-off-by: Jared Quick <jquick@chef.io>

* refactor with string building return

Signed-off-by: Jared Quick <jquick@chef.io>
2017-10-04 22:42:56 +02:00
Chef Expeditor
d373487a05 Bump version to 1.40.2 by Chef Expeditor 2017-10-04 20:42:12 +00:00
Craig Barrett
67b123c4fd add bsd platform family to etc_hosts resource (#2192)
Signed-off-by: Craig Barrett <craig.barrett@outreach.io>
2017-10-04 22:42:05 +02:00
Jerry Aldrich III
19c72e8a60 Fix docs/reference/resources/host rendering (#2193)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-10-04 12:34:02 -07:00
mikeoliverandroid
a60606dbfa fixing a pair of obvious broken links. (#2211) 2017-10-04 11:31:47 -07:00
hannah-radish
9cfc86d2ab Resource documentation update (#2207)
Light formatting changes, change order of example and matchers, slight
color changes

Signed-off-by: hannah-radish <hmaddy@chef.io>
2017-10-03 17:35:10 -04:00
Chef Expeditor
fb52fd8770 Bump version to 1.40.1 by Chef Expeditor 2017-10-03 21:25:35 +00:00
Nathen Harvey
340c9ca919 Clean-up kitchen-inspec reference doc (#2208)
* Clarify the copy
* Fix the name of the kitchen configuration file.  `.kitchen.yml`, not
* `kitchen.yml`
* Use proper syntax for specifying recipes in the sample code
* Use a valid Supermarket-based profile in the sample code
* Demonstrate using local InSpec tests

Resolves #1565

Signed-off-by: Nathen Harvey <nharvey@chef.io>
2017-10-03 17:25:27 -04:00
Chef Expeditor
2a1a9c1dbe Update CHANGELOG.md to reflect the promotion of 1.40.0 to stable 2017-09-28 20:47:25 +00:00
Chef Expeditor
e181c1730c Bump version to 1.40.0 by Chef Expeditor 2017-09-27 12:05:42 +00:00
dromazmj
7fc7942ab1 firewalld resource: inspect the status and configuration of firewalld (#2074)
* New Resource - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* New Resource - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* New Resource - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* New Resource - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* Modifications to new resourec - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* Modifications to new resource - firewalld

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>

* Modifications to new resource firewalld

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Modifications to new resource - firewalld

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Changing firewalld_command method to prepend the command with 'firewall-cmd' to reduce code reuse.

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Modifications made
	* installed? method now tells by checking if firewall-cmd is a command on the system
	* The firewalld_command method now strips the stdout of the return
	* added another test for testing multiple active zones

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Fixing rake lint issue

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Fixing match and returning boolean for seeing if firewalld is running

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Fixing lint issues

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Empty commit to rerun.  Accidentally updated branch.

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>

* Rerunning test, accidentally updated branch. needs sign off commit

Signed-off-by: dromazmj <dromazmj@dukes.jmu.edu>
2017-09-27 14:05:35 +02:00
Chef Expeditor
2d7e0e4fa3 Update CHANGELOG.md to reflect the promotion of 1.39.1 to stable 2017-09-25 21:30:25 +00:00
Adam Leff
18175feed2 Fix version in changelog - should be 1.39.1 (#2186)
Header didn't get updated during last version bump

Signed-off-by: Adam Leff <adam@leff.co>
2017-09-25 17:29:10 -04:00
Chef Expeditor
b4ed4c4a98 Bump version to 1.39.1 by Chef Expeditor 2017-09-25 21:21:24 +00:00
Adam Leff
1f7926db98 Bump train to 0.28 to allow for more net-ssh versions (#2185)
Train 0.27.0 has a dependency on net-ssh `~> 4.2` which causes issues
with certain Chef installs that only support 4.1.0 or 3.x versions of
net-ssh, causing gem conflicts. This bumps InSpec to use Train 0.28.0
which has a looser dependency on net-ssh and also properly addresses
a net-ssh deprecation introduced in net-ssh 4.2.0.

Signed-off-by: Adam Leff <adam@leff.co>
2017-09-25 17:21:16 -04:00
Chef Expeditor
e263582f86 Bump version to 1.39.0 by Chef Expeditor 2017-09-25 17:49:13 +00:00
dromazmj
b23a58b573 etc_hosts_allow and etc_hosts_deny resources: test the content of the tcpwrappers configuration files (#2073)
* New Resource-combined etc_hosts_allow etc_hosts_deny

Signed-off-by: dromazos <dromazmj@dukes.jmu.edu>
2017-09-25 13:49:04 -04:00
Chef Expeditor
67d5d167d5 Bump version to 1.38.9 by Chef Expeditor 2017-09-25 17:09:30 +00:00
Matt Ray
e23249d635 windows_hotfix resource: test whether a Windows HotFix is installed (#2178)
* Add hotfix resource for Windows

Signed-off-by: Matt Ray <matthewhray@gmail.com>

* Renamed hotfix to windows_hotfix

Added additional unit test checking for KB that is not present on a box

Signed-off-by: Matt Ray <matthewhray@gmail.com>

* Integration test to spot-check for hotfixes

Queries the Windows operating system via Powershell for a list of all
installed hotfixes and spot-checks every 10th one with the
windows_hotfix resource. Checking hundreds is time-consuming. Also
checks to ensure a non-installed hotfix is not present.

Signed-off-by: Matt Ray <matthewhray@gmail.com>
2017-09-25 19:09:22 +02:00
Adam Leff
ec9dc3ba22 Fix latest stable version (#2182)
Changelog rollover doesn't update the version strings and there were some
changes that didn't land in the changelog but still bumped versions.

Signed-off-by: Adam Leff <adam@leff.co>
2017-09-25 12:56:04 -04:00
Chef Expeditor
9f31843643 Update CHANGELOG.md to reflect the promotion of 1.38.8 to stable 2017-09-25 16:51:26 +00:00
Adam Leff
b44e01caf8 Changelog cleanup prior to 1.38 release (#2181)
Signed-off-by: Adam Leff <adam@leff.co>
2017-09-25 12:48:51 -04:00
Chef Expeditor
6722e03c94 Bump version to 1.38.8 by Chef Expeditor 2017-09-25 15:11:57 +00:00
Adam Leff
184bd94b6e Bump train to 0.27 (#2180)
Train 0.27.0 includes a fix to properly support net-ssh 4.2 which
had a deprecation issue for the `paranoid` ssh connection option.

Signed-off-by: Adam Leff <adam@leff.co>
2017-09-25 17:11:48 +02:00
Thomas Cate
fca83c6bb2 add example for checking last permissions octet (#2152)
* add example for checking last permissions octet

Signed-off-by: Thomas Cate <tcate@chef.io>

* Correctly describe the last permissions bit for file resource

Signed-off-by: Thomas Cate <tcate@chef.io>
2017-09-25 09:52:04 -04:00
Chef Expeditor
cab161c185 Bump version to 1.38.7 by Chef Expeditor 2017-09-23 07:27:12 +00:00
Adam Leff
d029f7f58c Properly return postgres query errors on failure (#2179)
When using the `query` method in the `postgres_session` resource, if
the query fails, the `query` method attempts to call `skip_resource`
with an error message. Not only does the `skip_resource` not properly
work, but it also returns a `String` object back to the test which is
probably going to try and call the `output` method on it to run the test.

This results in an error like this:

```
  Can't read
     ∅  undefined method `output' for "output":String
```

This change returns the full psql output as a Lines object to the
user, including stderr, so they can at least get the error in their
test output and avoids undefined method errors.

Signed-off-by: Adam Leff <adam@leff.co>
2017-09-23 09:27:05 +02:00
Chef Expeditor
75e1331618 Bump version to 1.38.6 by Chef Expeditor 2017-09-23 07:17:42 +00:00