Commit graph

63 commits

Author SHA1 Message Date
Jared Quick
839ab3eef4 Deprecate and warn when comparing against OS name with capitals/spaces (#2397)
* Testing train downcase platform names.
* Added NameCleaned tests and fixed some formatting.
* Clean up tests with helper method.
* Update to new gemfile and platform resource.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-01-04 14:15:02 -05:00
Adam Leff
5be9739ec1 Remove rainbow dependency, fix duplicate rake gem (#2374)
The version of Rainbow brought in as a direct dependency also depends
directly on Rake, and our pin of Rake was inaccurate. This was causing
Omnibus to build packages that contained two rake gems which would emit
"Unresolved specs during Gem::Specification.reset" warnings when
running InSpec.

Signed-off-by: Adam Leff <adam@leff.co>
2017-12-07 13:50:53 +01:00
Jared Quick
31578de5e4 Fix inspec appveyor test with the new local train transport (#2376)
* test appveyor with ruby#File

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

* Update inspec train to version 0.31.1

Signed-off-by: Jared Quick <jquick@chef.io>
2017-12-06 15:18:38 -05:00
Jared Quick
d49f4e3fe1 Enable caching for backend calls (#2309)
* Enable caching for command and file calls to train
* Moved transport conn to connection and refactored tests
* Update caching flag to use train caching.
* Move caching flag to cli option.
* Add backed cache default from thor.
* Add hard disable for cache option and remove all cache from debug shell.
* Add comment to caching settings conditional.
* Force file cache on when caching enabled.
* Update gemspec for train 0.30.0.

Signed-off-by: Jared Quick <jquick@chef.io>
2017-12-04 16:40:14 -05:00
Adam Leff
46a3ca6eea
Bump train to 0.29.2 (#2327)
Train 0.29.1 includes a few regressions from 0.28 dealing with files.

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-21 14:04:23 -05:00
Adam Leff
4b9acb4800 Bump Rubocop to 0.49.1 (#2323)
* Bump Rubocop to 0.49.1

This change bumps Rubocop to 0.49.1. There have been a lot of changes
since 0.39.0 and this PR is hopefully a nice compromise of turning off
certain cops and updating our codebase to take advantage of new Ruby
2.3 methods and operators.

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

* Set end-of-line format to line-feed only, avoid Windows-related CRLF issues

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-21 08:49:41 +01:00
Adam Leff
f05e22ad33 Require Ruby 2.3 and later (#2293)
* Require Ruby 2.3 and later

Ruby 2.1 is EOL, and Ruby 2.2 is on security fixes only. This moves
InSpec to support the current "normal maintenance" versions of Ruby
like Chef does and also bumps the versions used in Travis tests.

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

* Remove Ruby 2.2 from appveyor

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-16 22:02:35 +07:00
Adam Leff
18faaa42de
Bumping train to 0.29.1 (#2306)
* Bumping train to 0.29

Train 0.29 includes some bug fixes and a refactor of the File classes

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

* Correct unit test for undefined platform

Train requires that a hash is supplied when mocking an OS. Because
an OS of "unsupported" rather than "undefined" was chosen in a unit
test, a nil was passed to train and it caused a failure.

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

* Ensure 0.29.1 or later gets picked up, but 0.30 is also acceptable

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-13 16:02:27 -05:00
Adam Leff
9e9025c138 Switch to tomlrb for TOML parsing (#2295)
The `toml` gem has a very strict version dependency on an old version
of parslet. This change switches us to use `tomlrb` instead which has
no direct dependencies. This will allow us to bump up to a later version
of parslet that has better error handling and insight into parser errors.

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-08 11:41:00 +01: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
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
Adam Leff
c8411e8947 Bump project minor version, bump train dependency version (#2058)
Bumping InSpec's minor version to 1.33 because a recent PR added
new functionality. Also bumping train to 0.26 to pick up a recent
bug fix.

Signed-off-by: Adam Leff <adam@leff.co>
2017-08-10 10:35:01 -04:00
Christoph Hartmann
0839be50d6 oracle_session and mssql_session improvement (#1857)
* improve database parsing
* support sqlcli
* ensure headers are downcast
* externalize database helper
* use password as argument
* feedback from @adamleff
* inline docs update + linting
* stay backwards compatible
* implement tests
2017-06-29 11:01:32 -04:00
Dominik Richter
e0e5aee6a4 bugfix: sudo-detection for target execution
When running `inspec exec` without the `target` option but against remote endpoints OR when executing it with the `localhost://` target AND having `--sudo` active it would abort the execution. `--target` is a helper to set the Train parameters for `backend`, `host`, `user`, `port`, and potentially `password`. The detection would fail on providing any of these separately without specifying `--target`. The same holds true for the `localhost` train backend or just `localhost://` target.

This type of detection has since moved to Train. The driving reason was to have this very useful check for localhost vs sudo run for any type of inspec (or for that matter: train) execution.

This PR depends on https://github.com/chef/train/pull/179 and the next release of train.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-05-30 18:15:44 -05:00
Christoph Hartmann
b0ab35d941
throw an error during inspec check if the version is not correct
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-05-18 09:13:37 -04:00
Dominik Richter
e87494245a update sslshake to v1.2
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2017-04-20 15:02:30 +02: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
supergicko
b27a065e8c Pinned version of sslshake to ~> 1.1
Signed-off-by: Christoph Kappel <kappel.christoph@gmail.com>
2017-04-07 09:36:42 +02:00
Adam Leff
39c05765ff
Loosen addressable version pin
The version of addressable that was pinned in the gemspec was
too new and conflicted with some of chef's dependencies. Loosening
it will allow us to include InSpec in the chef omnibus packages.

Signed-off-by: Adam Leff <adam@leff.co>
2017-04-04 14:51:19 -04:00
Adam Leff
73d46f9c49
Replace Nokogiri with REXML in the JUnit formatter
In #1454, we welcomed a newly-revamped JUnit formatter which has
a dependency on Nokogiri. Unfortunately, this had led us to problems
getting InSpec included in Chef omnibus builds (see chef/chef#5937)
because Chef is using Ruby 2.4.1 and the Nokogiri maintainers have
not yet released a windows binary gem that supports Ruby 2.4.x.
This has led to breaking builds in Chef's CI platform and would
block the acceptance of chef/chef#5937.

This change replaces Nokogiri use with REXML instead. While REXML
can be slower than Nokogiri, it does not require native extensions
and is supported on all Chef platforms.

Signed-off-by: Adam Leff <adam@leff.co>
2017-04-03 14:51:48 -04:00
Ryan Larson
0e187f6117 Feature/fix ability to pass in supermarket url (#1595)
* Enable customization of supermarket_url

It looks like this was originally supposed to work, but at some point
the default value was put in the method body rather than in the method
parameters.

This change allows you to configure the supermarket_url in test kitchen
like so:

```
verifier:
  inspec_tests:
  - name: linux-hardening
    supermarket: som3guy/apache-disa-stig
    supermarket_url: https://my.supermarket.com
```

Signed-off-by: Ryan Larson <ryan.mango.larson@gmail.com>
2017-03-29 12:42:24 -04:00
Adam Leff
073fd99637 Require Ruby 2.1
InSpec now depends on nokogiri which has a dependency of Ruby 2.1 or
later. If someone tries to `gem install inspec` using Ruby 2.0, it
will fail on the nokogiri dependency rather than InSpec itself.

Additionally, Ruby 2.0 is already EOL.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-27 12:59:56 -04:00
John Kerry
dd9ec61199 moving the nokogiri reference into the gemspec file
Signed-off-by: John Kerry <john@kerryhouse.net>
2017-03-19 21:56:14 -04:00
Adam Leff
0342cca62e Adding a Habitat profile artifact creator
Two new commands have been created:

 * inspec habitat profile create /path/to/profile
 * inspec habitat profile upload /path/to/profile

The `create` command creates a Habitat artifact that contains the contents
of the Habitat profile found at the provided path. This will be used later
in some Habitat + InSpec integrations.

The `upload` command does the same create process but then uploads the
resulting artifact to the Habitat Depot.

Signed-off-by: Adam Leff <adam@leff.co>
2017-02-23 18:25:22 -05: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
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
Alex Pop
aea77880c3 use train 0.22.0 for SSH agent support
Signed-off-by: Alex Pop <apop@chef.io>
2016-12-02 16:34:46 +00:00
jkerry
e5038e1e5d adding a shell extension class of the rspec_junit_formatter gem formatter and including it in the formatters list with key 'junit'
Signed-off-by: jkerry <john@kerryhouse.net>
2016-11-20 00:18:34 -05:00
Dominik Richter
46d9d39e8d update train to fix empty target URIs 2016-10-15 07:12:01 -07: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
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
2dbcbb6cb1 update train and kitchen-inspec version to support winrm v2 2016-09-05 13:36:48 +02:00
John Keiser
16e759c834 add support for json2 2016-08-24 11:15:17 +02:00
Steven Danna
d64b72d71d
Replace Molinillo-based resolver
The Molinillo library is a good library for systems that need a
constraint solver that will solve dependency problems requiring a single
version of each named dependency.

In our case, the eventual goal is to allow libraries to have conflicting
transitive dependencies at runtime. Isolation will be provided by
restricting all calls within a given profile to scope which can only see
that profile's dependencies.

To facilitate working on the isolation feature, I've replaced the
Molinillo-based resolver with a minimal resolver which will allow us to
load multiple versions of the same library.

Since we will likely want a good amount of logging around this feature
in the future, I've added a Inspec::Log singleton-style class, replacing
the previous Inpsec::Log which appeared unused in the code base.

Signed-off-by: Steven Danna <steve@chef.io>
2016-08-23 14:27:57 +01:00
Dominik Richter
161bd637f3 move mocha to test group in Gemfile
group test gems together.
2016-08-16 06:20:42 -07:00
Dominik Richter
11933ef305 remove tests and tasks from release gems
Developers use the github repo to get full access to the development of this gem. The fixed (non git-ls-files) approach to packaging files has led to a 30mb gem recently, this will prevent that from happening again.
2016-08-16 06:20:42 -07:00
Dominik Richter
c4282ab6b2 add ssl resource (early access) 2016-08-15 07:49:41 -07:00
Dominik Richter
aed68f9a29 update dependencies and loosen molinillo
This prevents gecode from being pulled in as a gem dependency
2016-08-15 07:30:57 -07:00
Dominik Richter
7e569669aa introduce dependency resolution
This commit is the foundation of the dependency resolution as described in https://github.com/chef/inspec/issues/888 .

It currently only works with local dependencies, as seen in the example inheritance profile.

Tests and full resolution are coming next on the path to an MVP implementation.
2016-08-10 22:41:32 +02:00
Christoph Hartmann
da3d6f0f2d require train 0.16
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2016-08-08 13:19:28 +02:00
Dominik Richter
68cf88f701 add suid sgid and sticky support for file resource 2016-07-10 23:08:42 +02:00
Christoph Hartmann
8a6ace77bd use train instead of r-train 2016-06-16 11:35:13 +02:00
Christoph Hartmann
1dd4da8d08 update train dependency to 0.12.0 2016-05-16 15:33:12 +02: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
3e8974d243 update to new train interface 2016-04-28 19:55:34 -04:00
Stephan Renatus
f7272f746c 0.19.1 2016-04-18 11:39:52 +02:00
Dominik Richter
ebd094fbb0 bugfix: rspec world handling on rspec 3.5
This accessor is designed to work with rspec 3.0 - 3.5 (and potentially up).
2016-04-16 20:33:01 -04:00
Dominik Richter
f845a16442 0.17.0 2016-03-31 14:23:07 +02:00
Christoph Hartmann
593df248b4 0.14.5 2016-02-29 13:47:55 +01:00