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>
This commit is contained in:
Miah Johnson 2018-02-19 06:26:49 -08:00 committed by Christoph Hartmann
parent 9a7b9ccec0
commit 7b23fa479c
94 changed files with 144 additions and 188 deletions

View file

@ -1,11 +1,11 @@
# encoding: utf-8
# author: Jen Burns, burnsjennifere@gmail.com
require 'utils/filter'
require 'utils/parser'
module Inspec::Resources
class AideConf < Inspec.resource(1)
name 'aide_conf'
supports platform: 'unix'
desc 'Use the aide_conf InSpec audit resource to test the rules established for
the file integrity tool AIDE. Controlled by the aide.conf file typically at /etc/aide.conf.'
example "

View file

@ -1,11 +1,10 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
module Inspec::Resources
class Apache < Inspec.resource(1)
name 'apache'
supports platform: 'unix'
desc 'Use the apache InSpec audit resource to retrieve Apache environment settings.'
example "
describe apache do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/simpleconfig'
require 'utils/find_files'
@ -9,8 +7,8 @@ require 'utils/find_files'
module Inspec::Resources
class ApacheConf < Inspec.resource(1)
name 'apache_conf'
supports os_family: 'linux'
supports os_family: 'debian'
supports platform: 'linux'
supports platform: 'debian'
desc 'Use the apache_conf InSpec audit resource to test the configuration settings for Apache. This file is typically located under /etc/apache2 on the Debian and Ubuntu platforms and under /etc/httpd on the Fedora, CentOS, Red Hat Enterprise Linux, and Arch Linux platforms. The configuration settings may vary significantly from platform to platform.'
example "
describe apache_conf do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Verifies apt and ppa repositories
#
@ -31,6 +29,7 @@ require 'uri'
module Inspec::Resources
class AptRepository < Inspec.resource(1)
name 'apt'
supports platform: 'unix'
desc 'Use the apt InSpec audit resource to verify Apt repositories on the Debian and Ubuntu platforms, and also PPA repositories on the Ubuntu platform.'
example "
describe apt('nginx/stable') do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
# Advanced Auditing:
# As soon as you start applying Advanced Audit Configuration Policy, legacy policies will be completely ignored.
@ -26,6 +24,7 @@
module Inspec::Resources
class AuditPolicy < Inspec.resource(1)
name 'audit_policy'
supports platform: 'unix'
desc 'Use the audit_policy InSpec audit resource to test auditing policies on the Microsoft Windows platform. An auditing policy is a category of security-related events to be audited. Auditing is disabled by default and may be enabled for categories like account management, logon events, policy changes, process tracking, privilege use, system events, or object access. For each enabled auditing category property, the auditing level may be set to No Auditing, Not Specified, Success, Success and Failure, or Failure.'
example "
describe audit_policy do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Jen Burns
require 'forwardable'
require 'utils/filter_array'
@ -15,6 +12,7 @@ module Inspec::Resources
attr_reader :params
name 'auditd'
supports platform: 'unix'
desc 'Use the auditd InSpec audit resource to test the rules for logging that exist on the system. The audit.rules file is typically located under /etc/audit/ and contains the list of rules that define what is captured in log files. These rules are output using the auditcl -l command.'
example "
describe auditd.syscall('chown').where {arch == 'b32'} do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
module Inspec::Resources
class AuditDaemonConf < Inspec.resource(1)
name 'auditd_conf'
supports platform: 'unix'
desc "Use the auditd_conf InSpec audit resource to test the configuration settings for the audit daemon. This file is typically located under /etc/audit/auditd.conf' on UNIX and Linux platforms."
example "
describe auditd_conf do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/command_wrapper'
require 'resources/command'
@ -8,6 +6,7 @@ require 'resources/command'
module Inspec::Resources
class Bash < Cmd
name 'bash'
supports platform: 'unix'
desc 'Run a command or script in BASH.'
example "
describe bash('ls -al /') do

View file

@ -1,12 +1,11 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'resources/file'
module Inspec::Resources
class Bond < FileResource
name 'bond'
supports platform: 'unix'
desc 'Use the bond InSpec audit resource to test a logical, bonded network interface (i.e. "two or more network interfaces aggregated into a single, logical network interface"). On Linux platforms, any value in the /proc/net/bonding directory may be tested.'
example "
describe bond('bond0') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
# describe bridge('br0') do
@ -11,6 +9,7 @@
module Inspec::Resources
class Bridge < Inspec.resource(1)
name 'bridge'
supports platform: 'unix'
desc 'Use the bridge InSpec audit resource to test basic network bridge properties, such as name, if an interface is defined, and the associations for any defined interface.'
example "
describe bridge 'br0' do

View file

@ -1,11 +1,11 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
module Inspec::Resources
class Cmd < Inspec.resource(1)
name 'command'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the command InSpec audit resource to test an arbitrary command that is run on the system.'
example "
describe command('ls -al /') do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Markus Grobelin
# Usage:
# describe cpan('DBD::Pg') do
@ -12,6 +9,7 @@
module Inspec::Resources
class CpanPackage < Inspec.resource(1)
name 'cpan'
supports platform: 'unix'
desc 'Use the `cpan` InSpec audit resource to test Perl modules that are installed by system packages or the CPAN installer.'
example "
describe cpan('DBD::Pg') do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Markus Grobelin
# Usage:
# describe cran('DBI') do
@ -12,6 +9,7 @@
module Inspec::Resources
class CranPackage < Inspec.resource(1)
name 'cran'
supports platform: 'unix'
desc 'Use the `cran` InSpec audit resource to test R modules that are installed from CRAN package repository.'
example "
describe cran('DBI') do

View file

@ -6,6 +6,7 @@ require 'utils/filter'
module Inspec::Resources
class Crontab < Inspec.resource(1)
name 'crontab'
supports platform: 'unix'
desc 'Use the crontab InSpec audit resource to test the contents of the crontab for a given user which contains information about scheduled tasks owned by that user.'
example "
describe crontab(user: 'root') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Parses a csv document
# This implementation was inspired by a blog post
@ -8,6 +6,10 @@
module Inspec::Resources
class CsvConfig < JsonConfig
name 'csv'
supports platform: 'unix'
supports platform: 'windows'
supports platform: 'esx'
supports platform: 'cisco'
desc 'Use the csv InSpec audit resource to test configuration data in a CSV file.'
example "
describe csv('example.csv') do

View file

@ -1,11 +1,10 @@
# encoding: utf-8
# author: Doc Walker
require 'openssl'
class DhParams < Inspec.resource(1)
name 'dh_params'
supports platform: 'unix'
desc '
Use the `dh_params` InSpec audit resource to test Diffie-Hellman (DH)
parameters.

View file

@ -1,12 +1,12 @@
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'resources/file'
module Inspec::Resources
class Directory < FileResource
name 'directory'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the directory InSpec audit resource to test if the file type is a directory. This is equivalent to using the file InSpec audit resource and the be_directory matcher, but provides a simpler and more direct way to test directories. All of the matchers available to file may be used with directory.'
example "
describe directory('path') do

View file

@ -2,9 +2,6 @@
#
# Copyright 2017, Christoph Hartmann
#
# author: Christoph Hartmann
# author: Patrick Muench
# author: Dominik Richter
require 'utils/filter'
require 'hashie/mash'
@ -84,7 +81,7 @@ module Inspec::Resources
# - docker_image
class Docker < Inspec.resource(1)
name 'docker'
supports platform: 'unix'
desc "
A resource to retrieve information about docker
"

View file

@ -1,10 +1,6 @@
# encoding: utf-8
#
# Copyright 2017, Christoph Hartmann
#
# author: Christoph Hartmann
# author: Patrick Muench
# author: Dominik Richter
require_relative 'docker_object'
@ -13,6 +9,7 @@ module Inspec::Resources
include Inspec::Resources::DockerObject
name 'docker_container'
supports platform: 'unix'
desc ''
example "
describe docker_container('an-echo-server') do

View file

@ -1,10 +1,6 @@
# encoding: utf-8
#
# Copyright 2017, Christoph Hartmann
#
# author: Christoph Hartmann
# author: Patrick Muench
# author: Dominik Richter
require_relative 'docker_object'
@ -13,6 +9,7 @@ module Inspec::Resources
include Inspec::Resources::DockerObject
name 'docker_image'
supports platform: 'unix'
desc ''
example "
describe docker_image('alpine:latest') do

View file

@ -1,11 +1,6 @@
# encoding: utf-8
#
# Copyright 2017, Christoph Hartmann
#
# author: Christoph Hartmann
# author: Patrick Muench
# author: Dominik Richter
# author: Matt Kulka
require_relative 'docker_object'
@ -14,6 +9,7 @@ module Inspec::Resources
include Inspec::Resources::DockerObject
name 'docker_service'
supports platform: 'unix'
desc 'Swarm-mode service'
example "
describe docker_service('service1') do

View file

@ -7,6 +7,7 @@ require 'resources/package'
module Inspec::Resources
class Elasticsearch < Inspec.resource(1)
name 'elasticsearch'
supports platform: 'unix'
desc "Use the Elasticsearch InSpec audit resource to test the status of nodes in
an Elasticsearch cluster."

View file

