Commit graph

39 commits

Author SHA1 Message Date
Christoph Hartmann
6b0c67e485 Fix case where res is nil in etc_group for inspec check (#2984)
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2018-04-26 12:29:12 -04:00
eramoto
c7e87ca3e3 Unify method in which file content is read across all resources (#2359)
* Create file-check functionality into utility file

There are the similar issues as PR #2302. Almost resources return false
positives when a file does not exist or is not read.

* Replace to file-check functionality
* Fix dh_params and x509_certificate resources

If a file is empty, OpenSSL::PKey::DH and OpenSSL::X509::Certificate have
raised an exception and have skipped the inspection. Thus x509_certificate
and dh_params resources are not allowed to read a empty file.

* to_s of shadow expects filters is not nil
* Remove workaround of sshd_config

Removes the workaround of sshd_config since Travis CI fails due to a bug
of dev-sec/ssh-baseline and the PR #100 will fix it.

* Use init block variable in methods

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
2018-03-22 08:25:45 -04:00
Miah Johnson
5fee525be8 Remove os checks from initialize as this is provided by platform (#2797)
Removes skip_resource and raise .. if InSpec.os stuff from initialize as this is covered by platform support.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2018-03-08 16:01:50 -05:00
Miah Johnson
7b23fa479c Add correct supports platform to resources. (#2674)
* Add correct `supports platform` to resources.

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

* Remove 'os_family' and update platforms to specify what they did.

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

* Add esx and cisco to generic resources.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-19 15:26:49 +01: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
eramoto
f9ee7596f5 Fix gid filtering for etc_group resource (#2297)
'etc_group' resource stores 'gid' as integer but the 'where' method
compares 'gid' as string.
By this fix, the 'where' method always converts the stored data to string
when comparing. And it can also look for groups without members.

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
2017-11-14 05:03:50 +01:00
Adam Leff
a6582bea9b Remove any "All Rights Reserved" references (#1969)
* Remove any "All Rights Reserved" references

InSpec is licensed and released under the Apache 2.0 license. This
change removes all reference to legacy code files that still had
any Copyright or License lines referring to "All Rights Reserved".

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

* fix functional tests

Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2017-06-28 04:14:19 -07:00
Tom Duffield
1ea83f526c Address rubocop violations
Signed-off-by: Tom Duffield <tom@chef.io>
2017-02-08 16:49:16 -06:00
Adam Leff
577688a3a0 Placing all resources in the Inspec::Resources namespace
Many of the resources are named as a top-level class with a fairly generic class name, such as "OS". This causes an issue specifically with kitchen-google which depends on a gem which depends on the "os" gem which itself defines an OS class with a different superclass. This prevents users from using TK, Google Compute, and Inspec without this fix.

Some mocked commands had their digest changed as well due to the new indentation, specifically in the User and RegistryKey classes.

I strongly recommend viewing this diff with `git diff --ignore-space-change`
to see the *real* changes. :)
2016-03-08 13:40:16 -05:00
Christoph Hartmann
2fd6aea357 extend etc_group support for all unix systems 2016-01-28 18:30:38 +01:00
Jeremy W. Chalfant
bc503f080d rename etc_group to etc_group_spec and etc_group test success on AIX 2016-01-14 23:00:10 -05:00
Christoph Hartmann
19ed6be39f more fine-grained utils parser 2016-01-02 22:41:58 +01:00
Adam Leff
e0c356dae7 Adding support for Wind River Linux
WRL is used as the OS on Cisco Nexus devices and acts like a Red
Hat variant. These changes add support for WRL.
2015-12-03 17:41:11 -05:00
Christoph Hartmann
766fe47b87 add inline documentation 2015-12-01 10:56:47 +01:00
Christoph Hartmann
2c8a8ccb25 improvement: add etc_group support for centos and add integration test 2015-12-01 10:40:12 +01:00
Dominik Richter
69be6acae8 bugfix: fail on missing access to /etc/group 2015-10-26 16:11:28 +01:00
Dominik Richter
b58a4b3f43 rename vulcanosec -> inspec 2015-10-26 12:34:15 +01:00
Christoph Hartmann
03f07e1a3e add to_s methods to resources, fixes #98 2015-10-12 13:01:58 +02:00
Christoph Hartmann
2499fc72f9 improve etc_group parser, keep parsed data internally instead of raw data 2015-10-07 18:45:08 +02:00
Christoph Hartmann
9fb51b44a2 modify etc_group to return complete group info 2015-10-07 18:45:08 +02:00
Christoph Hartmann
e57505739e improvement: return gids in etc_group as integer 2015-10-07 18:45:07 +02:00
Christoph Hartmann
3e9526d992 improvement: run etc_group on unix only 2015-10-07 18:45:07 +02:00
Christoph Hartmann
028e7f977e filter comments in /etc/group 2015-10-07 18:45:07 +02:00
Christoph Hartmann
8fff2ee989 add author header 2015-10-06 18:55:44 +02:00
Dominik Richter
903b9642e4 lint resources
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:42 +02:00
Christoph Hartmann
92ff33cbba improvement: use separate object to hold filter state, optimize users output 2015-09-21 14:07:58 +02:00
Christoph Hartmann
36c9de7529 more rubocop fixes 2015-09-04 09:59:30 +02:00
Christoph Hartmann
349d5bf9f1 harmonize method definition style 2015-09-03 20:43:58 +02:00
Dominik Richter
601abe2579 rename backend reference @vulcano -> vulcano
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-08-29 19:33:15 -07:00
Dominik Richter
84102b89de rename contents -> content
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-08-29 02:10:36 -07:00
Dominik Richter
dddc9daed0 migrated inetd config and etc group
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-08-28 12:52:59 -07:00
Dominik Richter
61f5f95147 make sure etc group values in where clause are strings
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-08-02 20:49:55 -07:00
Dominik Richter
07edef95ad flatten users of groups
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-08-02 18:56:14 -07:00
Dominik Richter
3682a8279d make sure to get conditions as symbols
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-08-02 18:49:05 -07:00
Dominik Richter
e0b0b52af3 feature: etc_group with where-function overhaul
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-08-02 18:42:05 -07:00
Dominik Richter
53112f4156 move resource methods to respective library files
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-08-02 17:40:08 -07:00
Christoph Hartmann
8e16decccd refactor types 2015-07-26 12:30:12 +02:00
Christoph Hartmann
fd4bb5f467 bugfix: fix id 2015-07-16 01:40:37 +02:00
Christoph Hartmann
018601480d add etc_group implementation 2015-07-15 15:16:10 +02:00