myprofile1/controls/profile1.rb
control 'pro1-con1' do
impact 0.8
title 'Profile 1 - Control 1'
describe file('/etc/hosts11111') do
its('mode') { should eq 0644 }| require 'net/http' | |
| require 'json' | |
| require 'set' | |
| # Method to return the content of the local db as a set | |
| def read_db(file_db) | |
| unless File.exists?(file_db) | |
| return nil | |
| end | |
| read_gists = Set.new |
| # encoding: utf-8 | |
| ### Sample script to export Chef Server nodes and import them to Chef Compliance | |
| ### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below | |
| ### Change the nodes_array json suit your environment | |
| ### Go to your chef-repo and check Chef Server access first | |
| # cd chef-repo; knife environment list | |
| ### Save this Ruby script as kitchen_sink.rb and run it like this: | |
| # cat kitchen_sink.rb | knife exec | |
| ### Chef Compliance API docs: https://docs.chef.io/api_compliance.html |
| # encoding: utf-8 | |
| ### Sample script to auth, list nodes, environments in Chef Compliance using the API | |
| ### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below | |
| ### Chef Compliance API docs: https://docs.chef.io/api_compliance.html | |
| require 'json' | |
| require 'uri' | |
| require 'net/http' | |
| require 'openssl' |