@ -1,12 +1,12 @@
# encoding: utf-8
# copyright:
# author: Matthew Dromazos
require 'utils/parser'
module Inspec::Resources
class EtcFstab < Inspec.resource(1)
name 'etc_fstab'
supports platform: 'unix'
desc 'Use the etc_fstab InSpec audit resource to check the configuration of the etc/fstab file.'
example "
nfs_systems = etc_fstab.nfs_file_systems.entries

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
# The file format consists of
# - group name
@ -29,6 +27,7 @@ module Inspec::Resources
include CommentParser
name 'etc_group'
supports platform: 'unix'
desc 'Use the etc_group InSpec audit resource to test groups that are defined on Linux and UNIX platforms. The /etc/group file stores details about each group---group name, password, group identifier, along with a comma-separate list of users that belong to the group.'
example "
describe etc_group do

View file

@ -1,10 +1,10 @@
# encoding: utf-8
# author: Matthew Dromazos
require 'utils/parser'
class EtcHosts < Inspec.resource(1)
name 'etc_hosts'
supports platform: 'unix'
desc 'Use the etc_hosts InSpec audit resource to find an
ip_address and its associated hosts'
example "

View file

@ -1,11 +1,11 @@
# encoding: utf-8
# author: Matthew Dromazos
require 'utils/parser'
module Inspec::Resources
class EtcHostsAllow < Inspec.resource(1)
name 'etc_hosts_allow'
supports platform: 'unix'
desc 'Use the etc_hosts_allow InSpec audit resource to test the connections
the client will allow. Controlled by the /etc/hosts.allow file.'
example "
@ -101,6 +101,7 @@ module Inspec::Resources
class EtcHostsDeny < EtcHostsAllow
name 'etc_hosts_deny'
supports platform: 'unix'
desc 'Use the etc_hosts_deny InSpec audit resource to test the connections
the client will deny. Controlled by the /etc/hosts.deny file.'
example "

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
require 'shellwords'
@ -21,6 +19,8 @@ module Inspec::Resources
include LinuxMountParser
name 'file'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the file InSpec audit resource to test all system file types, including files, directories, symbolic links, named pipes, sockets, character devices, block devices, and doors.'
example "
describe file('path') do

View file

@ -1,7 +1,7 @@
module Inspec::Resources
class FileSystemResource < Inspec.resource(1)
name 'filesystem'
supports os_family: 'linux'
supports platform: 'linux'
desc 'Use the filesystem InSpec resource to test file system'
example "
describe filesystem('/') do

View file

@ -1,5 +1,4 @@
# encoding: utf-8
# author: Matthew
module Inspec::Resources
class FirewallD < Inspec.resource(1)
@ -9,6 +8,7 @@ module Inspec::Resources
###
name 'firewalld'
supports platform: 'unix'
desc 'Use the firewalld resource to check and see if firewalld is configured to grand or deny access to specific hosts or services'
example "
describe firewalld do

View file

@ -1,11 +1,10 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Joe Nuspl
module Inspec::Resources
class GemPackage < Inspec.resource(1)
name 'gem'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the gem InSpec audit resource to test if a global gem package is installed.'
example "
describe gem('rubocop') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/filter'
@ -27,6 +25,8 @@ module Inspec::Resources
include GroupManagementSelector
name 'groups'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the group InSpec audit resource to test groups on the system. Groups can be filtered.'
example "
describe groups.where { name == 'root'} do
@ -82,6 +82,8 @@ module Inspec::Resources
include GroupManagementSelector
name 'group'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the group InSpec audit resource to test groups on the system.'
example "
describe group('root') do

View file

@ -1,10 +1,10 @@
# encoding: utf-8
# author: Thomas Cate
require 'utils/simpleconfig'
class GrubConfig < Inspec.resource(1)
name 'grub_conf'
supports platform: 'unix'
desc 'Use the grub_conf InSpec audit resource to test the boot config of Linux systems that use Grub.'
example "
describe grub_conf('/etc/grub.conf', 'default') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
# describe host('example.com') do
@ -29,6 +27,8 @@ require 'resolv'
module Inspec::Resources
class Host < Inspec.resource(1)
name 'host'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the host InSpec audit resource to test the name used to refer to a specific host and its availability, including the Internet protocols and ports over which that host name should be available.'
example "
describe host('example.com') do

View file

@ -1,7 +1,6 @@
# encoding: utf-8
# copyright: 2017, Criteo
# copyright: 2017, Chef Software Inc
# author: Guilhem Lettron, Christoph Hartmann
# license: Apache v2
require 'faraday'
@ -10,6 +9,7 @@ require 'hashie'
module Inspec::Resources
class Http < Inspec.resource(1)
name 'http'
supports platform: 'unix'
desc 'Use the http InSpec audit resource to test http call.'
example "
describe http('http://localhost:8080/ping', auth: {user: 'user', pass: 'test'}, params: {format: 'html'}) do

View file

@ -5,6 +5,7 @@
module Inspec::Resources
class IisApp < Inspec.resource(1)
name 'iis_app'
supports platform: 'windows'
desc 'Tests IIS application configuration on windows. Supported in server 2012+ only'
example "
describe iis_app('/myapp', 'Default Web Site') do

View file

