Skip to content

Instantly share code, notes, and snippets.

@jeremymv2
Last active October 30, 2017 13:28
Show Gist options
  • Save jeremymv2/cb34e6dfcad040b1cad50636d256b44e to your computer and use it in GitHub Desktop.
Save jeremymv2/cb34e6dfcad040b1cad50636d256b44e to your computer and use it in GitHub Desktop.
inspec cli Automate
Inspec Profile storage in Automate requires Automate >= 0.6.6, inspec >= 1.7.0
# login via inspec cli with data collector token
inspec compliance login_automate https://automate-server.test --insecure true --user admin --dctoken 93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506 --ent brewinc
# get user token
delivery token -u jmiller -s automate-server.test -e brewinc
# login with user token
inspec compliance login_automate https://automate-server.test --insecure true --user jmiller --usertoken tzwlbWMtgBC0lo6sxkAYKSShxSJEohnU7IAE4NCUGCg= --ent brewinc
# create a tar.gz of the profile
$ inspec archive base/ssh
I, [2016-12-05T12:28:54.142593 #36091] INFO -- : Checking profile in base/ssh
I, [2016-12-05T12:28:54.142671 #36091] INFO -- : Metadata OK.
`command(sshd).exist?` is not suported on your OS:
`command(ssh).exist?` is not suported on your OS:
I, [2016-12-05T12:28:54.199594 #36091] INFO -- : Found 62 controls.
I, [2016-12-05T12:28:54.199713 #36091] INFO -- : Control definitions OK.
I, [2016-12-05T12:28:54.201908 #36091] INFO -- : Generate archive /Users/jmiller/Devel/compliance-profiles/ssh.tar.gz.
I, [2016-12-05T12:28:54.206093 #36091] INFO -- : Finished archive generation.
# upload to Automate
$ inspec compliance upload /Users/jmiller/Devel/compliance-profiles/ssh.tar.gz
I, [2016-12-05T12:29:44.382646 #36129] INFO -- : Checking profile in /Users/jmiller/Devel/compliance-profiles/ssh.tar.gz
I, [2016-12-05T12:29:44.382771 #36129] INFO -- : Metadata OK.
I, [2016-12-05T12:29:44.437005 #36129] INFO -- : Found 62 controls.
I, [2016-12-05T12:29:44.437138 #36129] INFO -- : Control definitions OK.
Profile is valid
Start upload to jmiller/ssh
Uploading to Chef Automate
Successfully uploaded profile
$
# view profiles
$ inspec compliance profiles
== Available profiles:
* jmiller/linux
* jmiller/ssh
$
# execute profile from Automate
$ inspec compliance exec jmiller/ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment