Advance profile

We can inherit the existing profile into our profile using the depends keywords

We can inherit the profile from the following options

  • path - this helps inherit the profile from the local profile
  • url -this helps to inherit the profile from the remote url
  • git - this helps to inherit the profile from the git repository
  • supermarket - this helps to inherit the profile from the chef supermarket
  • compliance - this helps to inherit the profile from the compliance server

Inheriting the profile from the Remote URL

Open the inpsec.yml in the editor of your choice and add the below line to the file

depends:
- name: ssh-baseline
  url: https://github.com/dev-sec/ssh-baseline/archive/master.tar.gz

Here we are adding the ssh-baseline from the Dev-Sec Framework

  • name - the flag used to specify the name of the profile

Now add the below line in the example.rb to execute the included profile along with the existing profile

include_controls 'ssh-baseline'

before running the profile remove the inspec.lock file to reload the profile

Using supports

Some times we want to run the profile only on a specific platform, in that case, we can use supports keyword

Add the below line in the inspec.yml file

supports:
  - platform-name: Windows

You will get the below error

Skipping profile: 'test-profile' on unsupported platform: 'ubuntu/20.04'.

Test Summary: 0 successful, 0 failures, 0 skipped

Now replace the platform name with the platform-name of your host-os

More Information

  1. https://www.inspec.io/docs/reference/profiles/

results matching ""

    No results matching ""