@ -16,6 +16,7 @@
module Inspec::Resources
class IisSite < Inspec.resource(1)
name 'iis_site'
supports platform: 'windows'
desc 'Tests IIS site configuration on windows. Supported in server 2012+ only'
example "
describe iis_site('Default Web Site') do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
module Inspec::Resources
class InetdConf < Inspec.resource(1)
name 'inetd_conf'
supports platform: 'unix'
desc 'Use the inetd_conf InSpec audit resource to test if a service is enabled in the inetd.conf file on Linux and UNIX platforms. inetd---the Internet service daemon---listens on dedicated ports, and then loads the appropriate program based on a request. The inetd.conf file is typically located at /etc/inetd.conf and contains a list of Internet services associated to the ports on which that service will listen. Only enabled services may handle a request; only services that are required by the system should be enabled.'
example "
describe inetd_conf do

View file

@ -1,12 +1,12 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
module Inspec::Resources
class IniConfig < JsonConfig
name 'ini'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the ini InSpec audit resource to test data in a INI file.'
example "
descibe ini do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Aaron Lippold
require 'utils/convert'
module Inspec::Resources
class NetworkInterface < Inspec.resource(1)
name 'interface'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the interface InSpec audit resource to test basic network adapter properties, such as name, status, and link speed (in MB/sec).'
example "
describe interface('eth0') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
# describe iptables do
@ -24,6 +22,7 @@
module Inspec::Resources
class IpTables < Inspec.resource(1)
name 'iptables'
supports platform: 'linux'
desc 'Use the iptables InSpec audit resource to test rules that are defined in iptables, which maintains tables of IP packet filtering rules. There may be more than one table. Each table contains one (or more) chains (both built-in and custom). A chain is a list of rules that match packets. When the rule matches, the rule defines what target to assign to the packet.'
example "
describe iptables do

View file

@ -1,12 +1,14 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/object_traversal'
module Inspec::Resources
class JsonConfig < Inspec.resource(1)
name 'json'
supports platform: 'unix'
supports platform: 'windows'
supports platform: 'esx'
supports platform: 'cisco'
desc 'Use the json InSpec audit resource to test data in a JSON file.'
example "
describe json('policyfile.lock.json') do

View file

@ -1,12 +1,9 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Aaron Lippold
# author: Adam Leff
module Inspec::Resources
class KernelModule < Inspec.resource(1)
name 'kernel_module'
supports platform: 'unix'
desc 'Use the kernel_module InSpec audit resource to test kernel modules on
Linux platforms. These parameters are located under /lib/modules. Any submodule
may be tested using this resource.

View file

@ -1,9 +1,9 @@
# encoding: utf-8
# author: Christoph Hartmann
module Inspec::Resources
class KernelParameter < Inspec.resource(1)
name 'kernel_parameter'
supports platform: 'unix'
desc 'Use the kernel_parameter InSpec audit resource to test kernel parameters on Linux platforms.'
example "
describe kernel_parameter('net.ipv4.conf.all.forwarding') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Richard Nixon
# author: Christoph Hartmann
require 'openssl'
require 'hashie/mash'
@ -8,6 +6,8 @@ require 'hashie/mash'
module Inspec::Resources
class RsaKey < Inspec.resource(1)
name 'key_rsa'
supports platform: 'unix'
supports platform: 'windows'
desc 'public/private RSA key pair test'
example "
describe key_rsa('/etc/pki/www.mywebsite.com.key') do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
module Inspec::Resources
class LimitsConf < Inspec.resource(1)
name 'limits_conf'
supports platform: 'unix'
desc 'Use the limits_conf InSpec audit resource to test configuration settings in the /etc/security/limits.conf file. The limits.conf defines limits for processes (by user and/or group names) and helps ensure that the system on which those processes are running remains stable. Each process may be assigned a hard or soft limit.'
example "
describe limits_conf do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
@ -20,6 +18,7 @@ require 'utils/simpleconfig'
module Inspec::Resources
class LoginDef < Inspec.resource(1)
name 'login_defs'
supports platform: 'unix'
desc 'Use the login_defs InSpec audit resource to test configuration settings in the /etc/login.defs file. The logins.defs file defines site-specific configuration for the shadow password suite on Linux and UNIX platforms, such as password expiration ranges, minimum/maximum values for automatic selection of user and group identifiers, or the method with which passwords are encrypted.'
example "
describe login_defs do

View file

@ -1,13 +1,11 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Joseph Benden
require 'utils/simpleconfig'
module Inspec::Resources
class Mount < Inspec.resource(1)
name 'mount'
supports platform: 'unix'
desc 'Use the mount InSpec audit resource to test if mount points.'
example "
describe mount('/') do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Nolan Davidson
# author: Christoph Hartmann
# author: Dominik Richter
require 'hashie/mash'
require 'utils/database_helpers'
@ -15,6 +12,7 @@ module Inspec::Resources
# @see https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-connect-and-query-sqlcmd
class MssqlSession < Inspec.resource(1)
name 'mssql_session'
supports platform: 'windows'
desc 'Use the mssql_session InSpec audit resource to test SQL commands run against a MS Sql Server database.'
example "
# Using SQL authentication

