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
2 answers

CIS benchmarks compliance translated to ruby scripts

I’ve been discovering inspec lately and I’m trying to translate some CIS benchmarks to ruby scripts that I can execute using InSpec. The thing is that I’m not familiar with ruby, by any chance, can I use another language for coding those scripts…
Aicha KERMICHE
  • 37
  • 1
  • 10
0
votes
1 answer

Check for updates in InSpec

Is there a way to check for updates for packages in InSpec? Something like: describe package 'httpd' do it { should be_uptodate } end I can't find any resources to help there.
0
votes
0 answers

Check maven version using inspec

I have a inspec test as shown below describe command('mvn -version) do its('exit_status') {should eq 0 } end on running the test case is failing as exit status after running the command on the machine is coming 127. But I can confirm that maven…
thinkingmonster
  • 5,063
  • 8
  • 35
  • 57
0
votes
1 answer

InSpec + TestKitchen: How to execute command on behalf of specific user?

My Chef cookbook installs Ruby locally for specific user. I want to write an InSpec test that checks if specific version of Ruby is available and if gems are installed without documentation. So obviously I somehow need to run commands on behalf of…
Kirill
  • 6,762
  • 4
  • 51
  • 81
0
votes
1 answer

How to test user belongs to a list of group using Chef Inspec?

I have a user bogus_user that belongs to three groups bogus_user, sftpusers and airflow. In my spec I have the following declaration but I have to put the groups in a particular order for it to pass validation. I dont think this ideal, is there a…
sdot257
  • 10,046
  • 26
  • 88
  • 122
0
votes
2 answers

Inspec: checking for user and group

What's the difference between these two? it { should be_owned_by 'cool_user' } vs its('owner') { should eq 'cool_user' } it { should be_grouped_into 'cool_group' } vs its('group') { should eq 'cool_group' }
sdot257
  • 10,046
  • 26
  • 88
  • 122
0
votes
1 answer

How can I write an inspec kitchen test that will verify that a web service on the node is reachable

I have a chef recipe that installs a web service. I want to write an inspec test that verifies this. So my thought was to write the following test: # Verify that the service is running. describe http('http://localhost/myservice/healthcheck') do …
Jason Thompson
  • 4,643
  • 5
  • 50
  • 74
0
votes
2 answers

Inspec Resource (for windows server) for GPOs

I want to make an inspec (chef) for diffrent GPOs. I`m wondering to know is there any resource for GPOs (windows server). because I dont have enough knowledge of gpos and how they work trough a powershell. So, I appreciate if you send me any…
Aira
  • 179
  • 2
  • 3
  • 13
0
votes
0 answers

select or fetch value from an array. chef inspec

Having an array command port.where{port= /.+/}.ports with result: [111, 20048, 80, 5556, 5557, 1622, 22, 23, 33080, 5432, 25, 443, 2620, 26365, 2049, 10500, 199, 29460, 7188, 4118, 55755, 35461, 51986, 123, 16515, 161, 646, 659, 13666, 29013, 611,…
0
votes
1 answer

InSpec should_be_listening Test Fails When Port is Open

Environment chefdk 1.3.40 berks 5.6.4 kitchen 1.16.0 vagrant 1.9.3 After a 'kitchen login', we can see that port 80 has been opened sudo iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j…
Paul Croarkin
  • 14,496
  • 14
  • 79
  • 118
0
votes
2 answers

Chef-InSpec: Resources for windows OS

I'm just starting to learn Inspec. I'm wondering to know is there any resources for check installed the driver(e.x virtio-win) or kernel in windows? or is that possible to looking in one directory and say that test.sys exists?
Aira
  • 179
  • 2
  • 3
  • 13
0
votes
1 answer

kitchen verify output show double test report

Using kitchen verify I got a double report of my suite test. I don't know why and it is happening only in this cookbook. I ran the same kitchen verify command and the output is clear so what is different now? It is the output (with double…
Robert
  • 10,403
  • 14
  • 67
  • 117
0
votes
1 answer

Chef Test Kitchen verify file exists inside Docker container

I try to run simple test using Chef test kitchen: describe file('/opt/test_file.txt') do it { should exist } end I can easy run this test on my kitchen machine (virtualBox/centos-7.2) using kitchen verify. How can I run this test inside a…
Robert Grądzki
  • 139
  • 1
  • 2
  • 8
0
votes
2 answers

How create context with InSpec?

I am creating my tests with InSpec. It is my test for Apache: require 'inspec' if os[:family] == 'redhat' describe package 'httpd' do it { should be_installed } end describe service 'httpd' do it { should be_enabled } it {…
Robert
  • 10,403
  • 14
  • 67
  • 117
0
votes
1 answer

Chef InSpec test for testing a path presence in %PATH%

I want to check whether a path has been added in windows %PATH% environment variable, using InSpec test in Chef. I'm not able to find any hints online. describe command('echo %PATH%') do its('stdout') { should match /C:\SoftwareX\bin/ } end It's…
Kumar Vikramjeet
  • 253
  • 1
  • 4
  • 13