Commit graph

417 commits

Author SHA1 Message Date
Clinton Wolfe
843ba7afa2
Improve ss parsing code for IPv6 addresses (#3962)
Improve ss parsing code for IPv6 addresses
2019-04-25 11:09:31 -04:00
Miah Johnson
2f78515164 Add a few tests for LinuxPorts class to validate ss parsing.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-04-19 13:45:33 -07:00
Clinton Wolfe
3d0b8dff2e
Merge pull request #3956 from inspec/cw/use-deprecation-everywhere-4-port
Use deprecation facility everywhere - v4 port
2019-04-17 17:12:24 -04:00
Clinton Wolfe
7aeb1763a9
Merge pull request #3897 from mattlqx/interface-addresses
Support address matchers on interface resource
2019-04-17 11:57:29 -04:00
Clinton Wolfe
1552dc0210 Merge branch 'cw/use-deprecation-everywhere-3-port' of github.com:inspec/inspec into cw/use-deprecation-everywhere-4-port 2019-04-16 17:42:45 -04:00
Clinton Wolfe
a3a2699e8d Update unit tests to expect deprecations
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-16 17:28:39 -04:00
Clinton Wolfe
0c884b1415
Merge pull request #3895 from mitre/al-mitre/more-permissive-than
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-04-16 14:41:43 -04:00
Matt Kulka
633cea6673 support address matchers on interface resource
Adds missing functionality to `interface`. Fixes #1830

```
describe interface("eth0") do
  its(ipv4_addresses) { should include 1.2.3.4 }
end
```

And so on... see diff/docs for additional matchers.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2019-04-12 08:24:13 -07:00
Jerry Aldrich
40031a9b83 Use deprecation facility throughout code
This converts all current deprecation warnings/TODOs to use the
`Inspec.deprecate()` deprecation facility.

This also modifies `Inspec.deprecate()` to only require 1 argument.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-04-11 19:15:01 -04:00
Stuart Paterson
97f6f232c8
Replace single-quoted static string.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
2019-03-21 16:24:10 +00:00
Stuart Paterson
5accfa5391
Add protection for crontab resource path and document it.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
2019-03-21 15:49:00 +00:00
Aaron Lippold
a2a86860d6 This adds the more_permissive_than?(mode) matcher to the file resource.
Fixes #3893

Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-03-18 18:10:13 -04:00
Keith Walters
c2bd0616fe Allow http resource to follow redirects
By specifying a `max_redirects` attribute, the `http` resource worker
will follow any HTTP Redirect response (301, 302, etc...) up to the
limit defined by this attribute. For a local worker, exceeding that
limit will raise a `FaradayMiddleware::RedirectLimitReached` exception.
For a remote worker, the curl command will exit without populating the
`status` and `body` properties.

Signed-off-by: Keith Walters <keith.walters@cattywamp.us>
2019-03-16 20:54:52 -04:00
Clinton Wolfe
f7d58ad92c Replace most mentions of attribute with input in test/
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-20 20:41:10 -05:00
Clinton Wolfe
02cb799ee6 Rename free to free_kb
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
5bbd4c16d6 Add size_kb, and correct Powershell code to return KB for both total size and free space, rather than total in GB and free space in bytes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
fef637a6c6 Add percent_free property
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:01:04 -05:00
James Massardo
83c0c18fca Add free space and type to filesystem resource
Signed-off-by: James Massardo <jmassardo@chef.io>
2019-02-06 14:01:04 -05:00
Clinton Wolfe
ee76c5bb54
Merge pull request #3740 from inspec/ja/adopt-3419
iis_app_pool:  Fixes error with 'should not exist'
2019-01-25 11:56:10 -05:00
David Alexander
53e3533b8c Fixes unit test for to_s of iis_app_pool
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
Jerry Aldrich
e80e7d872e Mock files used for virtualization resource tests
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
f7e8a0c80c Add deprecation check for processes.list
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
3b8da7957d Mock missing_file in NGINX resource tests
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
3fe7091254 Wrap deprecated ServerSpec matchers in procs
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
5ea640a2cd Remove nil check in chocolatey_package test
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
c1547ee898 Remove deprecated methods from shadow test
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Jerry Aldrich
c348a2032a Remove test that uses deprecated ppa resource
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 13:09:17 -08:00
Clinton Wolfe
ed460c7869
Fix SSL tests by allowing multiple cipher counts
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-22 15:00:49 -05:00
Jerry Aldrich
5c4be8de87 Fix SSL tests by allowing multiple cipher counts
The value of `ciphers` is 681 on my localhost, but 993 on Travis.

This modifies the test to allow both values.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-21 15:02:58 -08:00
Jerry Aldrich
10f0393683 Fix AWS tests found during ChefStyle spike
This fixes some style issues and fixes a duplicated test method name.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-01-21 13:05:46 -08:00
Miah Johnson
15162bf920 Add resources for aws_billing_report and aws_billing_reports. (#2838)
Signed-off-by: Miah Johnson <miah@chia-pet.org>
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-01-09 16:06:48 -08:00
Amit Saha
bbc07f5f11 aws_sqs_queue - new resource (#3674)
Signed-off-by: Amit Saha <amitsaha.in@gmail.com>
2018-12-20 14:33:21 -05:00
Jerry Aldrich
91fe4ad03b Fix labels on Docker containers (#3673)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-12-20 12:31:13 -05:00
Clinton Wolfe
b3fafab1e6 Add aws_eks_cluster resource (#3582)
* add aws_eks_cluster

Signed-off-by: Timothy van Zadelhoff
timothy.inspec@theothersolution.nl

* disable ABC check on fetch_from_api

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

* add status predicates

* Change docs for status attribute

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

*     Add integration tests

    Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl>

* Adjust EKS build code to almost work

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

* EKS only uses private subnets - integration tests pass

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

* Correct AWS Exception class for resource search miss in unit test

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

* Update unit test to reflect AWS resource-standard miss behavior, returning nil for most properties

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-27 16:54:47 -05:00
mhackethal
86cf55382b filesystem: improve Windows support (#3606)
* Improve filesystem.rb to support windows

improve filesystem.rb to support windows.
Split into 2 classes LinuxFileSystemResource / WindowsFileSystemResource
Add filesystem to verify a FS-type ( currently not for linux because missing test server )
Size on Windows is converted to GB - discussion about this welcome

update to reflect also windows os

* Create get-wmiobject-filesystem
* Delete get-wmiobject-filesystem

* Fix the testing code for filesystem.
Change its 'filesystem' to 'type' according to recommendation from @miah
Signed-off-by: Markus Hackethal <mh@it31.de>
2018-11-19 13:32:59 -05:00
Timothy van Zadelhoff
5739cb2d6b aws_security_group: Query against other security group ids in allow_* matchers (#3576)
* add security-group to security-group rules
* update docs
* Add integration tests for security-group to security-group rules
* rubocop fix
*     Add one security group rule, with position.
* make control fit description

Signed-off-by: Timothy van Zadelhoff <timothy.inspec@theothersolution.nl
2018-11-13 13:25:33 -05:00
mrshanahan
cebe044a68 Update iis_site bindingInformation construction and add tests. (#3490) (#3492)
Signed-off-by: Matt Shanahan <mrshanahan11235@gmail.com>
2018-11-08 13:42:59 -05:00
Mark Hughes
45926ef63a Added xml resource support for ints, bools, and string responses (#3583)
Methods like…

* `count()` return `Integer` values
* `boolean()` return `TrueClass`/`FalseClass` values
* `concat()` return `String` values

…but threw exceptions because those types weren't supported.

This adds support to the `xml` resource, and adds tests to verify some of those examples.

Signed-off-by: Mark Hughes <greenantdotcom@users.noreply.github.com>
2018-11-08 12:47:18 -05:00
Ksenia
c07ec59070 Add 17 hexadecimal characters support aws_vpc (#3518) (#3564)
aws_vpc: accept 17 hexadecimal characters for vpc_id 

Signed-off-by kchistova <kchistova@gmail.com>
2018-11-05 10:01:16 -05:00
Andrey Klyachkin
f835c24e89 ksh support (#3533)
Add ksh (Korn Shell) resource
2018-10-23 09:16:24 -04:00
James Stocks
7c58285eb6 New resource to work with Windows security identifiers (SIDs) (#3405)
* Resource for a Windows Security Identifier (SID)
* Integration tests for security_identifier resource
* Address rubocop violations
* Improve security_identifier from PR feedback
* Update security_identifier tests
* Improve security_identifier unit tests
* Fix unit tests fpr security_identifier resource
* More security_identifier unit tests
* Add docs page for security_identifier resource
* Fix issues with documentation
* Improve docs
Link to Microsoft reference page, and use their term 'trustee' instead of 'entity' where applicable.

* Change exists to exist
* Test appveyor file changes.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-10-19 09:01:00 -04:00
Miah Johnson
7a6119e7a6 Add missing tests for groups resource, document members property, and assorted fixes. (#3467)
* Add missing tests for groups resource, document members propery, and assorted fixes.

Update existing documentation for group resource.
Add documentation for groups resource.
Update group resource tests to test members property.
Change groups resource members property to have simple style. (this
ensures members is a single array)
remove deprecated have_gid propery.
change `if !` to `unless`
Remove early return from members method. This prevented members from
working correctly on any OS other than Windows.
Add missing tests for the groups resource.
remove tests for has_gid

Signed-off-by: Miah Johnson <miah@chia-pet.org>

* Fix comments

Signed-off-by: Jared Quick <jquick@chef.io>
2018-10-18 16:48:30 -04:00
Jerry Aldrich
7313eb7819 style: Fix quotes/style on the docker resource (#3516)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-10-17 09:14:19 -04:00
Jared Quick
2bbcdbde9b
Inspec 3.0 (#3512)
* Remove deprecated yumrepo. (#3435)

* Remove deprecations for cli `--format` and metadata.rb (#3452)

* Remove deprecated database_helpers stderr/stdout methods.
Update deprecation text for processes/apache.

* Remove deprecations for `--format` and metadata.rb
Remove deprecated `format` code.
Remove deprecated code test and change json-config format test to use
reporter.
Remove deprecated metadata.rb code
Remove deprecation notice for old supports syntax.
Deprecate metadata.rb from source_reader
Remove rubocop disables as they are no longer required for this code block.
Remove deprecated legacy metadata.rb mock profiles.
Remove deprecated metadata.rb profile tests.
Remove deprecated yumrepo test.

* Allow inspec-3.0 branch to be tested.
* Allow appveyor to test inspec-3.0 branch
* Change runner tests to use reporter rather than format.
Remove deprecated `supports: linux` tests.

* Remove skip from inherited profiles from showing up in reporting (breaking change) (#3332)

* Skip loading dependency profiles if they are unsupported on the current
platform.

Skip loading dependencies if they are unsupported on the current
platform.

Wrap our log and next in a conditional checking if the platform is
supported.

Change a `if !` into a `unless`

Check if the backend is a Train Mock Connection and if so say that the
profile does support the platform.

While iterating through tests being loaded skip when the platform is
unsupported.

We now log a WARN when a profile is skipped due to unsupported platform,
so lets check that.

Modified existing test to log that there are 0 skipped tests, instead of
2.

Add functional test that loads profile-support-skip with a json reporter
to check that our controls are not loaded and that stderr contains our
warning.

* Rather than iterating through each test return before recursion if the platform is
unsupported.

* Resolve tests using a supported platform different from testing platform

Add a control to `test/unit/mock/profiles/complete-profile` that would
work on any OS with a Internet connection. This allows the profile
to execute on any OS with success. `filesystem_spec.rb` was a control
that would only work on Linux and some BSD's.

We want profile tests to consistently work across development and testing
platforms, and not get 'skipped' in some cases.  Travis-CI tests on Linux,
Inspec Dev team uses Linux and MacOS, Appveyor tests on Windows

Also Updated `file_provider_test.rb` for `complete-profile` content changes.

If you `MockLoader.load_profile` on a unsupported platform you might not
hit the usual skip. Lets handle situations where the tests array in
Profile#load_checks_params could be nil.

* Use safe navigation rather than checking if tests is nil.
Update tests to point to unsupported_inspec and account for WARN changes.
Make unsupported_inspec profile support os-family 'unsupported_inspec'

* Fix skip bug when using include/require controls. (#3487)

* Fix skip bug when using include/require controls.
* fix test and feedback.

* Remove need for UUID detection for Automate report (#3507)
* Add json metadata for skipped profiles (#3495)

* Add skip metadata to json reports
* Unify skip messages.
* Update with status field.
* Add testing.
* Fix tests.
* lint
* Add skip exit codes for profile skips.
* Update website for 3.0 launch

Add `plugins` to sidebar.
Change 2.0 -> 3.0 in slim files.
Update 3.0 features list.
* Fix comments
* Update float to numeric.
* Change Float to numeric.
* updated feature list and impact doc
* Change "What's new in InSpec 3.0" -> "Announcing InSpec 3.0"
* Bump VERSION to 3.0.0 (#3511)

* Remove 3.0 testing checks.

* Fix azure link.
2018-10-15 18:25:27 -04:00
Jerry Aldrich
0b0a0a4d48 Change Inspec to InSpec where appropriate (#3494)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-10-15 12:09:46 -04:00
Jonathan Hartman
7451917223 Support finding larger processes on Busybox (#3446)
For larger processes, Busybox's ps displays the vsz and rss columns in
megabytes or gigabytes, with no option I've found to override the behavior.

This change updates the process regex to account for that and converts
the values to kilobytes so they can still be cast as integers.

Signed-off-by: Jonathan Hartman <j@hartman.io>
2018-10-04 14:06:17 -04:00
Jonathan Hartman
08e3b90f2b Support the Busybox variant of netstat in the port resource (#3425)
Signed-off-by: Jonathan Hartman <j@hartman.io>
2018-09-25 22:40:05 -04:00
James Massardo
2af1535f7c Add new resource: aws_ebs_volume (#3381)
* Added support for basic AWS EBS volume testing
* Fix error in exists matcher
* Added EBS resource documentation and requested changes

Signed-off-by: James Massardo <jmassardo@chef.io>
2018-09-21 11:49:28 -04:00
Martin Logan
242bee9ce6 Update AWS Security Group to work with IPV6 rules. (#3394)
Add inbound_rules_count and outbound_rules_count for total variants

Signed-off-by: Martin Logan <martinloganzz@gmail.com>
2018-09-18 16:21:41 -04:00
Jared Quick
94c7ef0df8
Fix gem tests from recent merge. (#3409)
Signed-off-by: Jared Quick <jquick@chef.io>
2018-09-18 15:00:26 -04:00