View file

@ -1,11 +1,10 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
module Inspec::Resources
class Mysql < Inspec.resource(1)
name 'mysql'
supports platform: 'unix'
attr_reader :package, :service, :conf_dir, :conf_path, :data_dir, :log_dir, :log_path, :log_group, :log_dir_group
def initialize

View file

@ -1,6 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
require 'utils/simpleconfig'
require 'utils/find_files'
@ -28,6 +27,8 @@ module Inspec::Resources
class MysqlConf < Inspec.resource(1)
name 'mysql_conf'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the mysql_conf InSpec audit resource to test the contents of the configuration file for MySQL, typically located at /etc/mysql/my.cnf or /etc/my.cnf.'
example "
describe mysql_conf('path') do

View file

@ -1,12 +1,11 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# author: Aaron Lippold
module Inspec::Resources
class MysqlSession < Inspec.resource(1)
name 'mysql_session'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the mysql_session InSpec audit resource to test SQL commands run against a MySQL database.'
example "
sql = mysql_session('my_user','password','host')

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Aaron Lippold, lippold@gmail.com
# author: Rony Xavier, rx294@gmail.com
require 'pathname'
require 'hashie/mash'
@ -8,6 +6,7 @@ require 'hashie/mash'
module Inspec::Resources
class Nginx < Inspec.resource(1)
name 'nginx'
supports platform: 'unix'
desc 'Use the nginx InSpec audit resource to test information about your NGINX instance.'
example "
describe nginx do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/nginx_parser'
require 'utils/find_files'
@ -16,6 +14,7 @@ require 'forwardable'
module Inspec::Resources
class NginxConf < Inspec.resource(1)
name 'nginx_conf'
supports platform: 'unix'
desc 'Use the nginx_conf InSpec resource to test configuration data '\
'for the NginX web server located in /etc/nginx/nginx.conf on '\
'Linux and UNIX platforms.'

View file

@ -1,10 +1,10 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
module Inspec::Resources
class NpmPackage < Inspec.resource(1)
name 'npm'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the npm InSpec audit resource to test if a global npm package is installed. npm is the the package manager for Nodejs packages, such as bower and StatsD.'
example "
describe npm('bower') do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
module Inspec::Resources
class NtpConf < Inspec.resource(1)
name 'ntp_conf'
supports platform: 'unix'
desc 'Use the ntp_conf InSpec audit resource to test the synchronization settings defined in the ntp.conf file. This file is typically located at /etc/ntp.conf.'
example "
describe ntp_conf do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# This resource talks with OneGet (https://github.com/OneGet/oneget)
# Its part of Windows Management Framework 5.0 and part of Windows 10
@ -12,6 +10,7 @@
module Inspec::Resources
class OneGetPackage < Inspec.resource(1)
name 'oneget'
supports platform: 'windows'
desc 'Use the oneget InSpec audit resource to test if the named package and/or package version is installed on the system. This resource uses OneGet, which is part of the Windows Management Framework 5.0 and Windows 10. This resource uses the Get-Package cmdlet to return all of the package names in the OneGet repository.'
example "
describe oneget('zoomit') do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Nolan Davidson
# author: Christoph Hartmann
# author: Dominik Richter
require 'hashie/mash'
require 'utils/database_helpers'
@ -15,6 +12,8 @@ module Inspec::Resources
#
class OracledbSession < Inspec.resource(1)
name 'oracledb_session'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the oracledb_session InSpec resource to test commands against an Oracle database'
example "
sql = oracledb_session(user: 'my_user', pass: 'password')

View file

