Commit graph

1924 commits

Author SHA1 Message Date
David Alexander
6ed4068fd1 Extend Windows ACL matchers (#1744)
* Adds alias for 'ListDirectory' permission

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Works with Ruby array of permissions as long as possible

Converts to PowerShell array just before use.

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Abstracts user-provided permissions to router method

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Adds FullControl as a specifiable permission

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Adds specific permission 'modify'

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Fixes #1743

Limits Windows' broad "read" permission to if it can read all of the
above, instead of just the first:

- File contents
- File attributes
- File extended attributes
- File permissions

This better aligns with how Windows names the permissions.

  'read' -> Read instead of 'read' -> ReadData

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* 'Execute' Windows ACL has alias of 'Traverse'

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Adds 'Delete' permission

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Adds `should allow('perm').by_user('me')` matcher

Provides hooks for later use with Windows ACL matching

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Adds remaining Windows ACL hooks

Skips ReadAndExecute on intentionally since it just aliases the combo of
2 permissions into one new one.

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* [Rubocop] Reduces ABC / Cyclomatic complexity

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Reduces global scope with `allows()` -> `be_allowed()`

RSpec inferred matchers work nicely here. This changes the `by_user()`
and `by()` chained matchers to just be an options hash on the underlying
`allowed?()` method.

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Fixes integration tests with rename `allows()` -> `be_allowed()`

Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2017-10-17 15:01:51 +02:00
Chef Expeditor
e5ce31fcc7 Bump version to 1.42.0 by Chef Expeditor 2017-10-17 12:53:49 +00:00
Adam Leff
3c3cb741ff Add inspec habitat profile setup command (#2239)
Introduces a new `inspec habitat profile setup` command
which will set up an existing profile repository with all
the files necessary to build a Habitat package. This will
prime a repository to be used by the Habitat Builder service.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-17 14:53:41 +02:00
Chef Expeditor
56becc1231 Bump version to 1.41.10 by Chef Expeditor 2017-10-17 12:52:46 +00:00
username-is-already-taken2
dbd50c327e revised the esc chars within mark def (#2234)
Signed-off-by: username-is-already-taken2 <digitalgaz@hotmail.com>
2017-10-17 14:52:12 +02:00
Chef Expeditor
af65cf1281 Bump version to 1.41.9 by Chef Expeditor 2017-10-17 12:50:07 +00:00
Chef Expeditor
ed0d087e15 Bump version to 1.41.8 by Chef Expeditor 2017-10-17 12:47:40 +00:00
Jerry Aldrich III
62dc14a09c Fix only_if behavior when used outside controls (#2216)
* Fix `only_if` behavior when used outside controls

This renames `@skip_profile` to `@skip_file` and modifies the scope of
`only_if` (used outside of a control) to only apply to the control file
that contains it instead of the entire profile.

This does this by exposing `@skip_file` from the control context so that
it can be set back to `false` between loading control files in the
profile context.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Modify `get_checks` to accept a rule index

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Modify `only_if` to work regardless of location

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Disable Cyclomatic/Perceived Complexity in Rubocop

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Add comment for `skip_file` in `load_control_file`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-10-17 14:47:30 +02:00
Chef Expeditor
2f8cfd7a04 Bump version to 1.41.7 by Chef Expeditor 2017-10-17 12:45:46 +00:00
narkaTee
4f005d8510 Fix port ressource ss line parsing (#2243)
Fixes the 'ss -tulpen' command parsing when multiple processes use the
same fd.

Signed-off-by: Jan Ullrich <narkat@gmail.com>
2017-10-17 14:45:37 +02:00
Chef Expeditor
824e58dfbc Bump version to 1.41.6 by Chef Expeditor 2017-10-16 16:19:43 +00:00
Anton Markelov
09a2f677d5 add missed 'html' to 'format' option explanation (#2244)
Signed-off-by: Anton Markelov <doublic@gmail.com>
2017-10-16 17:19:36 +01:00
Chef Expeditor
78c2a55945 Bump version to 1.41.5 by Chef Expeditor 2017-10-12 10:30:40 +00:00
J Burns
58eae32688 etc_fstab resource: properly namespace the resource, add nfs_file_systems documentation (#2190)
* Updated nfs_file_systems example in docs

Signed-off-by: Jennifer Burns <jburns@mitre.org>
2017-10-12 11:30:33 +01:00
Chef Expeditor
ed25975c2c Bump version to 1.41.4 by Chef Expeditor 2017-10-12 06:45:45 +00:00
Chef Expeditor
97b03b0bcf Bump version to 1.41.3 by Chef Expeditor 2017-10-11 13:31:54 +00:00
Nathen Harvey
05ac2724ec Update the profile tempate (#2238)
* Remove a broken link.

Signed-off-by: Nathen Harvey <nharvey@chef.io>

* It is now 2017

While the content in this file was actually written in 2015, this
example is meant to be overwritten and is generated by the user in the
current year.

Signed-off-by: Nathen Harvey <nharvey@chef.io>
2017-10-11 14:31:44 +01:00
Chef Expeditor
ca19ef5570 Bump version to 1.41.2 by Chef Expeditor 2017-10-10 09:37:06 +00:00
Adam Leff
5114173e50 Support PAX-formatted tar files, standardize file lists (#2225)
* Support PAX-formatted tar files, standardize file lists

When a tar file is generated in PAX format, the files have an additional
relative path prefix added to them. For example, instead of:

inspec.yml

... the file is listed as:

./inspec.yml

And the source reader plugin looks only for a "inspec.yml" file to
determine the profile format.

This change addresses this issue by normalizing the file paths in the
TarReader and accounting for the additional "./" prefix that may exist
whenever the tar file is walked looking for a file to read its content.

Signed-off-by: Adam Leff <adam@leff.co>

* Remove pax from unit test, will move to functional

Signed-off-by: Adam Leff <adam@leff.co>

* Add function test for the pax header tar file

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-10 10:36:57 +01:00
Chef Expeditor
4cf7c89460 Bump version to 1.41.1 by Chef Expeditor 2017-10-10 08:54:23 +00:00
Keith Walters
2a8d6e0e91 Uses netstat to detect open ports on AIX (#2210)
* Uses netstat to detect open ports on AIX

Signed-off-by: Keith Walters <keith.walters@cattywamp.us>

* Adds unit tests for AIX port resource

Signed-off-by: Keith Walters <keith.walters@cattywamp.us>
2017-10-10 10:54:18 +02:00
Chef Expeditor
ae486e50d2 Bump version to 1.41.0 by Chef Expeditor 2017-10-09 10:56:24 +00:00
Chef Expeditor
952dd09a29 Bump version to 1.40.13 by Chef Expeditor 2017-10-07 10:28:14 +00:00
Adam Leff
cbf58c7afa Enhance cmp matcher to work with symbols, fix file documentation (#2224)
* Enhance cmp matcher to work with symbols

The `cmp` matcher will now stringify symbol actual values if the
expected value was passed in as a string. This will help with the file
resource `type` method where Train returns the file type as a symbol.

Signed-off-by: Adam Leff <adam@leff.co>

* Fix documentation for file type character_device

Signed-off-by: Adam Leff <adam@leff.co>

* Fix docs for block_device

Signed-off-by: Adam Leff <adam@leff.co>

* Fix file mtime docs

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-07 12:28:07 +02:00
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
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
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
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
Chef Expeditor
fb52fd8770 Bump version to 1.40.1 by Chef Expeditor 2017-10-03 21:25:35 +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
b4ed4c4a98 Bump version to 1.39.1 by Chef Expeditor 2017-09-25 21:21:24 +00: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