Commit graph

934 commits

Author SHA1 Message Date
username-is-already-taken2
b423e300ef Amended command.rb to resolve issue 1839
Signed-off-by: username-is-already-taken2 <gary.bright@niu-solutions.com>
2017-05-30 14:56:31 +01:00
Adam Leff
9182ba8574 Update interface resource docs
The `interface` resource currently refers to methods that don't
yet exist. Fixing the docs for now and will add the features
later.

Signed-off-by: Adam Leff <adam@leff.co>
2017-05-29 15:20:50 -04:00
Seth Chisamore
798aebf672 Bump default timeouts for http resource
This changes the default read and open timeouts to be 60 seconds which
matches the defaults for `Net::HTTP` backend which Faraday uses by
default:
https://ruby-doc.org/stdlib-2.4.1/libdoc/net/http/rdoc/Net/HTTP.html#read_timeout-attribute-method
https://ruby-doc.org/stdlib-2.4.1/libdoc/net/http/rdoc/Net/HTTP.html#open_timeout-attribute-method

The current timeout values are too small which causes tests to be
flakey.

Signed-off-by: Seth Chisamore <schisamo@chef.io>
2017-05-29 15:07:49 -04:00
Christoph Hartmann
45afca2e98 Merge pull request #1844 from cattywampus/cattywampus/gem-not-installed
Fix assert that a gem is not installed
2017-05-29 15:06:36 -04:00
Dominik Richter
b1419b84bf Merge pull request #1851 from username-is-already-taken2/gb/patch_1571
Amended the processes resource to skip on windows
2017-05-28 10:35:29 -04:00
Aaron Lippold
dbd3b5c23d bugfix: postgres relative path includes
Postgres configuration doesnt always include absolute paths. When using relative paths it will fail!

Also: We treat the include as either a string or an array; when the first condition succeeds and you get a string and the second fails you get a array => ruby tries to add a string with an array and fails. This is now fixed as well.

Fixes: https://github.com/chef/inspec/issues/1780
Fixes: https://github.com/chef/inspec/issues/1738

Signed-off-by: Aaron Lippold <lippold@gmail.com>
2017-05-26 14:49:24 -04:00
username-is-already-taken2
f1057ac754 Amended the process resource to skip on windows
Signed-off-by: username-is-already-taken2 <gary.bright@niu-solutions.com>
2017-05-26 16:33:30 +01:00
gbright
b17f0de7cf Amended to resolve issue 1839
Signed-off-by: username-is-already-taken2 <gary.bright@niu-solutions.com>
2017-05-25 21:02:01 +01:00
Keith Walters
215ef38ee9 Fix installed? check for gem resource
The gem resource used to determine if a gem is installed based on the exit
status of the `gem` command, however that command will return zero
if the package was found or not. This patch checks to ensure that the
`gem list` command actually includes the gem name or is empty to
determine if the gem is in fact installed.

If the gem command returns something other than a `0` exit code, then
it'll skip the resource.

Signed-off-by: Keith Walters <keith.walters@cattywamp.us>
2017-05-22 15:34:01 -05:00
Adam Leff
6ebb62dc10 Merge pull request #1727 from elliott-davis/fix_postgres_resource
Update postgresql conf resource to accept include_dir as a string as well as an array
2017-05-15 22:03:23 -04:00
Adam Leff
a5e5cc0dec Merge pull request #1714 from aaronlippold/postgres-session-update
updated the psql command so that it does not print the headers and ex…
2017-05-11 14:34:05 -04:00
Aaron Lippold
684d81d4c2 psql doesn't print headers + extra output + cconfigurable host + docs
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2017-05-11 08:58:55 -04:00
Dominik Richter
39d35dd99f Merge pull request #1779 from aaronlippold/al/mysql-session-update
Al/mysql session update
2017-05-09 21:28:17 +02:00
Aaron Lippold
8bad7d896f updated to have feature parity with other sql resources
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2017-05-09 14:56:05 -04:00
Nolan Davidson
8f0756812c Add support for Windows auth in mssql_resourcet
This adds supports for connecting to MS SQL instances using Window
authentication rather than SQL authentication.  By leaving either the
user or password parameters blank causes the sqlcmd to leave off the -U
and -P params.  This will cause sqlcmd to authenticate as the current
Windows user.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-09 17:17:07 +02:00
Nolan Davidson
ba6745444e Renaming oracle_session to oracledb_session
Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-05 13:11:07 -04:00
Nolan Davidson
55beed4bc8 Resolving rubucop issues
Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-05 10:11:53 -04:00
Nolan Davidson
fbe7b8ddf8 Refactor to options hash and add unit tests
Switched the oracle_session resource to take an option hash and allow
for configuring hostname, DB_SID, and sqlplus binary path.

Added unit tests.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-05 09:29:38 -04:00
Nolan Davidson
57731e1e50 Changing oracle_session back to using escaped query.
Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-02 11:03:45 -04:00
Nolan Davidson
9cd69ce4af Add an oracle_session resource
This adds an oracle_session resource similar to the existing resource
for MySQL and MSSQL.  It assumes the sqlplus tool is installed and in
the path of the user InSpec connects as.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-05-02 10:50:20 -04:00
Dominik Richter
0651a36346 Merge pull request #1746 from chef/adamleff/fix-xinetd
Fix xinetd resource failing when file cannot be read
2017-05-02 11:43:31 +02:00
Adam Leff
bc2458bf5a
Fix YAML resource documentation
The `yaml` resource documentation was missing many clues that users
need to successfully use the resource.

Signed-off-by: Adam Leff <adam@leff.co>
2017-05-01 16:16:00 -05:00
Adam Leff
6819940067
Fix xinetd resource failing when file cannot be read
The file resource's `#content` method will return nil if the file
cannot be read for permissions issues. If you try to run a profile
that uses the `xinetd` resource without sudo privileges, InSpec
would try to call `#empty` on nil.