@ -1,12 +1,12 @@
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'resources/platform'
module Inspec::Resources
class OSResource < PlatformResource
name 'os'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the os InSpec audit resource to test the platform on which the system is running.'
example "
describe os[:family] do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
#
@ -15,6 +13,8 @@ require 'utils/simpleconfig'
module Inspec::Resources
class OsEnv < Inspec.resource(1)
name 'os_env'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the os_env InSpec audit resource to test the environment variables for the platform on which the system is running.'
example "
describe os_env('VARIABLE') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Resource to determine package information
#
@ -11,6 +9,8 @@
module Inspec::Resources
class Package < Inspec.resource(1)
name 'package'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the package InSpec audit resource to test if the named package and/or package version is installed on the system.'
example "
describe package('nginx') do

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2017, Chef Software, Inc. <legal@chef.io>
# author: Joshua Timberman
# author: Alex Pop
require 'utils/filter'
module Inspec::Resources
class Packages < Inspec.resource(1)
name 'packages'
supports platform: 'unix'
desc 'Use the packages InSpec audit resource to test properties for multiple packages installed on the system'
example "
describe packages(/xserver-xorg.*/) do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# Usage example:
#
@ -15,6 +13,8 @@
module Inspec::Resources
class PConfig < Inspec.resource(1)
name 'parse_config'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the parse_config InSpec audit resource to test arbitrary configuration files.'
example "
output = command('some-command').stdout

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
# The file format consists of
# - username
@ -18,6 +16,7 @@ require 'utils/filter'
module Inspec::Resources
class Passwd < Inspec.resource(1)
name 'passwd'
supports platform: 'unix'
desc 'Use the passwd InSpec audit resource to test the contents of /etc/passwd, which contains the following information for users that may log into the system and/or as users that own running processes.'
example "
describe passwd do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
# describe pip('Jinja2') do
@ -11,6 +9,8 @@
module Inspec::Resources
class PipPackage < Inspec.resource(1)
name 'pip'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the pip InSpec audit resource to test packages that are installed using the pip installer.'
example "
describe pip('Jinja2') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/parser'
require 'utils/filter'
@ -11,6 +9,8 @@ require 'ipaddr'
module Inspec::Resources
class Port < Inspec.resource(1)
name 'port'
supports platform: 'unix'
supports platform: 'windows'
desc "Use the port InSpec audit resource to test basic port properties, such as port, process, if it's listening."
example "
describe port(80) do

View file

@ -1,12 +1,10 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# author: Aaron Lippold
module Inspec::Resources
class Postgres < Inspec.resource(1)
name 'postgres'
supports platform: 'unix'
attr_reader :service, :data_dir, :conf_dir, :conf_path, :version, :cluster
def initialize

View file

@ -1,8 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# author: Aaron Lippold
require 'utils/simpleconfig'
require 'utils/find_files'
@ -11,6 +8,8 @@ require 'resources/postgres'
module Inspec::Resources
class PostgresConf < Inspec.resource(1)
name 'postgres_conf'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the postgres_conf InSpec audit resource to test the contents of the configuration file for PostgreSQL, typically located at /etc/postgresql/<version>/main/postgresql.conf or /var/lib/postgres/data/postgresql.conf, depending on the platform.'
example "
describe postgres_conf do

View file

@ -1,12 +1,11 @@
# encoding: utf-8
# author: Rony Xavier,rx294@nyu.edu
# author: Aaron Lippold, lippold@gmail.com
require 'resources/postgres'
module Inspec::Resources
class PostgresHbaConf < Inspec.resource(1)
name 'postgres_hba_conf'
supports platform: 'unix'
desc 'Use the `postgres_hba_conf` InSpec audit resource to test the client
authentication data defined in the pg_hba.conf file.'
example "

View file

@ -1,12 +1,11 @@
# encoding: utf-8
# author: Rony Xavier, rx294@nyu.edu
# author: Aaron Lippold, lippold@gmail.com
require 'resources/postgres'
module Inspec::Resources
class PostgresIdentConf < Inspec.resource(1)
name 'postgres_ident_conf'
supports platform: 'unix'
desc 'Use the postgres_ident_conf InSpec audit resource to test the client
authentication data is controlled by a pg_ident.conf file.'
example "

View file

@ -1,8 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# author: Aaron Lippold
require 'shellwords'
@ -26,6 +23,8 @@ module Inspec::Resources
class PostgresSession < Inspec.resource(1)
name 'postgres_session'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the postgres_session InSpec audit resource to test SQL commands run against a PostgreSQL database.'
example "
sql = postgres_session('username', 'password', 'host')

View file

@ -1,11 +1,10 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
module Inspec::Resources
class PowershellScript < Cmd
name 'powershell'
supports platform: 'windows'
desc 'Use the powershell InSpec audit resource to test a Windows PowerShell script on the Microsoft Windows platform.'
example "
script = <<-EOH

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/filter'
require 'ostruct'
@ -9,6 +7,8 @@ require 'ostruct'
module Inspec::Resources
class Processes < Inspec.resource(1)
name 'processes'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the processes InSpec audit resource to test properties for programs that are running on the system.'
example "
describe processes('mysqld') do

View file

@ -1,12 +1,11 @@
# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/erlang_parser'
module Inspec::Resources
class RabbitmqConf < Inspec.resource(1)
name 'rabbitmq_config'
supports platform: 'unix'
desc 'Use the rabbitmq_config InSpec resource to test configuration data '\
'for the RabbitMQ service located in /etc/rabbitmq/rabbitmq.config on '\
'Linux and UNIX platforms.'

View file

