Questions tagged [inspec]

Questions related to the InSpec testing framework by Chef.

InSpec is an -based audit testing framework. Based on the specification described in its , the state of a system (mostly a server or container) can be verified, very similar to .

Links:

119 questions
0
votes
1 answer

InSpec Kubernetes Resource Pack Ruby error

trying to get started testing kubernetes with inspec using: https://github.com/bgeesaman/inspec-k8s Im running it from the make and docker image found here: https://github.com/bgeesaman/inspec-k8s-sample I have multiple eks clusters and a local…
Staggerlee011
  • 847
  • 2
  • 13
  • 23
0
votes
1 answer

regex function in chef inspec output

I am using chef inspec for the postgressql. I am executing the below command to match the output "local0". Because the output can be local0 or local1 etc. so given % to match any number value. but getting error. pls advise. describe command("sudo…
0
votes
1 answer

Is there a syntax to remove the \n from the chef inspec output

When executing the below command: describe sql.query("show pgaudit.log;") do its("output") { should match 'ERROR: unrecognized configuration parameter "pgaudit.log"' } end Getting error as below, is there any error with the syntax, kindly…
0
votes
1 answer

Inspec include_controls or require_controls based on regex

Is there a way to include controls of a 'depends' profile based on a regex? And if not, is there a way to include all controls, and overwrite impact with fixed value on all controls? Code should look something like this, where 'controlname' is the…
NachtW
  • 1
  • 2
0
votes
1 answer

Validate database output using chef inspec

While executing the below postgresql command, how to validate the output under name column and row column using chef inspec. postgres=# select name, setting from pg_settings where (name ~ '_directory$' postgres(# or name ~ '_tablespace'); …
0
votes
1 answer

Handling Terraform provider credentials in distributed environment with InSpec and remote state

Does anyone have any cool ideas on how to handle Terraform provider credentials for AWS given these use cases: Distributed environments (prod/pre/qa/test/dev) with individual AWS accounts S3 backend remote state for all environments in a single AWS…
0
votes
0 answers

Test whether Reboot Required for (Windows Only) using Chef Inspec

I am new to Chef Inspec, I want to test Reboot Required for (Windows Only) using Inspec code. Below is my code: # Reboot Required Yes for windows control 'PowerShellTest' do impact 0.1 title 'Check powershell code inside inspec' desc …
0
votes
1 answer

inspec - i want to output structured data to be parsed by another function

I have a inspec test, this is great: inspec exec scratchpad/profiles/forum_profile --reporter yaml Trouble is I want to run this in a script and output this to an array I cannot find the documentation that indicated what method i need to use to…
soapdish
  • 55
  • 7
0
votes
1 answer

Can I run a subset of tests from one Github repo in Test Kitchen?

I reached the point where I think it makes sense to put my inspec tests in a different repo than my Chef cookbook. I just copied all dirs under test/integration into a new dir and created a repo from that. There are subdirs common, master, and…
Yegolev
  • 9
  • 6
0
votes
1 answer

Better way to get a all-in-one view of Inspec reports

We are currently using Inspec 4.18.85. In order to run parallel tests on multiple servers, we club jenkins pipeline with ansible. And this results in reports being generated in multiple servers. We tried deploying inspec_exporter to get overall…
swetad90
  • 784
  • 1
  • 13
  • 34
0
votes
1 answer

How to check a particular line using Inspec test

How do I check if the first line of the file contains a certain string using Inspec test? Currently, I am doing this. describe file ('/path/to/file/filename')do it { should exist } its('content') { should match 'build/path/location' } …
0
votes
2 answers

Getting the version variable as a output in InSpec Report

I am using chef inspc to verify the the AMI Images created using packer to fit out standards. One of the requirement is checking the version difference between AMI images. I have the following code which checks for ansible version 2.8. control…
miyuru
  • 1,141
  • 11
  • 19
0
votes
1 answer

Mock objects in Inspec

Is there a concept of mock-objects in Inspec? I want to mock a REST API, because the server providing this API is not available in my build pipeline.
user5580578
  • 1,134
  • 1
  • 12
  • 28
0
votes
2 answers

Chef Inspec: undefined local variable or method `aws_region'

I am testing out basic Chef Inspec code. I am running it from a Mac using the API call: inspec exec sg-disallow-ftp.rb -t aws:// Here is the Chef code for the profile: title 'Test AWS Security Groups Across All Regions For an Account Disallow…
0
votes
1 answer

Decision in Inspec profiles

I'm running a postgres inspec profile and would like to run certain tests only if the node is a master node. Here is my profile sql = postgres_session('postgres', password, 'localhost') result = describe sql.query('SELECT pg_is_in_recovery()') do …
nevosial
  • 1,034
  • 2
  • 13
  • 20