This change fixes this issue by checking for nil before checking
for emptiness.

Signed-off-by: Adam Leff <adam@leff.co>
2017-05-01 15:59:07 -05:00
Dominik Richter
144dede6eb rename old deprecations that were meant for 1.0
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-04-28 12:09:24 +02:00
Elliott Davis
27d04b56d7 Update postgresql conf resource to accept include_dir as a string as well as an array
Even though I couldn't find any docs around include_dir accepting anything other than a string I left the existing functionality alone.
This forces include_dir to check multiple directories as well as single string directories for additional conf files.

Signed-off-by: Elliott Davis <edavis@chef.io>
2017-04-27 10:26:06 -05:00
Dominik Richter
1dafe50bd9 rename SimpleConfig / parse_config / parse_config_file options
See https://github.com/chef/inspec/issues/1709
Fixes https://github.com/chef/inspec/issues/1709

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-04-26 23:18:40 +02:00
Christoph Hartmann
b3cdc6ba04 handle json parse errors in docker resource
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-25 12:02:26 +02:00
Christoph Hartmann
218bda9c34 Docker resource (#1566)
* add docker, docker_container, and docker_image resources

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-24 10:47:03 -04:00
Christoph Hartmann
b03ee9d0ba Merge pull request #1681 from Happycoil/add-windows-user-groups
fetch user groups while building user object
2017-04-21 11:00:49 +02:00
Tor Magnus Rakvåg
1c5b35c890 you -> your
Obvious fix.
2017-04-20 17:43:33 +02:00
Tor Magnus Rakvåg
96bb596bc4 fetch user groups while building user object
Signed-off-by: Tor Magnus Rakvåg <tm@intility.no>
2017-04-20 16:02:21 +02:00
Tyler Ball
488ef492de Merge pull request #1663 from chef/ER-508/extending_http_resource
ER-508 Extended http resource to support no ssl verification
2017-04-18 14:25:10 -06:00
Elizabeth Uselton
d376a6a881 ER-508 Extended http resource to support no ssl verification
We needed to be able to run inspec against endpoints with self signed certificates and this was the quickest way for us to get there.

Signed-off-by: Elizabeth Uselton <elizabeth.uselton@gmail.com>
2017-04-18 19:01:57 +02:00
Christoph Hartmann
438a1c52ab fix sshd config help
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-18 12:01:55 +02:00
Ryan Gerstenkorn
5e0cab08a0 Add OSX support for host resource (#1608)
* Add OSX support for host resource

Signed-off-by: Ryan Gerstenkorn <ryan_gerstenkorn@fastmail.fm>
2017-04-13 11:32:04 -04:00
Christoph Hartmann
29e286fee6 Merge pull request #1639 from chef/dr/rabbitmq_config
add `rabbitmq_config` resource
2017-04-12 21:19:15 +02:00
Dominik Richter
02e435b6d0 add rabbitmq config resource
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-04-12 20:51:12 +02:00
Adam Leff
da56a08f74 Fix gem resource on Windows
RubyGems on windows comes with a batch file that wraps the `gem` command
so it executes correctly. This change uses that batch file for windows
for our `gem` resource, and also properly handles when we receive no output
from the command.

Signed-off-by: Adam Leff <adam@leff.co>
2017-04-12 17:34:16 +02:00
Christoph Hartmann
01eb102079 add support for hostname detection on macOS
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-12 12:57:45 +02:00
Christoph Hartmann
4c64bafb51 Merge pull request #1624 from supergicko/sni-power-for-ssl
Adding SNI utilization to ssl resource
2017-04-12 11:07:27 +02:00
Adam Leff
a8ffe449ff
Add helper methods, tests for registry key path building
Broke out some of the conditional logic in the `#initialize`
method into helper methods and added tests.

Signed-off-by: Adam Leff <adam@leff.co>
2017-04-07 10:09:51 -04:00
Christoph Hartmann
6f6f3985a6 fix #1131 circumvent bug in powershell where string are not properly handled
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-07 10:57:02 +02:00
supergicko
e3c695e8e9 Adding SNI utilization to ssl resource
SSL resource now adds the servername option in client hello,
utilizing the the great work of @adamcaudill to support
SNI in sslshake [1]

[1] https://github.com/arlimus/sslshake/pull/5

Signed-off-by: Christoph Kappel <kappel.christoph@gmail.com>
2017-04-07 09:34:44 +02:00
Christoph Hartmann
90b985a7c1 fix #1268 and allows registry key resource with leading backslash
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-04-06 23:30:10 +02:00
Doc Walker
692e660140 Fix #1617 Add dh_params resource (#1618)
* Fix #1617 Add dh_params resource

Signed-off-by: Doc Walker <4-20ma@wvfans.net>
2017-04-04 10:34:09 -04:00
Adam Leff
68a930f141 Merge pull request #1406 from carldjohnston/apache_conf-symlinks
Allow apache_conf to include symlinked configuration files
2017-04-03 10:38:22 -04:00
Adam Leff
7df9674e42 Remove method_missing, provide methods for repo metadata
Instead of method_missing, methods for each output item from
`yum repolist` are provided.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-29 10:42:25 +02:00
Adam Leff
1cf80737ad Yum resource fix for non-existent repos and repo info
If a repo did not exist, running matchers against it (such as `exist`)
were failing due to a bug in `#to_s` when fetching the repo name. The
`info` method would return nil and we'd still try to treat it as a hash.

This change ensures that info is always a hash, possibly empty if the
repo doesn't exist, and uses the repo name provided by the user rather
than shortening it to be consistent with our other resources which don't
manipulate the user input in the formatter.

Also added a method_missing to allow users to interrogate repo options,
such as baseurl or gpgcheck.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-29 10:42:25 +02:00
Adam Leff
8e693a4ad9 Fix port resource for invalid IP address in netstat output
Netstat will sometimes output an IPv6 address that is not
formatted correctly; the address is either truncated or uses
or implies the `::` shorthand notation twice. This yields an
invalid IPv6 address and causes IPAddr.new to choke.

This change guards against invalid IP addresses and ensures they
do not end up in the port resource's entries list.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-29 08:33:50 +02:00
joe.nuspl
1ab80ea052 Extend gem to take an optional gem_binary
Allows one to test whether gems are installed into an omnibus environment.

Signed-off-by: Joe Nuspl <nuspl@nvwls.com>
2017-03-24 22:28:42 -07:00
Christoph Hartmann
d2f000e435 refactor x509 resources and rsa key
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-22 11:44:32 +01:00
Richard Nixon
f66f0b3a18 Initial support for x509_certificate and rsa_key
* Includes unit tests
* Includes 2 new resources
* Includes documentation

Signed-off-by: Richard Nixon <richard.nixon@btinternet.com>
2017-03-22 10:00:48 +01:00
Adam Leff
4f2b66302d Fix ObjectTraverser when accessing array values
When attempting to access array values via the `json` resource:

```
describe json('/tmp/test.json') do
      its(['array',0]) { should eq "zero" }
end
```

... the resulting data would be an array of the size of the original array
with all the values replaced with nils:

```
     expected: "zero"
          got: [nil, nil, nil]
```

This was due to a bug in the ObjectTraverser mixin that mapped array values
back through `extract_value` rather than properly handling the passed-in
key(s). This worked fine for the specific data format created by the `csv`
resource but did not work `json` or any other resource that subclassed the
`JsonConfig` resource.

This change fixes the logic when dealing with an array when it's encountered,
and fixes up the `csv` resource with its own `value` method.

This change also adds tests for ObjectTraverser.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-15 11:35:55 +01:00
Adam Leff
8155357d0a Add additional example for matching crontab commands
As raised in #1526, adding an additional example showing how
a user can use the `where` accessor to find commands matching
a pattern and write a test using the results.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-14 22:16:39 +01:00
Christoph Hartmann
8b1619b60e try to use sysv fallback if is not producing proper output
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-03-08 21:52:52 +01:00
Russell Seymour
ff4a1ba200 Renamed public ip address test
Removed debugging flag

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-07 08:15:50 +00:00
Adam Leff
037f08beb2 Fixing port check with v4 IPs in a v6 netstat line
On Linux, netstat may show a tcp6/udp6 protocol line but include a
v4 address. This happens with AF_INET6 sockets that can accept
both v4 and v6 traffic. The port check was not properly handling
this situation and trying to pass a v4 address to URI bracketed as
if it was a v6 address.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-06 22:03:41 -07:00
Russell Seymour
de1b7134ef Added new resources
Allows testing of network configurations
Closes #2

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-02 14:01:54 +00:00
Russell Seymour
47cda053fb Renamed matcher to admin_username
Closes #30

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-02 11:17:00 +00:00
Russell Seymour
40888db8c5 Added support for Managed Disks
Updated README and documentation
Closes #25

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-02 11:10:41 +00:00
Carl Johnston
316c994cc5 Added oracle linux to rhel platform section.
Broken when chef/train was fixed to detect oracle linux correctly.

Signed-off-by: Carl Johnston <carldjohnston@gmail.com>
2017-03-02 22:07:16 +11:00
Christoph Hartmann
be529dcea6 Merge pull request #1513 from postgred/kernel_module_centos
Fix kernel_module for centos/redhat
2017-03-02 09:27:10 +01:00
Russell Seymour
7842d37fb3 Renamed azure_rg resource
Closes #25

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-01 17:32:17 +00:00
Russell Seymour
6f57529a44 Renamed the host attribute on azure_virtual_machine_resource
Updated README file
Closes #26

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-01 17:20:59 +00:00
Russell Seymour
a4e0df698a Renamed resources for readability
Closes #27

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-01 17:14:09 +00:00
Russell Seymour
ec072cadd3 Added integration tests for current resources
Closes #19

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-03-01 16:00:19 +01:00
Andrey Aleksandrov
70c33eb606
Remove os.family from kernel_module
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-02-24 23:30:00 +03:00
Andrey Aleksandrov
82cf2baadd
fix syntax
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-02-24 16:55:20 +03:00
Andrey Aleksandrov
8fb6bd5c66
Fix kernel_module for centos/redhat
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-02-24 14:32:57 +03:00
Carl Johnston
efa1b951ab Merge remote-tracking branch 'origin/master' into apache_conf-symlinks 2017-02-24 16:07:02 +11:00
Russell Seymour
fe2cf1dc41 Fixed linting issues
Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 14:34:41 +00:00
Russell Seymour
871efeee96 Subscription number can be used to select the one to use
Closes #15

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 14:24:18 +00:00
Russell Seymour
7699ffb6e2 Specific credentials can now be used
If not specified the first one in the credentials file is used
Fixes #14

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 14:13:32 +00:00
Russell Seymour
9108c5a237 Fixed linting issue
Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 13:46:42 +00:00
Russell Seymour
2b7c72c536 Do not get vm if the name has not been specified
Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 12:59:22 +00:00
Russell Seymour
983900a135 Moved all libraries into one file
#11

Signed-off-by: Russell Seymour <russell.seymour@turtlesystems.co.uk>
2017-02-23 12:46:15 +00:00
Joseph Benden
1fdecc6680 Add FreeBSD support for ZFS datasets and pools
The following new resources have been added; however, they
presently only support FreeBSD and similar.

* `zfs_dataset`: tests if a named ZFS dataset is present
  and/or has certain properties.
* `zfs_pool`: tests if a named ZFS pool is present and/or
  has certain properties.

Additionally, the `mount` resource has been reworked to
include support for FreeBSD; while the existing class
was renamed to LinuxMountParser.

Unit-tests were added for all of the above.

Signed-off-by: Joseph Benden <joe@benden.us>
2017-02-22 10:29:49 -07:00
Alex Pop
88975bff2a Switch package resource to os.redhat detection and use two spaces as fileds delimited
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-15 11:07:10 +00:00
Alex Pop
fae96f6249 Add RedHat support for packages resource
Fix dpkg trimming of first line
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-15 11:07:10 +00:00
Adam Leff
417b791baa Adding new crontab resource
The crontab resource parses a particular user's crontab file into
individual entries and allows the user to assert information about
each entry as needed.

Signed-off-by: Adam Leff <adam@leff.co>
2017-02-10 09:33:31 -05:00
Alex Pop
ce927e657a Skip packages resource for unsupported OS
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-10 10:34:01 +00:00
Tom Duffield
1ea83f526c Address rubocop violations
Signed-off-by: Tom Duffield <tom@chef.io>
2017-02-08 16:49:16 -06:00
jtimberman
d7fad68541 add "packages" resource
This pull request adds a packages resource so that we can check for pattern matches against all the packages on a system. This initially implements only dpkg support for debian-based platforms so we can cover this use case:

```ruby
describe packages(/^xserver-xorg.*/) do
  its("list") { should be_empty }
end
```

This uses FilterTable so we can supply additional queries, too.

```ruby
describe packages(/vi.+/).where { status != 'installed' } do
  its('statuses') { should be_empty }
end
```

Users can specify the name as a string or a regular expression. If it is a string, we will escape it and convert it to a regular expression to use in matching against the full returned list of packages. If it is a regular expression, we take that as is and use it to filter the results.

While some package management systems such as `dpkg` can take a shell glob argument to filter their results, we eschew this and require a regular expression to match multiple package names because we will need this to work across other platforms in the future. This means that the following:

```ruby
packages("vim")
```

Will return *all* the "vim" packages on the system. The `packages` resource will take `"vim"`, turn it into `/vim/`, and greedily match anything with "vim" in the name. To match only a single package named `vim`, it needs to be an anchored regular expression.

```ruby
packages(/^vim$/)
```

Signed-off-by: Joshua Timberman <joshua@chef.io>

Use entries instead of list

Added a few more tests and non installed package in output
Signed-off-by: Alex Pop <apop@chef.io>

fix lint

Signed-off-by: Alex Pop <apop@chef.io>

Signed-off-by: Joshua Timberman <joshua@chef.io>
2017-02-07 10:29:11 +00:00
Alex Pop
eb450c08a6 deprecate .list
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-03 08:28:46 +00:00
Alex Pop
92454f96c3 Add FilterTable for processes
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-03 08:28:46 +00:00
Christoph Hartmann
58585e3455 switch to faraday as http backend
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-02-02 22:13:36 +01:00
Alex Pop
495185b581 derive xinetd protocol from socket_type when not defined in the config file
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-01 11:19:24 +00:00
Alex Pop
a3de32ad04 Fix xinetd parsing of services from the same file. Expose resource.protocols
Signed-off-by: Alex Pop <apop@chef.io>
2017-01-31 12:40:29 +00:00
Christoph Hartmann
78b7a2c680 Merge pull request #1435 from postgred/kernel_module_version
Version method for kernel_module
2017-01-27 17:49:23 +01:00
Andrey Aleksandrov
4caa8c50d1
Minor improvements
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-01-27 13:51:45 +03:00
Andrey Aleksandrov
3783357e50
Add version method to kernel_module
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-01-27 13:33:41 +03:00
Christoph Hartmann
976e5d85e4 improve http header handling
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-01-26 17:16:37 +01:00
Guilhem Lettron
51ca98c468 Add an http test method
Signed-off-by: Guilhem Lettron <g.lettron@criteo.com>
2017-01-26 12:02:54 +01:00
Nathen Harvey
2eda02932f
'execution' is spelled correctly
Fixes a minor typo. The correct spelling is 'execution', not
'executation'

Signed-off-by: Nathen Harvey <nharvey@chef.io>
2017-01-24 23:19:30 -05:00
Carl Johnston
0e3d8da16b Allow apache_conf to include symlinked configuration files
Signed-off-by: Carl Johnston <carldjohnston@gmail.com>
2017-01-08 10:54:00 +11:00
Christoph Hartmann
efab62ef00 optimize regular expression for postgres config parsing
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-01-05 13:16:47 +01:00
Wei, He
370269c2dd Yum.repo should show correct name
https://github.com/chef/inspec/issues/1390

Signed-off-by: Wei, He <weihe924stephen@gmail.com>
2017-01-04 11:10:38 +09:00
Dominik Richter
a15749f328 bugfix: expose postgres_conf parameters via its
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-01-03 16:17:36 +01:00
Christoph Hartmann
08e182843b fixes brew json parsing
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-01-03 12:24:57 +01:00
Makoto Nozaki
9834e3f8f9 Make "permission denied" condition match that of Train
Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com>
2016-12-28 22:20:40 -05:00
Christoph Hartmann
7a0b0803bd add fallback syntax for serverspec tests
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2016-12-15 16:16:17 +01:00
Makoto Nozaki
42cffeea61 Fix variable name. Add test.
Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com>
2016-12-15 08:00:56 -05:00
Christoph Hartmann
8346d2acfd Merge pull request #1333 from Wing924/fix_regexp_in_processes
fix bug: RegExp in processes resource can't match long-run process #1332
2016-11-30 10:13:38 +01:00
Juan Carlos Castillo Cano
58ef61f1f4 Show process name during inspec output
Signed-off-by: Juan Carlos Castillo Cano <jccastillocano@gmail.com>
2016-11-29 11:00:43 +00:00
Wei, He
861856fbd9 fix bug: RegExp in processes resource can't match long-run process #1332
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
2016-11-29 17:01:03 +09:00
Christoph Hartmann
a990d20fcd Merge pull request #1306 from username-is-already-taken2/digitalgaz/windows_task
Adding windows_task resource
2016-11-25 11:46:42 -07:00
Jerry Aldrich III
66a47ce8b9 Remove extra ' in registry key examples
Signed-off-by: Jerry Aldrich III <jerry@chef.io>
2016-11-21 10:18:01 -06:00
username-is-already-taken2
f4410c3fa6 Fixing errors reported in Travis
Signed-off-by: username-is-already-taken2 <digitalgaz@hotmail.com>
2016-11-20 20:32:48 +00:00
username-is-already-taken2
b6b4525379 Amended method after unit testing 2016-11-20 20:07:59 +00:00
username-is-already-taken2
9b818aff5d Added windows_task resource
Signed-off-by: username-is-already-taken2 <digitalgaz@hotmail.com>
2016-11-20 20:07:59 +00:00
Christoph Hartmann
2c75a2c8db Merge pull request #1280 from grimm26/apt
improved regex for matching deb sources
2016-11-09 11:19:13 -06:00
Mark Keisler
bd33aa7175 improved regex for matching deb sources
also added tests.
Signed-off-by: Mark Keisler <mark@mitsein.net>
2016-11-09 11:10:46 -06:00
Christoph Hartmann
6a1ed49bd6 Merge pull request #1274 from hj70ft/hj70ft/windowsservice-enabledcheck-fix
Windows Service Check for service enabled state.
2016-11-03 21:59:06 +01:00
Douglas
5e56bd4635 Updated Windows Service check for Enabled state to allow both Auto and
Manual to be considered valid states for a service to be enabled.

Signed-off-by: Douglas <bdougl6@ms.ds.uhc.com>
2016-11-03 11:28:38 -05:00
Christoph Hartmann
0eb9de0089 fix file permission check by mask
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2016-11-03 12:46:48 +01:00
Jere Julian
f8a9eab443 Change path to opts
Signed-off-by: Jere Julian <jere@arista.com>
2016-11-02 16:04:59 -04:00
Jere Julian
0565d9084b Update example
Signed-off-by: Jere Julian <jere@arista.com>
2016-11-02 14:44:13 -04:00
Jere Julian
a2dd8fe791 Add examples
Signed-off-by: Jere Julian <jere@arista.com>
2016-11-02 13:21:46 -04:00
Jere Julian
d855b5e7a7 Add support for JSON blobs and commands that produce JSON output.
Signed-off-by: Jere Julian <jere@arista.com>
2016-11-02 12:25:26 -04:00
Christoph Hartmann
a25d3e8fae overwrite exec for inetd because respec its is executing exec
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2016-10-28 12:10:45 +03:00
Jonathan Morley
1af7a22991 Remove wildcard from windows package detection
This allows stricter checks on windows software, and keeps it in line with the package resource on other platforms
2016-10-27 14:30:32 +02:00
Alex Pop
08427f1dec fix nil timeout and retries
Signed-off-by: Alex Pop <apop@chef.io>
2016-10-26 20:43:46 +01:00
Jeremy J. Miller
0a042eb360 added 'by_user' example to resource
Signed-off-by: Jeremy J. Miller <jm@chef.io>
2016-10-26 15:57:30 +02:00
Jeremy J. Miller
3db0deefb1 putting quotes around path in PS command
Signed-off-by: Jeremy J. Miller <jm@chef.io>
2016-10-26 15:57:30 +02:00
Jeremy J. Miller
fe18e3090d implementing changes requested in review
Signed-off-by: Jeremy J. Miller <jm@chef.io>
2016-10-26 15:57:30 +02:00
Jeremy J. Miller
1288f90247 changing module name
Signed-off-by: Jeremy J. Miller <jm@chef.io>
2016-10-26 15:57:30 +02:00
Jeremy J. Miller
5cd9cec0c0 adding by_user permissions support for windows
Signed-off-by: Jeremy J. Miller <jm@chef.io>
2016-10-26 15:57:30 +02:00
Alex Pop
70416a35b4 use command instead of comm and set user column width on linux
Signed-off-by: Alex Pop <apop@chef.io>
2016-10-17 15:39:13 +01:00
Anirudh Gupta
8efec7ac6c fix processes resource for os's where username is long to avoid truncation 2016-10-17 11:46:16 +01:00
Artem Sidorenko
aa725fe2df Linux Mint support for service resource 2016-10-08 23:34:56 +02:00
Alex Pop
10116724fc Missing registry keys should not exist 2016-10-05 14:55:04 +02:00
Steven Danna
57ff8c5e3c
Fix minor typo in sys_info documentation
Signed-off-by: Steven Danna <steve@chef.io>
2016-09-26 10:56:16 +01:00
Christoph Hartmann
2aab753d9b return empty array for known privileges 2016-09-26 01:48:59 +02:00
Christoph Hartmann
dab8ff5c13 replace wmi win32_useraccount with adsi users 2016-09-26 01:31:44 +02:00
Christoph Hartmann
3bc7fa3a39 remove whitespace 2016-09-26 01:29:18 +02:00
Michał Sochoń
cdf6f647ac Update parse_config.rb
Extend example section.
2016-09-25 14:02:40 +02:00
Christoph Hartmann
f7ec24a337 implement filter table for group/groups resource 2016-09-23 00:53:24 +02:00
Christoph Hartmann
71d119f88d fix minor typos in user resource 2016-09-23 00:31:32 +02:00
Christoph Hartmann
85aae8d29f fix double-space in pip to_s resource 2016-09-21 12:02:36 +02:00
Anirudh Gupta
a355af670f fixup! fixing the debian package manager - when the package is removed but not purged 2016-09-21 13:41:59 +05:30
Anirudh Gupta
024027a3a1 fixing the debian package manager - when the package is removed but not purged 2016-09-21 13:11:23 +05:30
Anirudh Gupta
1cfa3252ce making the examples in the code consistent with rst docs 2016-09-21 11:33:17 +05:30
David Pell
155995adfd In ApacheConf#include_files, check for abs paths
If the path is absolute, just use what was passed, otherwise build an
absolute path using `@conf_dir`.

Fixes #1013
2016-09-20 09:11:09 -04:00
Alex Pop
8a470c16f1 ssl resource to use inspec.backend.hostname and require train 0.19.1 2016-09-16 10:41:22 +01:00
Christoph Hartmann
9c7d06c167 use simple config for security policy resource 2016-09-12 12:20:57 +02:00
Christoph Hartmann
a2143b8249 identify enabled/disabled accounts for windows 2016-09-12 11:40:25 +02:00
Christoph Hartmann
e61f71143d add unit tests 2016-09-09 12:43:03 +02:00
Christoph Hartmann
82a4e21cf7 add sys_info resource to get information about the hostname 2016-09-09 10:36:02 +02:00
Christoph Hartmann
fb416bfdf8 added further comments highlight that the users research is focussed on local users 2016-09-09 09:31:38 +02:00
Christoph Hartmann
23cfc3c4bd fix for solaris 2016-09-09 09:31:38 +02:00
Christoph Hartmann
78a47aa43b improve windows implementation 2016-09-09 09:31:38 +02:00
Christoph Hartmann
74c3904844 improve performance for single user requests 2016-09-09 09:31:37 +02:00
Christoph Hartmann
94100d98b0 full implementation for filtable for linux and mac 2016-09-09 09:31:37 +02:00
Kartik Null Cating-Subramanian
42fd3fc51a first iteration fitlertable for user resource 2016-09-09 09:31:37 +02:00
Christoph Hartmann
80fd288f44 Merge pull request #1020 from chef/chris-rock/iis_direct_matcher
allow direct access to iis configuration parameters
2016-09-07 11:34:47 +02:00
Christoph Hartmann
1bd55f8cc4 allow direct access to iis configuration parameters 2016-09-07 11:19:34 +02:00
Alex Pop
f65ceeb900 handled hostname differently for WinRM::Connection
parallelize protocol checks to speed up the scan
2016-09-07 11:04:01 +02:00
Christoph Hartmann
c3c648eeb9 fix integration tests for usage with winrm v2 2016-09-05 13:36:48 +02:00
Christoph Hartmann
3346d7e1a9 support /etc/init.d directory for run level configuration 2016-09-05 11:08:21 +02:00
Christoph Hartmann
a116406b4e Merge pull request #1014 from jeremymv2/fix_apache_conf
Fix apache conf
2016-09-04 20:18:16 +02:00
Jeremy J. Miller
898fe125f2 keep os logic in apache resource 2016-09-04 13:27:14 -04:00
Jeremy J. Miller
5774dacfea use inspec.os.debian? 2016-09-02 13:57:35 -04:00
Jeremy J. Miller
3919d33ccb fixing apache_conf.conf_dir 2016-09-02 13:44:16 -04:00
Alex Pop
f1b1794ee5 fix os exception 2016-09-02 15:24:50 +01:00
Martin Hegarty
e6eb6d8d36 Allow for windows service name with spaces 2016-08-31 15:01:07 +01:00
Christoph Hartmann
dd06709d6e switch from deprecated script resource to powershell resource for user resource 2016-08-26 09:33:35 +02:00
Kartik Null Cating-Subramanian
89976219b9 Add windows user SID as 'UID' in user resource. Fix #960 2016-08-26 09:27:03 +02:00
Christoph Hartmann
8de1b9fe7b Merge pull request #978 from nvtkaszpir/patch-1
Update port.rb Documentation
2016-08-26 09:12:35 +02:00
Kartik Null Cating-Subramanian
1243d9475d Rubocoooop! 2016-08-25 14:22:15 -04:00
Michał Sochoń
3c106096b9 Update port.rb 2016-08-25 19:57:41 +02:00
Michał Sochoń
8b6107c5b9 Update port.rb
fix comment section, expand example section
2016-08-25 17:03:41 +02:00
Christoph Hartmann
3182978e85 fix lint 2016-08-24 14:40:26 +02:00
Kartik Null Cating-Subramanian
db032e437e Speed up windows package lookup - maybe 2016-08-24 14:33:56 +02:00
Anirudh Gupta
4041f1898e can check windows service startup mode now 2016-08-24 02:01:10 +05:30
username-is-already-taken2
52c52d565f Update host.rb
Resolved an issue checking ports on windows

The previous version wasn't really checking if a port was accessible as we were only validating if the ping succeeded. Using TcpTestSucceeded to determine if the connection worked or not.
2016-08-23 17:15:33 +02:00
Tim Smith
d953986d25 Add darwin helper
Signed-off-by: Tim Smith <tsmith@chef.io>
2016-08-23 10:37:52 +02:00
Chris Evett
3df98b7a19 add iis_site tests and refactor post code review 2016-08-17 06:57:48 -04:00
Chris Evett
4d63afc1f8 add documentation to resources.rst for iis_site and fix comment 2016-08-17 06:57:48 -04:00
Chris Evett
7f9fbc6cce add iis_site resource 2016-08-17 06:57:48 -04:00
Christoph Hartmann
c23263f3d0 handle xinetd config with only one entry 2016-08-16 17:23:22 +02:00
Victoria Jeffrey
6f198f539b cleanup 2016-08-16 10:01:10 +02:00
Victoria Jeffrey
cf771ab967 ssh_config parse should be case insensitive 2016-08-16 10:01:10 +02:00
Dominik Richter
c4282ab6b2 add ssl resource (early access) 2016-08-15 07:49:41 -07:00
Dominik Richter
5f1d83f196 Merge pull request #912 from chef/ap/port-win-process
Windows ports with pid and process name
2016-08-12 20:59:28 +02:00
Alex Pop
353dcf10ec make netstat default for getting ports and get only listening ones 2016-08-12 16:02:56 +01:00
Christoph Hartmann
57bdd3464c add feature to fetch children from registry key 2016-08-12 14:51:23 +02:00
Christoph Hartmann
1faa68732e use powershell function for registry key 2016-08-12 14:51:23 +02:00
Christoph Hartmann
571bc14742 support hash params as options for registry key 2016-08-12 14:51:23 +02:00
Steven Danna
c71f5cdb30 Improve detection of postgresql conf dir and data dir
Redhat conf_dir detection was regressed in 57d7275 which inadvertently
removed the setting of @conf_dir. Any attempt to use the postgres
resource on RHEL would rain an exception:

    inspec> postgres.data_dir
    TypeError: no implicit conversion of nil into String

Further, the redhat detection code appears to assume that RHEL always
uses versioned data directories. This however, does not appear to be the
case:

    $ cat /etc/redhat-release
    CentOS release 6.7 (Final)
    $ sudo ls /var/lib/pgsql/
    backups  data  pgstartup.log

The code now can handle both versioned and un-versioned directory
formats on RHEL. Further, it provides diagnostic warnings about
uncertainty in the discovered data directories and configuration
directories.

Signed-off-by: Steven Danna <steve@chef.io>
2016-08-10 18:44:15 +02:00
Steven Danna
13ebea48e1 Allow port to be specified as a string
This allows the user to write:

   describe port(22) do
     it { should be_listening }
   end

as well as

   describe port('22') do
     it { should be_listening }
   end

without hitting an error.

Fixes #867

Signed-off-by: Steven Danna <steve@chef.io>
2016-08-05 14:01:08 +02:00
Christoph Hartmann
b3652bf85d improve code style for parse_config thanks @stevendanna
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2016-08-05 12:29:34 +02:00
Christoph Hartmann
d9a1a500d0 add params and content method to parse_config 2016-08-05 12:13:56 +02:00
Steven Danna
57d7275857
Update inspec for os[:family] change in Train
Signed-off-by: Steven Danna <steve@chef.io>
2016-08-04 13:32:35 +01:00
Steven Danna
28946f5fde
Use systemctl's helper command to determine enabled & active status
The output of `systemctl show SERVICENAME` can be misleading in the
case of non-native services (i.e. services configured via an init script
and integrated with systemd via a shim) or for more sophisticated unit
types.

For example, the UnitFileState of ntp is "bad":

    > systemctl show ntp | grep UnitFileState
    UnitFileState=bad

despite systemd reporting it as enabled:

   > systemctl is-enabled ntp
   ntp.service is not a native service, redirecting to
   systemd-sysv-install
   Executing /lib/systemd/systemd-sysv-install is-enabled ntp
   enabled

Further, the old parsing code would have missed unit files in the
following states that are technically enabled:

   enabled-runtime, indirect, generated, and transient

Using the `is-enabled` commands ensures that we report the same enabled
status that systemd reports, without having to update our own parsing in
the event that new unit states are added. Additionally, as shown above,
it handles the sysv compatibility helper.

Similarly, the is-active helper command ensures that we always report
the same active/not-active status as systemd would natively. For
instance, a quick reading of `src/systemctl/systemctl.c` in the systemd
source shows that systemctl reports units as active if they are in the
state `UNIT_ACTIVE` or `UNIT_RELOADING`.

Fixes #749

Signed-off-by: Steven Danna <steve@chef.io>
2016-08-03 13:31:09 +01:00
Dominik Richter
c2f34932ad add port resource for windows 2008
using `netstat -an`
2016-07-21 14:58:43 +02:00
Chris Evett
925da00b3d fixing rubocop error 2016-07-17 14:22:04 -04:00
Chris Evett
85988aab9c add mssql resource 2016-07-17 14:18:25 -04:00
Patrick Münch
7d986c2d17 FIX #823 wrong postgres path detection
Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
2016-07-12 19:59:08 +02:00
Dominik Richter
68cf88f701 add suid sgid and sticky support for file resource 2016-07-10 23:08:42 +02:00
Dominik Richter
c6644ebdfe check service running by ActiveState
See http://unix.stackexchange.com/questions/159174/differences-between-inactive-vs-disabled-and-active-vs-enabled-services
2016-07-06 12:57:04 +02:00
Christoph Hartmann
9bdb01f1d5 improve wmi resource 2016-06-19 23:40:45 +02:00
Dominik Richter
302a718b48 list arbitrary ports and query it
utilizing filter table to make port more flexible and useful.
2016-05-31 03:14:07 +02:00
Christoph Hartmann
9e753a5dbc add helper methods for os resource 2016-05-31 00:01:26 +02:00
Anirudh Gupta
c9dbbfd5dc modification in command resource example 2016-05-16 11:53:21 +05:30
Dominik Richter
dde4433933 use struct for processes list
we know all the fields + struct is fully compatible to the curren hash implementation
2016-05-13 11:22:56 +02:00
Christoph Hartmann
5939e5b2f9 Merge pull request #739 from chef/ap/port-not-nil
Return empty array instead of nil for port methods
2016-05-11 23:32:43 +02:00
Alex Pop
2a9d9b5481 return empty array instead of nil to be .each friendly 2016-05-11 22:21:22 +01:00
tpcwang
c8d2991589 Escape os_env command on Windows to handle env variables containing parentheses.
Update the mock file to match the new command
2016-05-11 01:09:06 -07:00
Victoria Jeffrey
1811eb6666 Expose label for processes only on linux 2016-05-10 13:59:13 -04:00
Alex Pop
9ded3b8835 Provide service params as a mash, empty unless systemd for now 2016-05-09 14:54:09 +02:00
Dominik Richter
5d925b2851 api: make processes return integers for pid/vsz/rss 2016-05-06 16:49:21 +02:00
Alex Pop
9a83814f35 update mount example with include 2016-05-06 14:27:42 +01:00
Alex Pop
c518b9edc2 expose systemd service properties via .info 2016-05-06 13:36:42 +02:00
Dominik Richter
67fccc1246 expose deprecated fields in passwd 2016-05-04 15:27:58 +02:00
Dominik Richter
fb91b788a6 use filtertable with passwd resource 2016-05-04 15:27:58 +02:00
Alex Pop
f78afe0d75 Use only strings in resource examples, docs and tests 2016-05-03 23:27:18 +01:00
Anirudh Gupta
738ef69bcf prefixed hpux to cmd file name 2016-05-03 21:38:39 +05:30
Anirudh Gupta
d839f218bf hpux support for basic port properties 2016-05-03 14:30:59 +05:30
Alex Pop
56d856531b support basename parameter and add tests 2016-04-29 13:40:32 -04:00
Dominik Richter
83b4dfbf4d use the source_path instead of path for file internal reporting 2016-04-28 20:11:21 -04:00
Dominik Richter
3e8974d243 update to new train interface 2016-04-28 19:55:34 -04:00
Alex Pop
3ab53e940d make file resource follow links and provide method to get to the original link object 2016-04-28 19:55:34 -04:00
Dominik Richter
0c8e891ee1 add #entries to filter table + remodel configuration 2016-04-28 22:46:39 +02:00
Dominik Richter
048a1584b9 encapsulated filters 2016-04-28 22:46:39 +02:00
Dominik Richter
652f10ad9a use Inspec::Filter in xinetd resource 2016-04-28 22:46:39 +02:00
Dominik Richter
01caf05020 add cmd for executing calls against the inspec api 2016-04-27 06:31:01 -07:00
Anirudh Gupta
1330e09df5 added file permission by user check for hp-ux 2016-04-26 14:53:28 +05:30
Anirudh Gupta
75534fdaa5 added hpux user and package resource support 2016-04-21 14:01:56 +05:30
Alex Pop
9f156bb36b update file resource example to use cmd matcher for better failure output in octal 2016-04-20 11:57:34 -04:00
Alex Pop
7a3b4736b8 fix the shadow password example now that cmp can handle arrays 2016-04-20 11:57:34 -04:00
Dominik Richter
9da23f9cbc remodel bash and shell wrappers 2016-04-18 11:48:42 -04:00
Dominik Richter
0631779412 configure command execution shells to sh/bash/zsh 2016-04-18 01:09:37 -04:00
Dominik Richter
fa6143d6d4 be descriptive on shadow.entries
When used in combination: `shadow[.filter(...)].entries.each { |entry| ... }`, these entries would not  be very descriptive at all. You would basically only retrieve the full filter chain e.g. 20 times, without any information about what entry you are currently looking at. This fixes it, by providing the entry identified by the user name
2016-04-17 19:12:14 -04:00
Thomas Cate
e6d98968c9 first pass at working legacy-grub/grub2 config 2016-04-17 10:46:35 -04:00
Thomas Cate
0f8aff0b91 added default and per kernel checking 2016-04-17 10:46:35 -04:00
Thomas Cate
3051ead64d added tests for grub_conf resource 2016-04-17 10:46:29 -04:00
Thomas Cate
19333f0ece handle unsupported OSs 2016-04-17 10:46:29 -04:00
Thomas Cate
1b1690a3e3 improve examples 2016-04-17 10:46:29 -04:00
Thomas Cate
3559ba4aeb convert single entry arrays to strings 2016-04-17 10:46:24 -04:00
Thomas Cate
fc811518e8 remove troubleshooting output 2016-04-17 10:45:22 -04:00
Thomas Cate
96536db318 first pass at a grub_config resource 2016-04-17 10:45:22 -04:00
Christoph Hartmann
27357c8630 update documentation for json resource 2016-04-16 20:16:32 -04:00
Satish Puranam
07315ce5d2 Cleanup code meet lint guidelines 2016-04-14 13:39:03 -04:00
Satish Puranam
b0bc88f637 Cleanup, remove redundant checking of os family 2016-04-13 19:08:14 -04:00
Satish Puranam
81029274e2 Add support suse 11 to service resource 2016-04-13 18:24:26 -04:00
Jacob McCann
9dbf5354e5 Add 'static' value as enabled to systemd service enabled check 2016-04-13 14:44:28 -05:00
Christoph Hartmann
6fba237848 Merge pull request #580 from mulesoft-ops/amazon-linux-support
Amazon linux support for service resource
2016-03-31 09:55:36 +01:00
Dominik Richter
419b6a087c add file uid and gid accessors 2016-03-31 02:23:30 +02:00
Dominik Richter
2cad553de8 add advanced passwd filters (experimental) 2016-03-31 02:03:20 +02:00
Joshua Bussdieker
7a185f02dc Amazon linux support for service resource 2016-03-29 08:32:50 -07:00