@ -1,6 +1,5 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
require 'json'
@ -49,6 +48,7 @@ require 'json'
module Inspec::Resources
class RegistryKey < Inspec.resource(1)
name 'registry_key'
supports platform: 'windows'
desc 'Use the registry_key InSpec audit resource to test key values in the Microsoft Windows registry.'
example "
describe registry_key('path\to\key') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
#
# Security Configuration and Analysis
#
@ -69,6 +67,7 @@ module Inspec::Resources
class SecurityPolicy < Inspec.resource(1)
name 'security_policy'
supports platform: 'windows'
desc 'Use the security_policy InSpec audit resource to test security policies on the Microsoft Windows platform.'
example "
describe security_policy do

View file

@ -1,7 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# author: Stephan Renatus
require 'hashie'
@ -70,6 +67,8 @@ module Inspec::Resources
# TODO: extend the logic to detect the running init system, independently of OS
class Service < Inspec.resource(1)
name 'service'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the service InSpec audit resource to test if the named service is installed, running and/or enabled.'
example "
describe service('service_name') do
@ -652,6 +651,7 @@ module Inspec::Resources
class SystemdService < Service
name 'systemd_service'
supports platform: 'unix'
desc 'Use the systemd_service InSpec audit resource to test if the named service (controlled by systemd) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection
@ -674,6 +674,7 @@ module Inspec::Resources
class UpstartService < Service
name 'upstart_service'
supports platform: 'unix'
desc 'Use the upstart_service InSpec audit resource to test if the named service (controlled by upstart) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection
@ -696,6 +697,7 @@ module Inspec::Resources
class SysVService < Service
name 'sysv_service'
supports platform: 'unix'
desc 'Use the sysv_service InSpec audit resource to test if the named service (controlled by SysV) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection
@ -718,6 +720,7 @@ module Inspec::Resources
class BSDService < Service
name 'bsd_service'
supports platform: 'unix'
desc 'Use the bsd_service InSpec audit resource to test if the named service (controlled by BSD init) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection
@ -740,6 +743,7 @@ module Inspec::Resources
class LaunchdService < Service
name 'launchd_service'
supports platform: 'unix'
desc 'Use the launchd_service InSpec audit resource to test if the named service (controlled by launchd) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection
@ -762,6 +766,7 @@ module Inspec::Resources
class RunitService < Service
name 'runit_service'
supports platform: 'unix'
desc 'Use the runit_service InSpec audit resource to test if the named service (controlled by runit) is installed, running and/or enabled.'
example "
# to override service mgmt auto-detection

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2016, Chef Software Inc.
# author: Dominik Richter
# author: Christoph Hartmann
require 'forwardable'
@ -18,6 +16,7 @@ require 'forwardable'
module Inspec::Resources
class Shadow < Inspec.resource(1)
name 'shadow'
supports platform: 'unix'
desc 'Use the shadow InSpec resource to test the contents of /etc/shadow, '\
'which contains the following information for users that may log into '\
'the system and/or as users that own running processes.'

View file

@ -1,13 +1,12 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
require 'utils/simpleconfig'
module Inspec::Resources
class SshConf < Inspec.resource(1)
name 'ssh_config'
supports platform: 'unix'
desc 'Use the `ssh_config` InSpec audit resource to test OpenSSH client configuration data located at `/etc/ssh/ssh_config` on Linux and Unix platforms.'
example "
describe ssh_config do
@ -84,6 +83,7 @@ module Inspec::Resources
class SshdConf < SshConf
name 'sshd_config'
supports platform: 'unix'
desc 'Use the sshd_config InSpec audit resource to test configuration data for the Open SSH daemon located at /etc/ssh/sshd_config on Linux and UNIX platforms. sshd---the Open SSH daemon---listens on dedicated ports, starts a daemon for each incoming connection, and then handles encryption, authentication, key exchanges, command execution, and data exchanges.'
example "
describe sshd_config do

View file

@ -1,7 +1,5 @@
# encoding: utf-8
# copyright: 2015, Chef Software Inc.
# author: Dominik Richter
# author: Christoph Hartmann
require 'sslshake'
require 'utils/filter'
@ -11,6 +9,8 @@ require 'parallel'
# Custom resource based on the InSpec resource DSL
class SSL < Inspec.resource(1)
name 'ssl'
supports platform: 'unix'
supports platform: 'windows'
desc "
SSL test resource

View file

@ -3,6 +3,8 @@ module Inspec::Resources
# this resource returns additional system informatio
class System < Inspec.resource(1)
name 'sys_info'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the user InSpec system resource to test for operating system properties.'
example "

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/parser'
require 'utils/convert'
@ -55,6 +53,8 @@ module Inspec::Resources
include UserManagementSelector
name 'users'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the users InSpec audit resource to test local user profiles. Users can be filtered by groups to which they belong, the frequency of required password changes, the directory paths to home and shell.'
example "
describe users.where { uid == 0 }.entries do
@ -140,6 +140,8 @@ module Inspec::Resources
class User < Inspec.resource(1)
include UserManagementSelector
name 'user'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the user InSpec audit resource to test user profiles, including the groups to which they belong, the frequency of required password changes, the directory paths to home and shell.'
example "
describe user('root') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'securerandom'
@ -23,6 +21,7 @@ module Inspec::Resources
# @see https://msdn.microsoft.com/en-us/library/aa364991.aspx
class VBScript < PowershellScript
name 'vbscript'
supports platform: 'windows'
desc ''
example "
script = <<-EOH

