Info regarding inspec resources and matchers


#1

Hi All,

I am new to inspec and while checking examples, i found that I could only see few global matchers but in example there are many used.

Where can i see other matchers for e.g.

describe directory(path) do
its(‘mode’) { should cmp ‘0755’ }
end

In above example what is mode and where can i see the complete list which i can use for directory?

Thanks and regards,
Prabhir


#2

The properties for inspec resources are well documented on the website. In the case of the directory resource, this is actually equivalent to the file resource. So all of the properties for file apply to directory. You can see them here: https://www.inspec.io/docs/reference/resources/file/

Mode refers to the unix permission bits for the directory or file which determine if the file is readable ®, writeable (W), or executable (X) for the owning user, owner group and everyone else. In your example, 0755 means that the directory is fully RWX (hence the 7) for the owning user, Readable and Executable (hence the 5) by the owning group, and Readable and Executable (indicated by the last 5) for any other user. You can learn more about how these numbers work and converting them from permission bits to octal numbers from lots of sites on the internet.


#3

Thank you kwalters. Thanks for the pointer.
So the document available at https://www.inspec.io/docs/reference/resources has all the information right?
Anything else I have to refer to get more information on this?

Thanks and Regards,
Prabhir


#4

Yes, the Resources page should be your main reference.

I also recommend the Glossary, which should help you understand the terminology a bit better - https://www.inspec.io/docs/reference/glossary/