Commit graph

1055 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
27935e9e51 Improve ss parsing code for IPv6 addresses
Some versions of `ss` wrap IPv6 addresses in brackets, eg:

```
[fe80::dc11:b9b6:514b:134]%eth0:123
[::]
```

This change removes all brackets during parsing.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-04-18 23:55:50 -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
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
Clinton Wolfe
fc1bc75358 Adjust deprecations somewhat
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-04-12 10:55:36 -04: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
Miah Johnson
8435990722
Merge pull request #3899 from inspec/sp/crontab-path-update
crontab: Add validation for path param
2019-04-04 17:26:13 +00:00
Aaron Lippold
1e9f8fd018 Merge branch 'master' of https://github.com/inspec/inspec into al-mitre/more-permissive-than
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-03-28 15:50:16 -04:00
Aaron Lippold
e312b44563 Addressing review items.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2019-03-27 09:55:48 -04:00
Stuart Paterson
0c0e0aa016
Remove debugging lines.
Signed-off-by: Stuart Paterson <spaterson@chef.io>
2019-03-21 16:20:06 +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
Lynn Frank
6018a6959d Fixes indentation of kernal_module example
Signed-off-by: Franklin Webber <franklin.webber@gmail.com>
2019-03-19 12:05:15 -05:00
Lynn Frank
23eff3df24 Fixes rubocop violation on indention
Signed-off-by: Franklin Webber <franklin.webber@gmail.com>
2019-03-19 11:32:07 -05:00
Lynn Frank
2857d07151 Fixes resource examples
The opening and closing mechanic varied between all the various
resources. This changes them all to use a HEREDOC with a tilde
to remove leading whitespace. This removes the need for the
special method to trim the `#print_example` method from shell.

Signed-off-by: Franklin Webber <franklin.webber@gmail.com>
2019-03-19 11:25:41 -05: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
c580b695c7
Merge pull request #3842 from inspec/ja/fix-iis-app-pool-resource
iis_app_pool: Fix PowerShell JSON parsing error
2019-03-11 13:52:07 -04:00
Jerry Aldrich
22c20b7989 Add comment explaining -Compress
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-28 12:04:59 -08:00
Jerry Aldrich
66a343555b iis_app_pool: Fix PowerShell JSON parsing error
This works around a current bug in PowerShell where the output cannot be
parsed as JSON.

The `-Compress` flag does not affect the validity of the data but only
the appearance of the string.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-28 12:04:59 -08:00
Jerry Aldrich
af5d6e9285 http resource: Add fallback to #to_s
This prevents a stack trace from being shown to the user if the `http`
resource is used on an unsupported platform.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2019-02-28 09:08:49 -05:00
Christoph Hartmann
afadc896f2 make rubocop happy
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2019-02-26 16:57:48 +01:00
Christoph Hartmann
15c03cf8fc detect postgres 10 on centos properly
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2019-02-25 13:39:17 +01:00
Clinton Wolfe
dd3d3cbd2f Add deprecation hook for size()
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2019-02-06 14:02:17 -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
497035a65b missed rubocop error
Signed-off-by: James Massardo <jmassardo@chef.io>
2019-02-06 14:01:04 -05:00
James Massardo
49eccb09aa removed unneeded library
Signed-off-by: James Massardo <jmassardo@chef.io>
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
David Alexander
d5dbae2efd Updates stub for IIS App Pool unit test
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
David Alexander
abd234dca6 Removes Rubocop disable rule (not needed anymore)
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
David Alexander
7c29bd81a1 Cleans up human-readable strings
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
David Alexander
396b05b020 Takes advantage of inspec 2.x supports resource framework
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
David Alexander
ddf024d250 Fixes #3418 ('iis_app_pool should not exist' error)
Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2019-01-22 15:08:25 -08:00
Clinton Wolfe
b5e91e7dbf
Support cran packages for non-utf8 locales (#3613)
Signed-off-by: Adam Ward <adamw@subdesigns.net>
2019-01-14 10:49:50 -08:00
T. Miller
203195e545 postgres_session: Fix postgres directory searching (#3708)
Signed-off-by: Timothy Miller <timothy.miller.27.ctr@us.af.mil>
2019-01-09 17:23:08 -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
Wiebe Verweij
233cb900ba Fix incorrect warning about connection from mysql_session (#3659) (#3660)
Signed-off-by: Wiebe Verweij <wiebe@wiebelt.nl>
2018-12-12 13:32:01 -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
b67236e485 package: fix package detection on windows (#3607)
* Update package.rb to solve issue #3361

Update the windows package search regex.
According to issue #3361

* Update package.rb
Fix trailing spaces
* Update helper.rb

update sha for get-item-package. To fix the issue #3361
Signed-off-by: markus hackethal <mh@it31.de>
2018-11-27 13:21:25 -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
Adam Ward
efccf1770e Support cran packages for non-utf8 locales
Signed-off-by: Adam Ward <adamw@subdesigns.net>
2018-11-15 11:04:08 +11:00
Fernando Alexandre
8b089ea1e1 Fixes #3546 (#3592)
* When pty is used not having --no-pager makes inspec hang during the test
* Updated tests

Signed-off-by: Jose Alexandre <jose.alexandre@worldfirst.com>
2018-11-13 14:33:08 -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
Clinton Wolfe
b12aa82361 port: Correctly detect FreeBSD (#3579)
* Fixing #3563; freebsd is not a substring of 'bsd'
* Actually, this is better.
* Change coditional for FreeBSD from a string match to a call to os.bsd?

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-11-08 13:51:45 -05:00