View file

@ -1,11 +1,11 @@
# encoding: utf-8
# author: Takaaki Furukawa
require 'hashie/mash'
module Inspec::Resources
class Virtualization < Inspec.resource(1)
name 'virtualization'
supports platform: 'unix'
desc 'Use the virtualization InSpec audit resource to test the virtualization platform on which the system is running'
example "
describe virtualization do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# check for a Windows feature
# Usage:
@ -30,6 +28,7 @@
module Inspec::Resources
class WindowsFeature < Inspec.resource(1)
name 'windows_feature'
supports platform: 'windows'
desc 'Use the windows_feature InSpec audit resource to test features on Microsoft Windows.'
example "
describe windows_feature('dhcp') do

View file

@ -1,9 +1,9 @@
# encoding: utf-8
# author: Matt Ray
module Inspec::Resources
class WindowsHotfix < Inspec.resource(1)
name 'windows_hotfix'
supports platform: 'windows'
desc 'Use the windows_hotfix InSpec audit resource to test if the hotfix has been installed on the Windows system.'
example "
describe windows_hotfix('KB4012212') do

View file

@ -1,9 +1,8 @@
# encoding: utf-8
# author: Gary Bright @username-is-already-taken2
# author: Chris Beard @cdbeard2016
module Inspec::Resources
class WindowsTasks < Inspec.resource(1)
name 'windows_task'
supports platform: 'windows'
desc 'Use the windows_task InSpec audit resource to test task schedules on Microsoft Windows.'
example "
describe windows_task('\\Microsoft\\Windows\\Time Synchronization\\SynchronizeTime') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/object_traversal'
@ -11,6 +9,7 @@ module Inspec::Resources
# We use Get-WmiObject via Powershell to retrieve all values.
class WMI < Inspec.resource(1)
name 'wmi'
supports platform: 'windows'
desc 'request wmi information'
example "
describe wmi({

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Richard Nixon
# author: Christoph Hartmann
require 'openssl'
require 'hashie/mash'
@ -8,6 +6,8 @@ require 'hashie/mash'
module Inspec::Resources
class X509CertificateResource < Inspec.resource(1)
name 'x509_certificate'
supports platform: 'unix'
supports platform: 'windows'
desc 'Used to test x.509 certificates'
example "
describe x509_certificate('/etc/pki/www.mywebsite.com.pem') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/parser'
require 'utils/filter'
@ -8,6 +6,7 @@ require 'utils/filter'
module Inspec::Resources
class XinetdConf < Inspec.resource(1)
name 'xinetd_conf'
supports platform: 'unix'
desc 'Xinetd services configuration.'
example "
describe xinetd_conf.services('chargen') do

View file

@ -1,9 +1,10 @@
# encoding: utf-8
# author: Jonathan Morley
module Inspec::Resources
class XmlConfig < JsonConfig
name 'xml'
supports platform: 'unix'
supports platform: 'windows'
desc 'Use the xml InSpec resource to test configuration data in an XML file'
example "
describe xml('default.xml') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'yaml'
@ -12,6 +10,10 @@ require 'yaml'
module Inspec::Resources
class YamlConfig < JsonConfig
name 'yaml'
supports platform: 'unix'
supports platform: 'windows'
supports platform: 'esx'
supports platform: 'cisco'
desc 'Use the yaml InSpec audit resource to test configuration data in a YAML file.'
example "
describe yaml('config.yaml') do

View file

@ -1,6 +1,4 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
# Usage:
# describe yum do
@ -32,6 +30,7 @@
module Inspec::Resources
class Yum < Inspec.resource(1)
name 'yum'
supports platform: 'unix'
desc 'Use the yum InSpec audit resource to test the configuration of Yum repositories.'
example "
describe yum.repo('name') do

View file

@ -1,9 +1,9 @@
# encoding: utf-8
# author: Joseph Benden
module Inspec::Resources
class ZfsDataset < Inspec.resource(1)
name 'zfs_dataset'
supports platform: 'unix'
desc "
Use the zfs_dataset InSpec audit resource to test if the named
ZFS Dataset is present and/or has certain properties.

View file

@ -1,9 +1,9 @@
# encoding: utf-8
# author: Joseph Benden
module Inspec::Resources
class ZfsPool < Inspec.resource(1)
name 'zfs_pool'
supports platform: 'unix'
desc "
Use the zfs_pool InSpec audit resource to test if the named
ZFS Pool is present and/or has certain properties.