SlideShare une entreprise Scribd logo
1  sur  136
Télécharger pour lire hors ligne
©2016 Chef Software Inc. 1-1
Chef Compliance
Installation, Configuration, and Operation
Course v1.1.1
©2016 Chef Software Inc. 1-2
Introduce Yourselves
Name
Current job role
Previous job roles/background
Experience with Chef and/or config management
©2016 Chef Software Inc. 1-3
Objectives
After completing this course, you should be able to:
Ø Describe the capabilities of Chef Compliance.
Ø Install and initially configure the Chef Compliance server.
Ø Perform scans with Chef Compliance.
Ø Remediate compliance issues.
Ø Use InSpec to create, modify, and test Chef Compliance profiles.
Ø Schedule and run compliance reports.
Ø Manage users, organizations, teams and permissions.
Note: You should have attended at least Chef Essentials, Chef Fundamentals or have equivalent Chef
experience prior to attending this course.
©2016 Chef Software Inc. 1-4
Chef Compliance Value Proposition
You are probably aware of how Chef automates the configuration and
management of your infrastructure. But what about risks and compliance?
Regulatory compliance is a fact of life for every enterprise.
With Chef Compliance you can scan for risks and compliance issues with
easy-to-understand, customizable reports and visualization.
©2016 Chef Software Inc. 1-5
Chef Compliance
Chef Compliance
Server Your
Infrastructure
LAN/WAN
©2016 Chef Software Inc. 1-6
Chef Compliance
Chef Compliance can run without any other Chef software installed.
The nodes you scan don't even need Chef software on them if you are
scanning them for compliance.
However, you would need Chef software to create and implement
remediation recipes.
©2016 Chef Software Inc. 1-7
Chef Compliance
Reports: Chef Compliance can produce reports that indicate risks and
issues classified by severity and impact levels.
Compliance Profiles: You can get started quickly with pre-built Compliance
profiles for scanning Linux and Windows nodes.
©2016 Chef Software Inc. 1-8
Chef Compliance leverages
InSpec.
InSpec is an open-source
run-time framework and rule
language used to specify
compliance, security, and
policy requirements for
testing any node in your
infrastructure.
Chef Compliance and InSpec
control 'cis-3.1' do
impact 0.7
title 'Set Daemon umask'
desc '
Set the default umask for all processes started
at boot time.
'
describe file('/etc/sysconfig/init') do
its('content') {should match 'umask 027'}
end
end
©2016 Chef Software Inc. 1-9
InSpec includes a collection of resources to help you write auditing rules quickly and
easily using the Compliance DSL
Use InSpec to examine any node in your infrastructure; run the tests locally or
remotely.
Any detected security, compliance, or policy issues are flagged in a log and in Chef
Compliance, displayed in a GUI.
InSpec DSL
describe port(80) do
it { should_not be_listening }
end
describe port(443) do
it { should be_listening }
its('protocols') {should include 'tcp'}
end
©2016 Chef Software Inc. 1-10
The InSpec audit resource framework is fully compatible with Chef Compliance.
The Compliance DSL is a Ruby DSL for writing audit rules, which includes audit
resources that you can invoke.
InSpec DSL
describe port(80) do
it { should_not be_listening }
end
describe port(443) do
it { should be_listening }
its('protocols') {should include 'tcp'}
end
©2016 Chef Software Inc. 1-11
Compliance profiles exist for
many scenarios, such as those
created by the Center for
Internet Security (CIS)
Chef Compliance maintains
profiles as a collection of
individual controls that comprise
a complete audit.
You can also create your own
custom Compliance profiles.
Compliance Profiles
©2016 Chef Software Inc. 1-12
Compliance
Web UI
The Chef
Compliance web UI
provides views into
compliance scan
results as well as
views of Chef
Compliance
profiles.
You execute scans
via the Compliance
web UI as well.
©2016 Chef Software Inc. 1-13
Your Lab Environment for Scanning
Your Laptop
Chef Compliance
Node to run
Compliance tests
against
We will provide one machine for
you to use while performing lab
exercises in this course:
• One Linux node to perform
Chef Compliance scans
against.
We are also providing
• One shared Linux server
running Chef Compliance.
©2016 Chef Software Inc. 1-14
Your Lab Environment for Remediation
Your Laptop
Compliance
Server
Nodes to run
Compliance tests
against AND use as
workstations for
writing remediation
You will also log in to your Linux
node in order to write
remediation and run chef-client in
local mode.
This is so you can use this node
as a virtual workstation while
writing remediation.
Linux
©2016 Chef Software Inc. 1-15
w
o
r
k
s
t
a
t
i
o
n
Logging in to the Compliance Server and Linux Node
$ ssh ADDRESS -l chef
©2016 Chef Software Inc. 1-16
Login to your node
qhttp://bit.ly/2aek2zY
qchef / chef
©2016 Chef Software Inc. 1-17
Hands-on Legend
Ø GL or Group Lab: All participants and the instructor do this task
together with the instructor often leading the way and explaining
things as we proceed.
Ø Lab: You perform this task on your own.
©2016 Chef Software Inc. 1-18
Configure Chef Compliance
©2016 Chef Software Inc. 1-19
Objectives
After completing this module, you should be able to:
Ø Login to the Compliance Web UI.
©2016 Chef Software Inc. 1-20
Compliance Installation Options
You can install the Chef Compliance server as a an Amazon Machine
Images (AMI) instance or as a Standalone installation.
The standalone installation of Chef Compliance server creates a working
installation on a single server.
In this course we will use the most common method--the Standalone
method.
©2016 Chef Software Inc. 1-21
GL: Configure the Compliance Server
• From your laptop, open a web browser
and point it to the FQDN for your
Compliance Server node
• https://52.87.172.92
• chef/ chef
• Instance-id: i-19dad99f
• Click Advanced from the warning page
if present.
©2016 Chef Software Inc. 1-22
GL: Configure the Compliance Server
• Click the Proceed to ... link if
present.
Note: We have not set up SSL
so the https strikethrough and
warning is fine for now.
©2016 Chef Software Inc. 1-23
GL: Configure the Compliance Server
• User Name: chef
• Password: chef
©2016 Chef Software Inc. 1-24
GL: Configure the Compliance Server
You should now see an empty
Compliance Dashboard.
©2016 Chef Software Inc. 3-25
Running Scans, Remediation, and Testing
on Linux Nodes
Configuring the Chef Compliance Server to Run Scans and Writing Remediation Recipes
©2016 Chef Software Inc. 3-26
Objectives
After completing this module, you should be able to:
Ø Add a node to test for compliance.
Ø Run a Compliance scan.
Ø Test for compliance with InSpec from the command line interface.
Ø Remediate a compliance issue.
Ø Use Test Kitchen to test your remediation.
Ø Test for compliance with InSpec from the CLI
Ø Rescan the node and ensure compliance.
©2016 Chef Software Inc. 3-27
Adding a Node to Scan
To add a node you'll need:
• The IP address or FQDN of the nodes to be tested.
• Access configuration (ssh or WinRM).
• The node's username and password OR
• The node's username plus security key pair.
©2016 Chef Software Inc. 3-28
Objective:
Group Lab: Adding a Node to Scan
q Add a Linux Node to Scan
q Test connectivity
Note: In the next module you will perform the same exercises as in this module but using
a Windows node as your target node.
©2016 Chef Software Inc. 3-29
GL: Adding a Node to Scan
1. From your Chef Compliance
Dashboard, click Add Node.
©2016 Chef Software Inc. 3-30
GL: Adding a Node
2. From the resulting page, enter the
node's FQDN or IP address.
3. Leave environment blank. A
‘default’ environment will be used
4. Accept the default SSH Access
configuration
5. Type chef in the username field.
6. Click the password link as shown
in this illustration.
©2016 Chef Software Inc. 3-31
GL: Adding a Node to Scan
7. Type the password (chef) in
the password field.
8. Click the Add 1 node button
as shown in this illustration.
©2016 Chef Software Inc. 3-32
GL: Adding a Node to Scan
At this point your Compliance Dashboard should list the node you just added.
©2016 Chef Software Inc. 3-33
GL: Testing Connectivity to Your Node
1. Click the check box next to your node and then click the Connectivity button.
©2016 Chef Software Inc. 3-34
GL: Testing Connectivity to Your Node
The Status column of you node should now indicate Connection established.
©2016 Chef Software Inc. 3-35
Adding Nodes in Bulk
You could add additional nodes by simply
repeating the previous steps.
You could also add a number of nodes at
once by separating each hostname or IP
address with a comma or a space, as
shown in this illustration.
Chef Compliance also supports bulk loading
of nodes via API.
©2016 Chef Software Inc. 3-36
Adding Nodes in Bulk via API
After class you can go to the
following link.
The resulting kitchen_sink.rb
will step you through how to
upload nodes in bulk.
https://gist.github.com/alexpop/01b0bba8d259adeee320
©2016 Chef Software Inc. 3-37
Private Keys
In the workplace, using a security
key would be a more secure method
for connecting to nodes than using
the password method.
By clicking Settings > Add Private
Key you will see where to paste a
private key.
©2016 Chef Software Inc. 3-38
Running Compliance Scans
You can run Compliance scans on demand or schedule them to run at a later
time.
Chef Compliance maintains profiles as a collection of individual controls that
comprise a complete audit.
As mentioned previously, Chef Compliance comes with a few reference
profiles of various compliance policies that you can leverage or use as
examples to create your own.
©2016 Chef Software Inc. 3-39
Compliance Profiles Used in Scans
This image shows the default Compliance
Profiles as accessed from the Scan Nodes
page.
You should be thoughtful with which
profiles choose.
Notice how you can also choose to run a
scan on demand or schedule a scan.
©2016 Chef Software Inc. 3-40
Objective:
Group Lab: Running a Scan
q Run a Compliance scan.
q View the output of a scan.
©2016 Chef Software Inc. 3-41
GL: Running a Scan
1. Click the check box
next to your node and
then click the Scan
button.
©2016 Chef Software Inc. 3-42
GL: Running a Scan
2. From the resulting
page, check the
base/ssh profile and
uncheck any other
check boxes.
3. Click the Scan now
button.
©2016 Chef Software Inc. 3-43
Scan Results
A Compliance Report
should now display and
your scan results should be
similar to that shown here.
Notice how in the upper
Summary section in this
example, 10 tests were
compliant and 6 tests show
critical issues with ssh.
©2016 Chef Software Inc. 3-44
Scan Results
The bottom half of the
Compliance Report
shown here has a table of
details of test results.
These are sorted by
severity.
If you click an issue as
shown here, a bit more
information about the
issue displays.
©2016 Chef Software Inc. 3-45
GL: Profile
To view the InSpec code
that comprises this
profile, do the following:
1. Click the Compliance
button.
2. Click the relevant
profile (Basic SSH).
3. Scroll down and click
the `Set SSH protocol
version to 2` profile.
©2016 Chef Software Inc. 3-46
Discussion: InSpec Profile Code
Let's discuss what this
profile is doing.
The `impact` of 1.0 indicates
this is a Critical issue.
The `title` is what populates
the Compliance Report issue
title.
©2016 Chef Software Inc. 3-47
Discussion: InSpec Profile Code
The desc is typically human-
readable description sourced
from the CIS or source doc.
The `describe` section is the
actual test that is executed.
©2016 Chef Software Inc. 3-48
Compliance Profile Severity Mapping
The table below shows the current mapping
of Compliance Profile impact numbering
to severity.
Impact Numbering Severity Designation
0.7 - 1.0 Critical Issues
0.4 - <0.7 Major Issues
0 - <0.4 Minor Issues
https://nvd.nist.gov/cvss.cfm
©2016 Chef Software Inc. 3-49
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
$ more /etc/ssh/ssh_config
Example: Node's ssh config
©2016 Chef Software Inc. 3-50
Let's Remediate the Issue
Now that we've identified the ssh version issue, let's write a recipe on the
target node to remediate the issue.
Then we'll run the compliance scan again to see if we successfully
remediated the issue.
Note: In this course we will write a recipe directly on the node that we're
running scans on. Of course in a production environment you will likely write
such recipes locally and upload them to Chef Server. Then the nodes would
convergence the recipes on their next chef-client run.
©2016 Chef Software Inc. 3-51
Objective:
GL: Remediating the Issue
q Start writing a remediation recipe on that node.
q Test the recipe with Test Kitchen.
q Test for compliance with InSpec from the command line interface (CLI)
q Converge the recipe.
q Rescan the node and ensure compliance.
©2016 Chef Software Inc. 3-52
GL: Remediating the Issue
Log in to your target node (not your
compliance server node) using ssh and
ensure you are in the home directory.
Note: emacs, nano, and vim/vi are
installed on your Linux nodes. Some
tips for using them can be found below
in your participant guide.
©2016 Chef Software Inc. 3-53
$ mkdir -p cookbooks
$ cd cookbooks
GL: Create and Change to a ‘cookbooks’ Directory
From the home directory, create a `cookbooks` directory and
navigate into it.
©2016 Chef Software Inc. 3-54
Compiling Cookbooks...
Recipe: code_generator::cookbook
* directory[/home/chef/cookbooks/ssh] action create
- create new directory /home/chef/cookbooks/ssh
...
- create new file /home/chef/cookbooks/ssh/recipes/default.rb
- update content in file
/home/chef/cookbooks/ssh/recipes/default.rb from none to b702c7
(diff output suppressed by config)
$ chef generate cookbook ssh
GL: Create an SSH Cookbook
©2016 Chef Software Inc. 3-55
Compiling Cookbooks...
Recipe: code_generator::recipe
* directory[./ssh/spec/unit/recipes] action create (up to date)
* cookbook_file[./ssh/spec/spec_helper.rb] action
create_if_missing (up to date)
...
- create new file ./ssh/recipes/client.rb
- update content in file ./ssh/recipes/client.rb from none to
9c833a
(diff output suppressed by config)
$ chef generate recipe ssh client
GL: Create an SSH Client Recipe
©2016 Chef Software Inc. 3-56
Compiling Cookbooks...
Recipe: code_generator::template
* directory[./ssh/templates/default] action create
- create new directory ./ssh/templates/default
* file[./ssh/templates/default/ssh_config.erb] action create
- create new file ./ssh/templates/default/ssh_config.erb
- update content in file
./ssh/templates/default/ssh_config.erb from none to 86eb9b
(diff output suppressed by config)
$ chef generate template ssh ssh_config.erb -s /etc/ssh/ssh_config
GL: Create an SSH Config Template
©2016 Chef Software Inc. 3-57
# Cookbook Name:: ssh
# Recipe:: client
# Copyright (c) 2035 The Authors, All Rights Reserved.
template '/etc/ssh/ssh_config' do
source 'ssh_config.erb'
owner 'root'
group 'root'
mode '0644'
end
$ $EDITOR ~/cookbooks/ssh/recipes/client.rb
GL: Write the Client Recipe
©2016 Chef Software Inc. 3-58
Objective:
GL: Testing the Recipe
ü Write a remediation recipe on that node.
q Test the recipe with Test Kitchen.
q Test for compliance with InSpec from the command line interface (CLI)
q Converge the recipe.
q Rescan the node and ensure compliance.
©2016 Chef Software Inc. 3-59
$ cd ~/cookbooks/ssh/
GL: Navigate to your SSH Cookbook
©2016 Chef Software Inc. 3-60
GL: Edit your .kitchen.yml -- Part 1
---
driver:
name: docker
provisioner:
name: chef_zero
~/cookbooks/ssh/.kitchen.yml
©2016 Chef Software Inc. 3-61
GL: Edit your .kitchen.yml -- Part 2
platforms:
# - name: ubuntu-14.04
- name: centos-6.8
suites:
- name: default
run_list:
- recipe[ssh::default]
attributes:
~/cookbooks/ssh/.kitchen.yml
©2016 Chef Software Inc. 3-62
GL: Edit your .kitchen.yml -- Part 3
platforms:
# - name: ubuntu-14.04
- name: centos-6.7
suites:
- name: client
run_list:
- recipe[ssh::client]
attributes:
~/cookbooks/ssh/.kitchen.yml
+
©2016 Chef Software Inc. 3-63
Instance Driver Provisioner Verifier Transport Last Action
client-centos-67 Docker ChefZero Busser Ssh <Not Created> :
$ kitchen list
GL: Run `kitchen list` from ~/cookbooks/ssh/
©2016 Chef Software Inc. 3-64
-----> Starting Kitchen (v3.4.2)
-----> Creating <client-centos-67>...
Sending build context to Docker daemon 32.26 kB
Sending build context to Docker daemon
Step 0 : FROM centos:centos6
---> 3bbbf0aca359
...
Chef Client finished, 0/3 resources updated in 03 seconds
Finished converging <client-centos-67> (0m28.27s).
-----> Kitchen is finished. (0m30.32s)
zlib(finalizer): the stream was freed prematurely.
$ kitchen converge
GL: Run `kitchen converge`
©2016 Chef Software Inc. 3-65
What We've Done So Far
In the preceding exercises, we began writing a remediation recipe on our
target node.
We also tested the recipe with Test Kitchen.
But have we even addressed the "Set the SSH protocol version to 2" issue?
©2016 Chef Software Inc. 3-66
Objective:
GL: Using InSpec for Verification
ü Write a remediation recipe on that node.
ü Test the recipe with Test Kitchen.
q Test for compliance with InSpec from the command line interface (CLI)
q Converge the recipe .
q Rescan the node and ensure compliance.
©2016 Chef Software Inc. 3-67
$ mkdir -p ~/cookbooks/ssh/test/integration/client/inspec
GL: Create the `inspec` Directory
©2016 Chef Software Inc. 3-68
GL: Create the `client_spec.rb' file
control 'ssh-4' do
impact 1.0
title 'Client: Set SSH protocol version to 2'
desc "
Set the SSH protocol version to 2. Don't use legacy
insecure SSHv3 connections anymore.
"
describe ssh_config do
its('Protocol') { should eq('2') }
end
end
~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb
©2016 Chef Software Inc. 3-69
Example of Creating the `client_spec.rb' file
One handy way to populate the preceding `client_spec.rb' is to use the Compliance
Web UI and copy the InSpec code found in the relevant Compliance profile:
Compliance > Base SSH > Set the SSH protocol version to 2
©2016 Chef Software Inc. 3-70
Running InSpec from the
Command Line Interface (CLI)
InSpec is an executable application.
InSpec can execute on remote hosts, including docker
containers.
You can use 'inspec exec' to run tests at a specified path.
©2016 Chef Software Inc. 3-71
$ sudo chown root:dockerroot /var/run/docker.sock
GL: Change Owner of `/var/run/docker.sock`
©2016 Chef Software Inc. 3-72
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5b51a4237437 d5b8fd3299b4 "/usr/sbin/sshd -D - 41 minutes ago Up 41 minutes 0.0.0.0:32768->22/tcp grave_davinci
$ sudo docker ps
GL: What is your Docker ID?
©2016 Chef Software Inc. 3-73
Failures:
1) SSH Configuration Protocol should eq "2"
Failure/Error: its('Protocol') { should eq('2') }
expected: "2"
got: nil
(compared using ==)
# ./test/integration/client/inspec/client_spec.rb:9:in `block (3 levels) in load'
Finished in 0.79369 seconds (files took 0.7207 seconds to load)
1 example, 1 failure
Failed examples:
rspec # SSH Configuration Protocol should eq "2"
$ inspec exec
~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb -t
docker://CONTAINER_ID
GL: Running InSpec from the CLI
©2016 Chef Software Inc. 3-74
GL: Update the Template
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
~/cookbooks/ssh/templates/default/ssh_config.erb
©2016 Chef Software Inc. 3-75
GL: Update the Template
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
Protocol 2
~/cookbooks/ssh/templates/default/ssh_config.erb
©2016 Chef Software Inc. 3-76
$ cd ~/cookbooks/ssh
GL: Ensure you are in ~/cookbooks/ssh
©2016 Chef Software Inc. 3-77
...
+++ /etc/ssh/.ssh_config20151209-412-cf7gd7 2015-12-09
20:35:29.734689138 +0000
@@ -37,7 +37,7 @@
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
-# Protocol 2,1
+Protocol 2
# Cipher 3des
$ kitchen converge
GL: Run `kitchen converge`
©2016 Chef Software Inc. 3-78
.
Finished in 0.21546 seconds (files took 0.3575
seconds to load)
1 example, 0 failures
$ inspec exec
~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb -t
docker://CONTAINER_ID
GL: Running InSpec from the CLI
©2016 Chef Software Inc. 3-79
...
+++ /etc/ssh/.ssh_config20151209-10413-hlk9ow 2015-12-09
20:37:07.621689137 +0000
@@ -37,7 +37,7 @@
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
-# Protocol 2,1
+Protocol 2
# Cipher 3desesources updated in 3.29477735 seconds
$ sudo chef-client --local-mode -r 'recipe[ssh::client]'
GL: Apply the New SSH Recipe
©2016 Chef Software Inc. 3-80
GL: Re-run the Compliance Scan
Return to the Compliance
Web UI and re-run the scan
on your target node.
Be sure to run only the
base/ssh scan as shown on
the next slide.
©2016 Chef Software Inc. 3-81
GL: Re-run the Compliance Scan
Run only the base/ssh scan.
©2016 Chef Software Inc. 3-82
GL: Results of this Exercise
Your scan should show that the ssh protocol issue is now complaint.
©2016 Chef Software Inc. 3-83
Conclusion
ü Log in to your target node.
ü Write a remediation recipe on that node.
ü Test the recipe with Test Kitchen.
ü Test for compliance with InSpec from the CLI
ü Converge the recipe.
ü Rescan the node and ensure compliance.
©2016 Chef Software Inc. 3-84
Review Questions
1. When adding a node to the Compliance server's dashboard, should you use the
node's FQDN or just its IP address?
2. What can `inspec exec` be used for?
3. How are compliance severities defined?
4. Using the image on the right, what section
is the actual test?
©2016 Chef Software Inc. 3-85
Review Questions
5. If a compliance scan tells you that a node is unreachable, what might you use to
troubleshoot the connection?
6. What language is used to define controls?
©2016 Chef Software Inc. 5-86
Creating Custom Profiles
Defining and Uploading Compliance Profiles to the Compliance Server
©2016 Chef Software Inc. 5-87
Objectives
After completing this module, you should be able to:
Ø Write a custom compliance profile.
Ø Use InSpec to test your code and your custom profile.
Ø Upload a custom compliance profile to your Chef Compliance server.
Ø Test your custom profile.
©2016 Chef Software Inc. 5-88
Creating a Custom Profile
In this section we will create a custom compliance profile.
Custom profiles are created using InSpec, just like the existing profiles were
created.
After you have created a custom profile, you'll learn how to upload it to a
Compliance Server and then use it to check for compliance issues.
©2016 Chef Software Inc. 5-89
InSpec Command Line Interface
In this section we will use the InSpec command line interface (CLI) to help us
create Compliance profiles and run audit tests against targets.
The InSpec CLI commands can run audit tests against targets using SSH,
WinRM, locally, or on Docker containers.
We'll be using `inspec init, `inspec check` and `inspec exec`.
Ø 'inspec init' streamlines the creation of new Compliance profiles.
©2016 Chef Software Inc. 5-90
InSpec Command Line Interface
We'll be using `inspec init, `inspec check` and `inspec exec`.
Ø `inspec check` just verifies the compliance profile code that you write --it
doesn't actually test a system.
Ø `inspec exec' will run the tests against a system.
©2016 Chef Software Inc. 5-91
Objective:
Group Lab: Creating a Custom
Profile
Creating custom profiles to fit your business needs.
q Create a custom profile.
q Test your profile with InSpec
©2016 Chef Software Inc. 5-92
[chef@ip-172-31-0-65 ~]$ inspec help
Commands:
inspec archive PATH # archive a profile to tar.gz (defau...
inspec check PATH # verify all tests at the specified ...
inspec compliance SUBCOMMAND ... # Chef Compliance commands
inspec detect # detect the target OS
inspec exec PATHS # run all test files at the specifie...
inspec help [COMMAND] # Describe available commands or one...
inspec init TEMPLATE ... # Scaffolds a new project
inspec json PATH # read all tests in PATH and generat...
inspec shell # open an interactive debugging shell
inspec version # prints the version of this tool
$ inspec help
GL: Using `inspec help`
©2016 Chef Software Inc. 5-93
[chef@ip-172-31-0-65 ~]$ inspec init help
Commands:
inspec init help [COMMAND] # Describe subcommands or one specific subcommand
inspec init profile NAME # Create a new profile
# prints the version of this tool
$ inspec init help
GL: Using `inspec init` help`
©2016 Chef Software Inc. 5-94
/home/chef
$ cd
$ pwd
GL: Ensure You Are in Your home Directory
©2016 Chef Software Inc. 5-95
Create new profile at /home/chef/secureprofile_01
* Create file README.md
* Create directory libraries
* Create directory controls
* Create file controls/example.rb
* Create file inspec.yml
$ inspec init profile secureprofile_01
GL: Create the Compliance Profile Directories and Files
©2016 Chef Software Inc. 5-96
secureprofile_01
├── controls
│ └── example.rb
├── inspec.yml
├── libraries
└── README.md
$ tree secureprofile_01
GL: View the Compliance Profile Directories and Files
©2016 Chef Software Inc. 5-97
name: secureprofile_01
title: InSpec Profile
maintainer: The Authors
copyright: The Authors
copyright_email: you@example.com
license: All Rights Reserved
summary: An InSpec Compliance Profile
version: 0.1.0
$ cat ~/secureprofile_01/inspec.yml
GL: View the inspec.yml File
©2016 Chef Software Inc. 5-98
GL: Writing a Compliance Profile Control
Compliance profiles must be written within the
`controls` directory.
secureprofile_01
├── controls
│ └── example.rb
├── inspec.yml
├── libraries
└── README.md
©2016 Chef Software Inc. 5-99
$ cp ~/secureprofile_01/controls/example.rb
~/secureprofile_01/controls/tmp.rb
GL: Create the `tmp.rb` Control using the `cp` Command
©2016 Chef Software Inc. 5-100
├── controls
│ ├── example.rb
│ └── tmp.rb
├── inspec.yml
├── libraries
└── README.md
$ tree secureprofile_01
GL: Confirm Creation of tmp.rb using `tree`
©2016 Chef Software Inc. 5-101
GL: Edit the tmp.rb File - 1 of 3
# encoding: utf-8
# copyright: 2015, The Authors
# license: All rights reserved
title 'sample section'
# you can also use plain tests
describe file('/tmp') do
it { should be_directory }
end
# you add controls here
control 'tmp-1.0' do # A unique ID for this control
impact 0.7 # The criticality, if this control fails.
title 'Create /tmp directory' # A human-readable title
desc 'An optional description...'
describe file('/tmp') do # The actual test
it { should be_directory }
end
end
~/secureprofile_01/controls/tmp.rb
©2016 Chef Software Inc. 5-102
GL: Edit the tmp.rb File - 2 of 3
# encoding: utf-8
# copyright: 2015, The Authors
# license: All rights reserved
title '/tmp profile'
control "tmp-1.0" do
impact 0.3
title "Create /tmp directory"
desc "A /tmp directory must exist"
describe file('/tmp') do
it { should be_directory }
end
end
~/secureprofile_01/controls/tmp.rb
©2016 Chef Software Inc. 5-103
GL: Edit the tmp.rb File - 3 of 3
...
control "tmp-1.1" do
impact 0.3
title "/tmp directory is owned by the root user"
desc "The /tmp directory must be owned by the root user"
describe file('/tmp') do
it { should be_owned_by 'root' }
end
end
~/compliance_profiles/profile_01/test/tmp.rb
©2016 Chef Software Inc. 5-104
Summary
-------
Location: secureprofile_01/
Profile: secureprofile_01
Controls: 3
Timestamp: 2016-02-26T21:24:52+00:00
Valid: true
Errors
------
Warnings
--------
$ inspec check secureprofile_01/
GL: Use `inspec check` to Verify Your Profile
©2016 Chef Software Inc. 5-105
....
Finished in 0.0467 seconds (files took 1.47 seconds to load)
4 examples, 0 failures
$ inspec exec secureprofile_01/
GL: Use `inspec exec` to Verify Your Profile
©2016 Chef Software Inc. 5-106
Creating a Custom Profile
In the preceding group lab you created a custom Compliance
profile and tested your profile with InSpec.
Your code passed the `inspec check` test and your system passed
the `inspec exec` test.
But what would an `inspec exec` failure look like?
©2016 Chef Software Inc. 5-107
Example of an `inspec exec` Failure
Let's say you modified your
~ secureprofile_01/controls/tmp.rb
and changed `should be_owned_by
root` to `should be_owned_by other`
and then ran `inspec exec` against that
file...
...
control "tmp-1.1" do
impact 0.3
title "/tmp directory is owned by the root user"
desc "The /tmp directory must be owned by the root user"
describe file('/tmp') do
it { should be_owned_by 'other' }
end
end
©2016 Chef Software Inc. 5-108
...
Failures:
1) File /tmp should be owned by "other"
Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
expected `File /tmp.owned_by?("other")` to return true, got false
# secureprofile_01/controls/tmp.rb:20:in `block (3 levels) in load'
Finished in 0.06284 seconds (files took 1.4 seconds to load)
4 examples, 1 failure
Failed examples:
rspec # File /tmp should be owned by "other"
$ inspec exec secureprofile_01/
Example: `inspec exec` Failure
©2016 Chef Software Inc. 5-109
Uploading Custom Profiles to
Compliance Server
inspec v0.22.1 and above uses the `inspec compliance upload
FILENAME` command to upload profiles from a workstation/node to the
Compliance Server.
That command should be preceded by `inspec compliance login
https://FQDN --user admin --insecure - refresh_token
'TOKEN'` in order to first log in to the Compliance Server.
©2016 Chef Software Inc. 5-110
Objective:
Group Lab: Uploading the Custom
Profile to the Compliance Server
Uploading it so it can be used in scans.
q Upload your custom profile to the Compliance server.
q Run a scan from your Compliance server using your custom profile.
©2016 Chef Software Inc. 5-111
secureprofile_01
$ cd ~
$ ls
GL: Ensure You Are in the Home Dir
©2016 Chef Software Inc. 5-112
Commands:
inspec compliance exec PROFILE # executes a Chef Compliance profile
inspec compliance help [COMMAND] # Describe subcommands or one specific subcommand
inspec compliance login SERVER # Log in to a Chef Compliance SERVER
inspec compliance logout # user logout from Chef Compliance
inspec compliance profiles # list all available profiles in Chef Compliance
inspec compliance upload PATH # uploads a local profile to Chef Compliance
inspec compliance version # displays the version of the Chef Compliance server
$ inspec compliance help
GL: Using 'inspec compliance` Commands
©2016 Chef Software Inc. 5-113
GL: Logging in to Your Compliance Server
1. Open your Compliance
Server dashboard and click
the menu icon.
2. From the resulting drop down
menu, click About.
©2016 Chef Software Inc. 5-114
GL: Logging in to Your Compliance Server
From the resulting window,
highlight and copy the Refresh
Token value.
You may want to paste the token
into a text document for now.
©2016 Chef Software Inc. 5-115
Your server supports --user and --password only
Successfully authenticated
[chef@ip-172-31-9-142 ~]$
$ inspec compliance login https://FQDN --user admin --insecure --
refresh_token 'TOKEN'
GL: Logging in to Your Compliance Server
©2016 Chef Software Inc. 5-116
secureprofile_01
├── controls
│ ├── example.rb
│ └── tmp.rb
├── inspec.yml
├── libraries
└── README.md
$ tree secureprofile_01
GL: Viewing Your Custom Profile Tree
©2016 Chef Software Inc. 5-117
Available profiles:
-------------------
* base/apache
* base/linux
* base/mysql
* base/postgres
* base/ssh
* base/windows
* cis/cis-aix-5.3-6.1-level1
* cis/cis-aix-5.3-6.1-level2
* cis/cis-amazonlinux-2014.09-2015.03-level1
* cis/cis-amazonlinux-2014.09-2015.03-level2
...
$ inspec compliance profiles
GL: Viewing Compliance Profiles on Your Compliance Server
©2016 Chef Software Inc. 5-118
I, [2016-06-07T19:18:53.543295 #12681] INFO -- : Checking profile in secureprofile_01
I, [2016-06-07T19:18:53.543448 #12681] INFO -- : Metadata OK.
I, [2016-06-07T19:18:53.666594 #12681] INFO -- : Found 3 controls.
I, [2016-06-07T19:18:53.666721 #12681] INFO -- : Control definitions OK.
Profile is valid
Generate temporary profile archive at /tmp/secureprofile_0120160607-12681-1jpozwr.tar.gz
I, [2016-06-07T19:18:53.761495 #12681] INFO -- : Generate archive
/tmp/secureprofile_0120160607-12681-1jpozwr.tar.gz.
I, [2016-06-07T19:18:53.775046 #12681] INFO -- : Finished archive generation.
Start upload to admin/secureprofile_01
Uploading to Chef Compliance
Successfully uploaded profile
$ inspec compliance upload secureprofile_01
GL: Uploading Your Custom Profile
©2016 Chef Software Inc. 5-119
Available profiles:
-------------------
...
* admin/secureprofile_01
* base/apache
* base/linux
* base/mysql
* base/postgres
* base/ssh
* base/windows
* cis/cis-aix-5.3-6.1-level1
* cis/cis-aix-5.3-6.1-level2
* cis/cis-amazonlinux-2014.09-2015.03-level1
...
$ inspec compliance profiles
GL: Viewing Compliance Profiles on Your Compliance Server
©2016 Chef Software Inc. 5-120
Successfully logged out
$ inspec compliance logout
GL: Logging out of Your Compliance server
©2016 Chef Software Inc. 5-121
GL: Viewing Your Uploaded Custom Profile
Use a web browser to
navigate the
Compliance tab of your
Compliance server.
Notice that your
custom profile is
present.
©2016 Chef Software Inc. 5-122
GL: Testing Your Uploaded Custom Profile
Navigate to the
Compliance
dashboard, click
your Linux target,
and then click Scan.
©2016 Chef Software Inc. 5-123
GL: Testing Your Uploaded Custom Profile
Select only your
custom profile and
then click Scan
now.
©2016 Chef Software Inc. 5-124
GL: Testing Your Uploaded Custom Profile
You should now see
that your custom profile
works properly and
your Linux target is in
compliance.
©2016 Chef Software Inc. 5-125
Objective:
Group Lab: Uploading the Custom
Profile to the Compliance Server
Uploading it so it can be used in scans.
ü Upload your custom profile to the Compliance server.
ü Run a scan from your Compliance server using your custom profile.
©2016 Chef Software Inc. 5-126
Review Questions
1. What is the difference between `inspec check` and `inspec exec'?
2. What does `inspec init profile` do?
3. Where can you get the refresh token that replaces TOKEN in this command?
inspec compliance login https://FQDN --user admin --
insecure --refresh_token 'TOKEN'
©2016 Chef Software Inc.
©2016 Chef Software Inc. 5-128
Further Resources
Other Places to Talk About, Practice, and Learn Chef
Compliance
©2016 Chef Software Inc. 5-129
Going Forward
There are many Chef resources available to you outside this
class. During this module we will talk about just a few of those
resources.
But…remember what we said at the beginning of this class:
The best way to learn Chef is to use Chef
©2016 Chef Software Inc. 5-130
docs.chef.io
Docs are available to you, 24 hours a day, 7 days a
week.
Any question you have, you probably will find the
answer for on our Docs site.
©2016 Chef Software Inc. 5-131
docs.chef.io
Main Chef Compliance doc link:
https://docs.chef.io/compliance.html
Install Chef Compliance Server:
https://docs.chef.io/install_compliance.html
©2016 Chef Software Inc. 5-132
docs.chef.io
Upgrade Compliance Server doc link:
https://docs.chef.io/upgrade_compliance.html
©2016 Chef Software Inc. 5-133
docs.chef.io
Compliance DSL (domain-specific language):
https://docs.chef.io/dsl_compliance.html
That link contains descriptions and examples of the
InSpec syntax used to define controls.
©2016 Chef Software Inc. 5-134
docs.chef.io
Compliance API:
https://docs.chef.io/release/compliance_1-
0/api_compliance.html
The Compliance API is a REST-based API that is
designed to be easy and predictable.
1500 Attendees! 55+ Speakers! Registration Open! Community Celebration!CHEFCONF 2016 AT A GLANCE
Workshops & Chef Training
Community Summit
Partner Summit
Welcome Reception
Keynotes
Technical Sessions
Happy Hour
Keynotes
Technical Sessions
Awesome Chef Awards
Community Celebration
DAY 1 // JULY 11 DAY 2 // JULY 12 DAY 3 // JULY 13
THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM
chefconf.chef.io
DAY 1 // JULY 11
« Workshops & ChefTraining
« Community Summit
« Partner Summit
« Welcome Reception
DAY 2 // JULY 12
« Keynotes
« Technical Sessions
« Happy Hour
DAY 3 // JULY 13
« Keynotes
« Technical Sessions
« Awesome ChefAwards
« Community Celebration
THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM
©2016 Chef Software Inc.
Thank You!

Contenu connexe

Tendances

Chef Workflow Demo
Chef Workflow DemoChef Workflow Demo
Chef Workflow DemoChef
 
Infrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef AutomateInfrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef AutomateMatt Ray
 
Intermediate/Compliance training Guide
Intermediate/Compliance training GuideIntermediate/Compliance training Guide
Intermediate/Compliance training GuideChef
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as CodeMatt Ray
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeDevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeMatt Ray
 
Compliance Automation with InSpec
Compliance Automation with InSpecCompliance Automation with InSpec
Compliance Automation with InSpec Nathen Harvey
 
Bay Area Chef Meetup February
Bay Area Chef Meetup FebruaryBay Area Chef Meetup February
Bay Area Chef Meetup FebruaryJessica DeVita
 
Effective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpecEffective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpecNathen Harvey
 
Compliance Automation with Inspec Part 1
Compliance Automation with Inspec Part 1Compliance Automation with Inspec Part 1
Compliance Automation with Inspec Part 1Chef
 
Cooking Up Windows with Chef Automate
Cooking Up Windows with Chef AutomateCooking Up Windows with Chef Automate
Cooking Up Windows with Chef AutomateMatt Ray
 
Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Chef
 
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 Gent
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 GentUsing Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 Gent
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 GentSalim Afiune Maya
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlabChef
 
Chef Compliance & Workflow w/Delivery
Chef Compliance & Workflow w/Delivery Chef Compliance & Workflow w/Delivery
Chef Compliance & Workflow w/Delivery Chef
 
Chef compliance - Intermediate Training
Chef compliance - Intermediate TrainingChef compliance - Intermediate Training
Chef compliance - Intermediate TrainingSarah Hynes Cheney
 
DevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat IgniteDevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat IgniteMatt Ray
 
Chef Hack Day Denver
Chef Hack Day Denver Chef Hack Day Denver
Chef Hack Day Denver Chef
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation WorkshopChef
 

Tendances (20)

Chef Workflow Demo
Chef Workflow DemoChef Workflow Demo
Chef Workflow Demo
 
Infrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef AutomateInfrastructure and Compliance Delight with Chef Automate
Infrastructure and Compliance Delight with Chef Automate
 
Intermediate/Compliance training Guide
Intermediate/Compliance training GuideIntermediate/Compliance training Guide
Intermediate/Compliance training Guide
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as Code
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeDevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
 
Compliance Automation with InSpec
Compliance Automation with InSpecCompliance Automation with InSpec
Compliance Automation with InSpec
 
Bay Area Chef Meetup February
Bay Area Chef Meetup FebruaryBay Area Chef Meetup February
Bay Area Chef Meetup February
 
Effective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpecEffective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpec
 
Compliance Automation with Inspec Part 1
Compliance Automation with Inspec Part 1Compliance Automation with Inspec Part 1
Compliance Automation with Inspec Part 1
 
Cooking Up Windows with Chef Automate
Cooking Up Windows with Chef AutomateCooking Up Windows with Chef Automate
Cooking Up Windows with Chef Automate
 
Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2Devops journey chefpopup-2016.04.26-v2
Devops journey chefpopup-2016.04.26-v2
 
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 Gent
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 GentUsing Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 Gent
Using Habitat to Unify Dev to CI to Production - Configmgmt Camp Feb/2018 Gent
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
Chef Compliance & Workflow w/Delivery
Chef Compliance & Workflow w/Delivery Chef Compliance & Workflow w/Delivery
Chef Compliance & Workflow w/Delivery
 
Chef compliance - Intermediate Training
Chef compliance - Intermediate TrainingChef compliance - Intermediate Training
Chef compliance - Intermediate Training
 
DevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat IgniteDevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat Ignite
 
Chef Hack Day Denver
Chef Hack Day Denver Chef Hack Day Denver
Chef Hack Day Denver
 
Understand Chef
Understand ChefUnderstand Chef
Understand Chef
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 

Similaire à Nike popup compliance workshop

Compliance Automation with Inspec Part 3
Compliance Automation with Inspec Part 3Compliance Automation with Inspec Part 3
Compliance Automation with Inspec Part 3Chef
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administratorsSharon James
 
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017AgileNZ Conference
 
Chef onlinuxonpower
Chef onlinuxonpowerChef onlinuxonpower
Chef onlinuxonpowerMoya Brannan
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsBenjamin Cane
 
Prescriptive System Security with InSpec
Prescriptive System Security with InSpecPrescriptive System Security with InSpec
Prescriptive System Security with InSpecAll Things Open
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Mandi Walls
 
Introduction to the .NET Access Control Service
Introduction to the .NET Access Control ServiceIntroduction to the .NET Access Control Service
Introduction to the .NET Access Control Servicebutest
 
Introduction to the .NET Access Control Service
Introduction to the .NET Access Control ServiceIntroduction to the .NET Access Control Service
Introduction to the .NET Access Control Servicebutest
 
Automating Infrastructure with Chef
Automating Infrastructure with ChefAutomating Infrastructure with Chef
Automating Infrastructure with ChefJennifer Davis
 
Automating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North SydneyAutomating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North SydneyMatt Ray
 
Sa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administratorsSa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administratorsSharon James
 
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...Amazon Web Services
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonInexture Solutions
 
OSDC 2017 - Mandi Walls - Building security into your workflow with inspec
OSDC 2017 - Mandi Walls - Building security into your workflow with inspecOSDC 2017 - Mandi Walls - Building security into your workflow with inspec
OSDC 2017 - Mandi Walls - Building security into your workflow with inspecNETWAYS
 
Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)Mandi Walls
 
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi WallsOSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi WallsNETWAYS
 
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyMaki Toshio
 
Continuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook QualityContinuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook QualityJosiah Renaudin
 

Similaire à Nike popup compliance workshop (20)

Compliance Automation with Inspec Part 3
Compliance Automation with Inspec Part 3Compliance Automation with Inspec Part 3
Compliance Automation with Inspec Part 3
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administrators
 
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
 
Chef onlinuxonpower
Chef onlinuxonpowerChef onlinuxonpower
Chef onlinuxonpower
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
Prescriptive System Security with InSpec
Prescriptive System Security with InSpecPrescriptive System Security with InSpec
Prescriptive System Security with InSpec
 
Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019Prescriptive Security with InSpec - All Things Open 2019
Prescriptive Security with InSpec - All Things Open 2019
 
Introduction to the .NET Access Control Service
Introduction to the .NET Access Control ServiceIntroduction to the .NET Access Control Service
Introduction to the .NET Access Control Service
 
Introduction to the .NET Access Control Service
Introduction to the .NET Access Control ServiceIntroduction to the .NET Access Control Service
Introduction to the .NET Access Control Service
 
Automating Infrastructure with Chef
Automating Infrastructure with ChefAutomating Infrastructure with Chef
Automating Infrastructure with Chef
 
Automating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North SydneyAutomating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North Sydney
 
Sa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administratorsSa106 – practical solutions for connections administrators
Sa106 – practical solutions for connections administrators
 
CodeShip
CodeShipCodeShip
CodeShip
 
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...
DevOps on Windows: How to Deploy Complex Windows Workloads | AWS Public Secto...
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with Python
 
OSDC 2017 - Mandi Walls - Building security into your workflow with inspec
OSDC 2017 - Mandi Walls - Building security into your workflow with inspecOSDC 2017 - Mandi Walls - Building security into your workflow with inspec
OSDC 2017 - Mandi Walls - Building security into your workflow with inspec
 
Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)
 
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi WallsOSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
 
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
 
Continuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook QualityContinuous Integration Testing Techniques to Improve Chef Cookbook Quality
Continuous Integration Testing Techniques to Improve Chef Cookbook Quality
 

Plus de Chef

Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed ChefChef
 
Automation, Audits, and Apps Tour
Automation, Audits, and Apps TourAutomation, Audits, and Apps Tour
Automation, Audits, and Apps TourChef
 
Automation, Audits, and Apps Tour
Automation, Audits, and Apps TourAutomation, Audits, and Apps Tour
Automation, Audits, and Apps TourChef
 
London Community Summit 2016 - Adopting Chef Compliance
London Community Summit 2016 - Adopting Chef ComplianceLondon Community Summit 2016 - Adopting Chef Compliance
London Community Summit 2016 - Adopting Chef ComplianceChef
 
Learning from Configuration Management
Learning from Configuration Management Learning from Configuration Management
Learning from Configuration Management Chef
 
London Community Summit - From Contribution to Authorship
London Community Summit - From Contribution to AuthorshipLondon Community Summit - From Contribution to Authorship
London Community Summit - From Contribution to AuthorshipChef
 
London Community Summit 2016 - Chef Automate
London Community Summit 2016 - Chef AutomateLondon Community Summit 2016 - Chef Automate
London Community Summit 2016 - Chef AutomateChef
 
London Community Summit 2016 - Community Update
London Community Summit 2016 - Community UpdateLondon Community Summit 2016 - Community Update
London Community Summit 2016 - Community UpdateChef
 
London Community Summit 2016 - Habitat
London Community Summit 2016 -  HabitatLondon Community Summit 2016 -  Habitat
London Community Summit 2016 - HabitatChef
 
The caseforawesome
The caseforawesomeThe caseforawesome
The caseforawesomeChef
 
Netflix's Could Migration
Netflix's Could MigrationNetflix's Could Migration
Netflix's Could MigrationChef
 
Alaska Airlines DevOps Journey
Alaska Airlines DevOps JourneyAlaska Airlines DevOps Journey
Alaska Airlines DevOps JourneyChef
 
And The Slow Suffer What They Must
And The Slow Suffer What They MustAnd The Slow Suffer What They Must
And The Slow Suffer What They MustChef
 
Visualizing your journey with chef
Visualizing your journey with chefVisualizing your journey with chef
Visualizing your journey with chefChef
 
The New IT Game
The New IT GameThe New IT Game
The New IT GameChef
 
How to Accelerate Agile, Lean and DevOps Adoption Across Your Organization
How to Accelerate Agile, Lean and DevOps Adoption Across Your OrganizationHow to Accelerate Agile, Lean and DevOps Adoption Across Your Organization
How to Accelerate Agile, Lean and DevOps Adoption Across Your OrganizationChef
 
Our DevOps Journey - An Exercise in Cultural Change
Our DevOps Journey - An Exercise in Cultural ChangeOur DevOps Journey - An Exercise in Cultural Change
Our DevOps Journey - An Exercise in Cultural ChangeChef
 
Chef andwindows reactor
Chef andwindows reactorChef andwindows reactor
Chef andwindows reactorChef
 

Plus de Chef (18)

Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
 
Automation, Audits, and Apps Tour
Automation, Audits, and Apps TourAutomation, Audits, and Apps Tour
Automation, Audits, and Apps Tour
 
Automation, Audits, and Apps Tour
Automation, Audits, and Apps TourAutomation, Audits, and Apps Tour
Automation, Audits, and Apps Tour
 
London Community Summit 2016 - Adopting Chef Compliance
London Community Summit 2016 - Adopting Chef ComplianceLondon Community Summit 2016 - Adopting Chef Compliance
London Community Summit 2016 - Adopting Chef Compliance
 
Learning from Configuration Management
Learning from Configuration Management Learning from Configuration Management
Learning from Configuration Management
 
London Community Summit - From Contribution to Authorship
London Community Summit - From Contribution to AuthorshipLondon Community Summit - From Contribution to Authorship
London Community Summit - From Contribution to Authorship
 
London Community Summit 2016 - Chef Automate
London Community Summit 2016 - Chef AutomateLondon Community Summit 2016 - Chef Automate
London Community Summit 2016 - Chef Automate
 
London Community Summit 2016 - Community Update
London Community Summit 2016 - Community UpdateLondon Community Summit 2016 - Community Update
London Community Summit 2016 - Community Update
 
London Community Summit 2016 - Habitat
London Community Summit 2016 -  HabitatLondon Community Summit 2016 -  Habitat
London Community Summit 2016 - Habitat
 
The caseforawesome
The caseforawesomeThe caseforawesome
The caseforawesome
 
Netflix's Could Migration
Netflix's Could MigrationNetflix's Could Migration
Netflix's Could Migration
 
Alaska Airlines DevOps Journey
Alaska Airlines DevOps JourneyAlaska Airlines DevOps Journey
Alaska Airlines DevOps Journey
 
And The Slow Suffer What They Must
And The Slow Suffer What They MustAnd The Slow Suffer What They Must
And The Slow Suffer What They Must
 
Visualizing your journey with chef
Visualizing your journey with chefVisualizing your journey with chef
Visualizing your journey with chef
 
The New IT Game
The New IT GameThe New IT Game
The New IT Game
 
How to Accelerate Agile, Lean and DevOps Adoption Across Your Organization
How to Accelerate Agile, Lean and DevOps Adoption Across Your OrganizationHow to Accelerate Agile, Lean and DevOps Adoption Across Your Organization
How to Accelerate Agile, Lean and DevOps Adoption Across Your Organization
 
Our DevOps Journey - An Exercise in Cultural Change
Our DevOps Journey - An Exercise in Cultural ChangeOur DevOps Journey - An Exercise in Cultural Change
Our DevOps Journey - An Exercise in Cultural Change
 
Chef andwindows reactor
Chef andwindows reactorChef andwindows reactor
Chef andwindows reactor
 

Dernier

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Nike popup compliance workshop

  • 1. ©2016 Chef Software Inc. 1-1 Chef Compliance Installation, Configuration, and Operation Course v1.1.1
  • 2. ©2016 Chef Software Inc. 1-2 Introduce Yourselves Name Current job role Previous job roles/background Experience with Chef and/or config management
  • 3. ©2016 Chef Software Inc. 1-3 Objectives After completing this course, you should be able to: Ø Describe the capabilities of Chef Compliance. Ø Install and initially configure the Chef Compliance server. Ø Perform scans with Chef Compliance. Ø Remediate compliance issues. Ø Use InSpec to create, modify, and test Chef Compliance profiles. Ø Schedule and run compliance reports. Ø Manage users, organizations, teams and permissions. Note: You should have attended at least Chef Essentials, Chef Fundamentals or have equivalent Chef experience prior to attending this course.
  • 4. ©2016 Chef Software Inc. 1-4 Chef Compliance Value Proposition You are probably aware of how Chef automates the configuration and management of your infrastructure. But what about risks and compliance? Regulatory compliance is a fact of life for every enterprise. With Chef Compliance you can scan for risks and compliance issues with easy-to-understand, customizable reports and visualization.
  • 5. ©2016 Chef Software Inc. 1-5 Chef Compliance Chef Compliance Server Your Infrastructure LAN/WAN
  • 6. ©2016 Chef Software Inc. 1-6 Chef Compliance Chef Compliance can run without any other Chef software installed. The nodes you scan don't even need Chef software on them if you are scanning them for compliance. However, you would need Chef software to create and implement remediation recipes.
  • 7. ©2016 Chef Software Inc. 1-7 Chef Compliance Reports: Chef Compliance can produce reports that indicate risks and issues classified by severity and impact levels. Compliance Profiles: You can get started quickly with pre-built Compliance profiles for scanning Linux and Windows nodes.
  • 8. ©2016 Chef Software Inc. 1-8 Chef Compliance leverages InSpec. InSpec is an open-source run-time framework and rule language used to specify compliance, security, and policy requirements for testing any node in your infrastructure. Chef Compliance and InSpec control 'cis-3.1' do impact 0.7 title 'Set Daemon umask' desc ' Set the default umask for all processes started at boot time. ' describe file('/etc/sysconfig/init') do its('content') {should match 'umask 027'} end end
  • 9. ©2016 Chef Software Inc. 1-9 InSpec includes a collection of resources to help you write auditing rules quickly and easily using the Compliance DSL Use InSpec to examine any node in your infrastructure; run the tests locally or remotely. Any detected security, compliance, or policy issues are flagged in a log and in Chef Compliance, displayed in a GUI. InSpec DSL describe port(80) do it { should_not be_listening } end describe port(443) do it { should be_listening } its('protocols') {should include 'tcp'} end
  • 10. ©2016 Chef Software Inc. 1-10 The InSpec audit resource framework is fully compatible with Chef Compliance. The Compliance DSL is a Ruby DSL for writing audit rules, which includes audit resources that you can invoke. InSpec DSL describe port(80) do it { should_not be_listening } end describe port(443) do it { should be_listening } its('protocols') {should include 'tcp'} end
  • 11. ©2016 Chef Software Inc. 1-11 Compliance profiles exist for many scenarios, such as those created by the Center for Internet Security (CIS) Chef Compliance maintains profiles as a collection of individual controls that comprise a complete audit. You can also create your own custom Compliance profiles. Compliance Profiles
  • 12. ©2016 Chef Software Inc. 1-12 Compliance Web UI The Chef Compliance web UI provides views into compliance scan results as well as views of Chef Compliance profiles. You execute scans via the Compliance web UI as well.
  • 13. ©2016 Chef Software Inc. 1-13 Your Lab Environment for Scanning Your Laptop Chef Compliance Node to run Compliance tests against We will provide one machine for you to use while performing lab exercises in this course: • One Linux node to perform Chef Compliance scans against. We are also providing • One shared Linux server running Chef Compliance.
  • 14. ©2016 Chef Software Inc. 1-14 Your Lab Environment for Remediation Your Laptop Compliance Server Nodes to run Compliance tests against AND use as workstations for writing remediation You will also log in to your Linux node in order to write remediation and run chef-client in local mode. This is so you can use this node as a virtual workstation while writing remediation. Linux
  • 15. ©2016 Chef Software Inc. 1-15 w o r k s t a t i o n Logging in to the Compliance Server and Linux Node $ ssh ADDRESS -l chef
  • 16. ©2016 Chef Software Inc. 1-16 Login to your node qhttp://bit.ly/2aek2zY qchef / chef
  • 17. ©2016 Chef Software Inc. 1-17 Hands-on Legend Ø GL or Group Lab: All participants and the instructor do this task together with the instructor often leading the way and explaining things as we proceed. Ø Lab: You perform this task on your own.
  • 18. ©2016 Chef Software Inc. 1-18 Configure Chef Compliance
  • 19. ©2016 Chef Software Inc. 1-19 Objectives After completing this module, you should be able to: Ø Login to the Compliance Web UI.
  • 20. ©2016 Chef Software Inc. 1-20 Compliance Installation Options You can install the Chef Compliance server as a an Amazon Machine Images (AMI) instance or as a Standalone installation. The standalone installation of Chef Compliance server creates a working installation on a single server. In this course we will use the most common method--the Standalone method.
  • 21. ©2016 Chef Software Inc. 1-21 GL: Configure the Compliance Server • From your laptop, open a web browser and point it to the FQDN for your Compliance Server node • https://52.87.172.92 • chef/ chef • Instance-id: i-19dad99f • Click Advanced from the warning page if present.
  • 22. ©2016 Chef Software Inc. 1-22 GL: Configure the Compliance Server • Click the Proceed to ... link if present. Note: We have not set up SSL so the https strikethrough and warning is fine for now.
  • 23. ©2016 Chef Software Inc. 1-23 GL: Configure the Compliance Server • User Name: chef • Password: chef
  • 24. ©2016 Chef Software Inc. 1-24 GL: Configure the Compliance Server You should now see an empty Compliance Dashboard.
  • 25. ©2016 Chef Software Inc. 3-25 Running Scans, Remediation, and Testing on Linux Nodes Configuring the Chef Compliance Server to Run Scans and Writing Remediation Recipes
  • 26. ©2016 Chef Software Inc. 3-26 Objectives After completing this module, you should be able to: Ø Add a node to test for compliance. Ø Run a Compliance scan. Ø Test for compliance with InSpec from the command line interface. Ø Remediate a compliance issue. Ø Use Test Kitchen to test your remediation. Ø Test for compliance with InSpec from the CLI Ø Rescan the node and ensure compliance.
  • 27. ©2016 Chef Software Inc. 3-27 Adding a Node to Scan To add a node you'll need: • The IP address or FQDN of the nodes to be tested. • Access configuration (ssh or WinRM). • The node's username and password OR • The node's username plus security key pair.
  • 28. ©2016 Chef Software Inc. 3-28 Objective: Group Lab: Adding a Node to Scan q Add a Linux Node to Scan q Test connectivity Note: In the next module you will perform the same exercises as in this module but using a Windows node as your target node.
  • 29. ©2016 Chef Software Inc. 3-29 GL: Adding a Node to Scan 1. From your Chef Compliance Dashboard, click Add Node.
  • 30. ©2016 Chef Software Inc. 3-30 GL: Adding a Node 2. From the resulting page, enter the node's FQDN or IP address. 3. Leave environment blank. A ‘default’ environment will be used 4. Accept the default SSH Access configuration 5. Type chef in the username field. 6. Click the password link as shown in this illustration.
  • 31. ©2016 Chef Software Inc. 3-31 GL: Adding a Node to Scan 7. Type the password (chef) in the password field. 8. Click the Add 1 node button as shown in this illustration.
  • 32. ©2016 Chef Software Inc. 3-32 GL: Adding a Node to Scan At this point your Compliance Dashboard should list the node you just added.
  • 33. ©2016 Chef Software Inc. 3-33 GL: Testing Connectivity to Your Node 1. Click the check box next to your node and then click the Connectivity button.
  • 34. ©2016 Chef Software Inc. 3-34 GL: Testing Connectivity to Your Node The Status column of you node should now indicate Connection established.
  • 35. ©2016 Chef Software Inc. 3-35 Adding Nodes in Bulk You could add additional nodes by simply repeating the previous steps. You could also add a number of nodes at once by separating each hostname or IP address with a comma or a space, as shown in this illustration. Chef Compliance also supports bulk loading of nodes via API.
  • 36. ©2016 Chef Software Inc. 3-36 Adding Nodes in Bulk via API After class you can go to the following link. The resulting kitchen_sink.rb will step you through how to upload nodes in bulk. https://gist.github.com/alexpop/01b0bba8d259adeee320
  • 37. ©2016 Chef Software Inc. 3-37 Private Keys In the workplace, using a security key would be a more secure method for connecting to nodes than using the password method. By clicking Settings > Add Private Key you will see where to paste a private key.
  • 38. ©2016 Chef Software Inc. 3-38 Running Compliance Scans You can run Compliance scans on demand or schedule them to run at a later time. Chef Compliance maintains profiles as a collection of individual controls that comprise a complete audit. As mentioned previously, Chef Compliance comes with a few reference profiles of various compliance policies that you can leverage or use as examples to create your own.
  • 39. ©2016 Chef Software Inc. 3-39 Compliance Profiles Used in Scans This image shows the default Compliance Profiles as accessed from the Scan Nodes page. You should be thoughtful with which profiles choose. Notice how you can also choose to run a scan on demand or schedule a scan.
  • 40. ©2016 Chef Software Inc. 3-40 Objective: Group Lab: Running a Scan q Run a Compliance scan. q View the output of a scan.
  • 41. ©2016 Chef Software Inc. 3-41 GL: Running a Scan 1. Click the check box next to your node and then click the Scan button.
  • 42. ©2016 Chef Software Inc. 3-42 GL: Running a Scan 2. From the resulting page, check the base/ssh profile and uncheck any other check boxes. 3. Click the Scan now button.
  • 43. ©2016 Chef Software Inc. 3-43 Scan Results A Compliance Report should now display and your scan results should be similar to that shown here. Notice how in the upper Summary section in this example, 10 tests were compliant and 6 tests show critical issues with ssh.
  • 44. ©2016 Chef Software Inc. 3-44 Scan Results The bottom half of the Compliance Report shown here has a table of details of test results. These are sorted by severity. If you click an issue as shown here, a bit more information about the issue displays.
  • 45. ©2016 Chef Software Inc. 3-45 GL: Profile To view the InSpec code that comprises this profile, do the following: 1. Click the Compliance button. 2. Click the relevant profile (Basic SSH). 3. Scroll down and click the `Set SSH protocol version to 2` profile.
  • 46. ©2016 Chef Software Inc. 3-46 Discussion: InSpec Profile Code Let's discuss what this profile is doing. The `impact` of 1.0 indicates this is a Critical issue. The `title` is what populates the Compliance Report issue title.
  • 47. ©2016 Chef Software Inc. 3-47 Discussion: InSpec Profile Code The desc is typically human- readable description sourced from the CIS or source doc. The `describe` section is the actual test that is executed.
  • 48. ©2016 Chef Software Inc. 3-48 Compliance Profile Severity Mapping The table below shows the current mapping of Compliance Profile impact numbering to severity. Impact Numbering Severity Designation 0.7 - 1.0 Critical Issues 0.4 - <0.7 Major Issues 0 - <0.4 Minor Issues https://nvd.nist.gov/cvss.cfm
  • 49. ©2016 Chef Software Inc. 3-49 # IdentityFile ~/.ssh/identity # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 # Protocol 2,1 # Cipher 3des $ more /etc/ssh/ssh_config Example: Node's ssh config
  • 50. ©2016 Chef Software Inc. 3-50 Let's Remediate the Issue Now that we've identified the ssh version issue, let's write a recipe on the target node to remediate the issue. Then we'll run the compliance scan again to see if we successfully remediated the issue. Note: In this course we will write a recipe directly on the node that we're running scans on. Of course in a production environment you will likely write such recipes locally and upload them to Chef Server. Then the nodes would convergence the recipes on their next chef-client run.
  • 51. ©2016 Chef Software Inc. 3-51 Objective: GL: Remediating the Issue q Start writing a remediation recipe on that node. q Test the recipe with Test Kitchen. q Test for compliance with InSpec from the command line interface (CLI) q Converge the recipe. q Rescan the node and ensure compliance.
  • 52. ©2016 Chef Software Inc. 3-52 GL: Remediating the Issue Log in to your target node (not your compliance server node) using ssh and ensure you are in the home directory. Note: emacs, nano, and vim/vi are installed on your Linux nodes. Some tips for using them can be found below in your participant guide.
  • 53. ©2016 Chef Software Inc. 3-53 $ mkdir -p cookbooks $ cd cookbooks GL: Create and Change to a ‘cookbooks’ Directory From the home directory, create a `cookbooks` directory and navigate into it.
  • 54. ©2016 Chef Software Inc. 3-54 Compiling Cookbooks... Recipe: code_generator::cookbook * directory[/home/chef/cookbooks/ssh] action create - create new directory /home/chef/cookbooks/ssh ... - create new file /home/chef/cookbooks/ssh/recipes/default.rb - update content in file /home/chef/cookbooks/ssh/recipes/default.rb from none to b702c7 (diff output suppressed by config) $ chef generate cookbook ssh GL: Create an SSH Cookbook
  • 55. ©2016 Chef Software Inc. 3-55 Compiling Cookbooks... Recipe: code_generator::recipe * directory[./ssh/spec/unit/recipes] action create (up to date) * cookbook_file[./ssh/spec/spec_helper.rb] action create_if_missing (up to date) ... - create new file ./ssh/recipes/client.rb - update content in file ./ssh/recipes/client.rb from none to 9c833a (diff output suppressed by config) $ chef generate recipe ssh client GL: Create an SSH Client Recipe
  • 56. ©2016 Chef Software Inc. 3-56 Compiling Cookbooks... Recipe: code_generator::template * directory[./ssh/templates/default] action create - create new directory ./ssh/templates/default * file[./ssh/templates/default/ssh_config.erb] action create - create new file ./ssh/templates/default/ssh_config.erb - update content in file ./ssh/templates/default/ssh_config.erb from none to 86eb9b (diff output suppressed by config) $ chef generate template ssh ssh_config.erb -s /etc/ssh/ssh_config GL: Create an SSH Config Template
  • 57. ©2016 Chef Software Inc. 3-57 # Cookbook Name:: ssh # Recipe:: client # Copyright (c) 2035 The Authors, All Rights Reserved. template '/etc/ssh/ssh_config' do source 'ssh_config.erb' owner 'root' group 'root' mode '0644' end $ $EDITOR ~/cookbooks/ssh/recipes/client.rb GL: Write the Client Recipe
  • 58. ©2016 Chef Software Inc. 3-58 Objective: GL: Testing the Recipe ü Write a remediation recipe on that node. q Test the recipe with Test Kitchen. q Test for compliance with InSpec from the command line interface (CLI) q Converge the recipe. q Rescan the node and ensure compliance.
  • 59. ©2016 Chef Software Inc. 3-59 $ cd ~/cookbooks/ssh/ GL: Navigate to your SSH Cookbook
  • 60. ©2016 Chef Software Inc. 3-60 GL: Edit your .kitchen.yml -- Part 1 --- driver: name: docker provisioner: name: chef_zero ~/cookbooks/ssh/.kitchen.yml
  • 61. ©2016 Chef Software Inc. 3-61 GL: Edit your .kitchen.yml -- Part 2 platforms: # - name: ubuntu-14.04 - name: centos-6.8 suites: - name: default run_list: - recipe[ssh::default] attributes: ~/cookbooks/ssh/.kitchen.yml
  • 62. ©2016 Chef Software Inc. 3-62 GL: Edit your .kitchen.yml -- Part 3 platforms: # - name: ubuntu-14.04 - name: centos-6.7 suites: - name: client run_list: - recipe[ssh::client] attributes: ~/cookbooks/ssh/.kitchen.yml +
  • 63. ©2016 Chef Software Inc. 3-63 Instance Driver Provisioner Verifier Transport Last Action client-centos-67 Docker ChefZero Busser Ssh <Not Created> : $ kitchen list GL: Run `kitchen list` from ~/cookbooks/ssh/
  • 64. ©2016 Chef Software Inc. 3-64 -----> Starting Kitchen (v3.4.2) -----> Creating <client-centos-67>... Sending build context to Docker daemon 32.26 kB Sending build context to Docker daemon Step 0 : FROM centos:centos6 ---> 3bbbf0aca359 ... Chef Client finished, 0/3 resources updated in 03 seconds Finished converging <client-centos-67> (0m28.27s). -----> Kitchen is finished. (0m30.32s) zlib(finalizer): the stream was freed prematurely. $ kitchen converge GL: Run `kitchen converge`
  • 65. ©2016 Chef Software Inc. 3-65 What We've Done So Far In the preceding exercises, we began writing a remediation recipe on our target node. We also tested the recipe with Test Kitchen. But have we even addressed the "Set the SSH protocol version to 2" issue?
  • 66. ©2016 Chef Software Inc. 3-66 Objective: GL: Using InSpec for Verification ü Write a remediation recipe on that node. ü Test the recipe with Test Kitchen. q Test for compliance with InSpec from the command line interface (CLI) q Converge the recipe . q Rescan the node and ensure compliance.
  • 67. ©2016 Chef Software Inc. 3-67 $ mkdir -p ~/cookbooks/ssh/test/integration/client/inspec GL: Create the `inspec` Directory
  • 68. ©2016 Chef Software Inc. 3-68 GL: Create the `client_spec.rb' file control 'ssh-4' do impact 1.0 title 'Client: Set SSH protocol version to 2' desc " Set the SSH protocol version to 2. Don't use legacy insecure SSHv3 connections anymore. " describe ssh_config do its('Protocol') { should eq('2') } end end ~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb
  • 69. ©2016 Chef Software Inc. 3-69 Example of Creating the `client_spec.rb' file One handy way to populate the preceding `client_spec.rb' is to use the Compliance Web UI and copy the InSpec code found in the relevant Compliance profile: Compliance > Base SSH > Set the SSH protocol version to 2
  • 70. ©2016 Chef Software Inc. 3-70 Running InSpec from the Command Line Interface (CLI) InSpec is an executable application. InSpec can execute on remote hosts, including docker containers. You can use 'inspec exec' to run tests at a specified path.
  • 71. ©2016 Chef Software Inc. 3-71 $ sudo chown root:dockerroot /var/run/docker.sock GL: Change Owner of `/var/run/docker.sock`
  • 72. ©2016 Chef Software Inc. 3-72 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5b51a4237437 d5b8fd3299b4 "/usr/sbin/sshd -D - 41 minutes ago Up 41 minutes 0.0.0.0:32768->22/tcp grave_davinci $ sudo docker ps GL: What is your Docker ID?
  • 73. ©2016 Chef Software Inc. 3-73 Failures: 1) SSH Configuration Protocol should eq "2" Failure/Error: its('Protocol') { should eq('2') } expected: "2" got: nil (compared using ==) # ./test/integration/client/inspec/client_spec.rb:9:in `block (3 levels) in load' Finished in 0.79369 seconds (files took 0.7207 seconds to load) 1 example, 1 failure Failed examples: rspec # SSH Configuration Protocol should eq "2" $ inspec exec ~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb -t docker://CONTAINER_ID GL: Running InSpec from the CLI
  • 74. ©2016 Chef Software Inc. 3-74 GL: Update the Template # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 # Protocol 2,1 ~/cookbooks/ssh/templates/default/ssh_config.erb
  • 75. ©2016 Chef Software Inc. 3-75 GL: Update the Template # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 Protocol 2 ~/cookbooks/ssh/templates/default/ssh_config.erb
  • 76. ©2016 Chef Software Inc. 3-76 $ cd ~/cookbooks/ssh GL: Ensure you are in ~/cookbooks/ssh
  • 77. ©2016 Chef Software Inc. 3-77 ... +++ /etc/ssh/.ssh_config20151209-412-cf7gd7 2015-12-09 20:35:29.734689138 +0000 @@ -37,7 +37,7 @@ # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 -# Protocol 2,1 +Protocol 2 # Cipher 3des $ kitchen converge GL: Run `kitchen converge`
  • 78. ©2016 Chef Software Inc. 3-78 . Finished in 0.21546 seconds (files took 0.3575 seconds to load) 1 example, 0 failures $ inspec exec ~/cookbooks/ssh/test/integration/client/inspec/client_spec.rb -t docker://CONTAINER_ID GL: Running InSpec from the CLI
  • 79. ©2016 Chef Software Inc. 3-79 ... +++ /etc/ssh/.ssh_config20151209-10413-hlk9ow 2015-12-09 20:37:07.621689137 +0000 @@ -37,7 +37,7 @@ # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 -# Protocol 2,1 +Protocol 2 # Cipher 3desesources updated in 3.29477735 seconds $ sudo chef-client --local-mode -r 'recipe[ssh::client]' GL: Apply the New SSH Recipe
  • 80. ©2016 Chef Software Inc. 3-80 GL: Re-run the Compliance Scan Return to the Compliance Web UI and re-run the scan on your target node. Be sure to run only the base/ssh scan as shown on the next slide.
  • 81. ©2016 Chef Software Inc. 3-81 GL: Re-run the Compliance Scan Run only the base/ssh scan.
  • 82. ©2016 Chef Software Inc. 3-82 GL: Results of this Exercise Your scan should show that the ssh protocol issue is now complaint.
  • 83. ©2016 Chef Software Inc. 3-83 Conclusion ü Log in to your target node. ü Write a remediation recipe on that node. ü Test the recipe with Test Kitchen. ü Test for compliance with InSpec from the CLI ü Converge the recipe. ü Rescan the node and ensure compliance.
  • 84. ©2016 Chef Software Inc. 3-84 Review Questions 1. When adding a node to the Compliance server's dashboard, should you use the node's FQDN or just its IP address? 2. What can `inspec exec` be used for? 3. How are compliance severities defined? 4. Using the image on the right, what section is the actual test?
  • 85. ©2016 Chef Software Inc. 3-85 Review Questions 5. If a compliance scan tells you that a node is unreachable, what might you use to troubleshoot the connection? 6. What language is used to define controls?
  • 86. ©2016 Chef Software Inc. 5-86 Creating Custom Profiles Defining and Uploading Compliance Profiles to the Compliance Server
  • 87. ©2016 Chef Software Inc. 5-87 Objectives After completing this module, you should be able to: Ø Write a custom compliance profile. Ø Use InSpec to test your code and your custom profile. Ø Upload a custom compliance profile to your Chef Compliance server. Ø Test your custom profile.
  • 88. ©2016 Chef Software Inc. 5-88 Creating a Custom Profile In this section we will create a custom compliance profile. Custom profiles are created using InSpec, just like the existing profiles were created. After you have created a custom profile, you'll learn how to upload it to a Compliance Server and then use it to check for compliance issues.
  • 89. ©2016 Chef Software Inc. 5-89 InSpec Command Line Interface In this section we will use the InSpec command line interface (CLI) to help us create Compliance profiles and run audit tests against targets. The InSpec CLI commands can run audit tests against targets using SSH, WinRM, locally, or on Docker containers. We'll be using `inspec init, `inspec check` and `inspec exec`. Ø 'inspec init' streamlines the creation of new Compliance profiles.
  • 90. ©2016 Chef Software Inc. 5-90 InSpec Command Line Interface We'll be using `inspec init, `inspec check` and `inspec exec`. Ø `inspec check` just verifies the compliance profile code that you write --it doesn't actually test a system. Ø `inspec exec' will run the tests against a system.
  • 91. ©2016 Chef Software Inc. 5-91 Objective: Group Lab: Creating a Custom Profile Creating custom profiles to fit your business needs. q Create a custom profile. q Test your profile with InSpec
  • 92. ©2016 Chef Software Inc. 5-92 [chef@ip-172-31-0-65 ~]$ inspec help Commands: inspec archive PATH # archive a profile to tar.gz (defau... inspec check PATH # verify all tests at the specified ... inspec compliance SUBCOMMAND ... # Chef Compliance commands inspec detect # detect the target OS inspec exec PATHS # run all test files at the specifie... inspec help [COMMAND] # Describe available commands or one... inspec init TEMPLATE ... # Scaffolds a new project inspec json PATH # read all tests in PATH and generat... inspec shell # open an interactive debugging shell inspec version # prints the version of this tool $ inspec help GL: Using `inspec help`
  • 93. ©2016 Chef Software Inc. 5-93 [chef@ip-172-31-0-65 ~]$ inspec init help Commands: inspec init help [COMMAND] # Describe subcommands or one specific subcommand inspec init profile NAME # Create a new profile # prints the version of this tool $ inspec init help GL: Using `inspec init` help`
  • 94. ©2016 Chef Software Inc. 5-94 /home/chef $ cd $ pwd GL: Ensure You Are in Your home Directory
  • 95. ©2016 Chef Software Inc. 5-95 Create new profile at /home/chef/secureprofile_01 * Create file README.md * Create directory libraries * Create directory controls * Create file controls/example.rb * Create file inspec.yml $ inspec init profile secureprofile_01 GL: Create the Compliance Profile Directories and Files
  • 96. ©2016 Chef Software Inc. 5-96 secureprofile_01 ├── controls │ └── example.rb ├── inspec.yml ├── libraries └── README.md $ tree secureprofile_01 GL: View the Compliance Profile Directories and Files
  • 97. ©2016 Chef Software Inc. 5-97 name: secureprofile_01 title: InSpec Profile maintainer: The Authors copyright: The Authors copyright_email: you@example.com license: All Rights Reserved summary: An InSpec Compliance Profile version: 0.1.0 $ cat ~/secureprofile_01/inspec.yml GL: View the inspec.yml File
  • 98. ©2016 Chef Software Inc. 5-98 GL: Writing a Compliance Profile Control Compliance profiles must be written within the `controls` directory. secureprofile_01 ├── controls │ └── example.rb ├── inspec.yml ├── libraries └── README.md
  • 99. ©2016 Chef Software Inc. 5-99 $ cp ~/secureprofile_01/controls/example.rb ~/secureprofile_01/controls/tmp.rb GL: Create the `tmp.rb` Control using the `cp` Command
  • 100. ©2016 Chef Software Inc. 5-100 ├── controls │ ├── example.rb │ └── tmp.rb ├── inspec.yml ├── libraries └── README.md $ tree secureprofile_01 GL: Confirm Creation of tmp.rb using `tree`
  • 101. ©2016 Chef Software Inc. 5-101 GL: Edit the tmp.rb File - 1 of 3 # encoding: utf-8 # copyright: 2015, The Authors # license: All rights reserved title 'sample section' # you can also use plain tests describe file('/tmp') do it { should be_directory } end # you add controls here control 'tmp-1.0' do # A unique ID for this control impact 0.7 # The criticality, if this control fails. title 'Create /tmp directory' # A human-readable title desc 'An optional description...' describe file('/tmp') do # The actual test it { should be_directory } end end ~/secureprofile_01/controls/tmp.rb
  • 102. ©2016 Chef Software Inc. 5-102 GL: Edit the tmp.rb File - 2 of 3 # encoding: utf-8 # copyright: 2015, The Authors # license: All rights reserved title '/tmp profile' control "tmp-1.0" do impact 0.3 title "Create /tmp directory" desc "A /tmp directory must exist" describe file('/tmp') do it { should be_directory } end end ~/secureprofile_01/controls/tmp.rb
  • 103. ©2016 Chef Software Inc. 5-103 GL: Edit the tmp.rb File - 3 of 3 ... control "tmp-1.1" do impact 0.3 title "/tmp directory is owned by the root user" desc "The /tmp directory must be owned by the root user" describe file('/tmp') do it { should be_owned_by 'root' } end end ~/compliance_profiles/profile_01/test/tmp.rb
  • 104. ©2016 Chef Software Inc. 5-104 Summary ------- Location: secureprofile_01/ Profile: secureprofile_01 Controls: 3 Timestamp: 2016-02-26T21:24:52+00:00 Valid: true Errors ------ Warnings -------- $ inspec check secureprofile_01/ GL: Use `inspec check` to Verify Your Profile
  • 105. ©2016 Chef Software Inc. 5-105 .... Finished in 0.0467 seconds (files took 1.47 seconds to load) 4 examples, 0 failures $ inspec exec secureprofile_01/ GL: Use `inspec exec` to Verify Your Profile
  • 106. ©2016 Chef Software Inc. 5-106 Creating a Custom Profile In the preceding group lab you created a custom Compliance profile and tested your profile with InSpec. Your code passed the `inspec check` test and your system passed the `inspec exec` test. But what would an `inspec exec` failure look like?
  • 107. ©2016 Chef Software Inc. 5-107 Example of an `inspec exec` Failure Let's say you modified your ~ secureprofile_01/controls/tmp.rb and changed `should be_owned_by root` to `should be_owned_by other` and then ran `inspec exec` against that file... ... control "tmp-1.1" do impact 0.3 title "/tmp directory is owned by the root user" desc "The /tmp directory must be owned by the root user" describe file('/tmp') do it { should be_owned_by 'other' } end end
  • 108. ©2016 Chef Software Inc. 5-108 ... Failures: 1) File /tmp should be owned by "other" Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure } expected `File /tmp.owned_by?("other")` to return true, got false # secureprofile_01/controls/tmp.rb:20:in `block (3 levels) in load' Finished in 0.06284 seconds (files took 1.4 seconds to load) 4 examples, 1 failure Failed examples: rspec # File /tmp should be owned by "other" $ inspec exec secureprofile_01/ Example: `inspec exec` Failure
  • 109. ©2016 Chef Software Inc. 5-109 Uploading Custom Profiles to Compliance Server inspec v0.22.1 and above uses the `inspec compliance upload FILENAME` command to upload profiles from a workstation/node to the Compliance Server. That command should be preceded by `inspec compliance login https://FQDN --user admin --insecure - refresh_token 'TOKEN'` in order to first log in to the Compliance Server.
  • 110. ©2016 Chef Software Inc. 5-110 Objective: Group Lab: Uploading the Custom Profile to the Compliance Server Uploading it so it can be used in scans. q Upload your custom profile to the Compliance server. q Run a scan from your Compliance server using your custom profile.
  • 111. ©2016 Chef Software Inc. 5-111 secureprofile_01 $ cd ~ $ ls GL: Ensure You Are in the Home Dir
  • 112. ©2016 Chef Software Inc. 5-112 Commands: inspec compliance exec PROFILE # executes a Chef Compliance profile inspec compliance help [COMMAND] # Describe subcommands or one specific subcommand inspec compliance login SERVER # Log in to a Chef Compliance SERVER inspec compliance logout # user logout from Chef Compliance inspec compliance profiles # list all available profiles in Chef Compliance inspec compliance upload PATH # uploads a local profile to Chef Compliance inspec compliance version # displays the version of the Chef Compliance server $ inspec compliance help GL: Using 'inspec compliance` Commands
  • 113. ©2016 Chef Software Inc. 5-113 GL: Logging in to Your Compliance Server 1. Open your Compliance Server dashboard and click the menu icon. 2. From the resulting drop down menu, click About.
  • 114. ©2016 Chef Software Inc. 5-114 GL: Logging in to Your Compliance Server From the resulting window, highlight and copy the Refresh Token value. You may want to paste the token into a text document for now.
  • 115. ©2016 Chef Software Inc. 5-115 Your server supports --user and --password only Successfully authenticated [chef@ip-172-31-9-142 ~]$ $ inspec compliance login https://FQDN --user admin --insecure -- refresh_token 'TOKEN' GL: Logging in to Your Compliance Server
  • 116. ©2016 Chef Software Inc. 5-116 secureprofile_01 ├── controls │ ├── example.rb │ └── tmp.rb ├── inspec.yml ├── libraries └── README.md $ tree secureprofile_01 GL: Viewing Your Custom Profile Tree
  • 117. ©2016 Chef Software Inc. 5-117 Available profiles: ------------------- * base/apache * base/linux * base/mysql * base/postgres * base/ssh * base/windows * cis/cis-aix-5.3-6.1-level1 * cis/cis-aix-5.3-6.1-level2 * cis/cis-amazonlinux-2014.09-2015.03-level1 * cis/cis-amazonlinux-2014.09-2015.03-level2 ... $ inspec compliance profiles GL: Viewing Compliance Profiles on Your Compliance Server
  • 118. ©2016 Chef Software Inc. 5-118 I, [2016-06-07T19:18:53.543295 #12681] INFO -- : Checking profile in secureprofile_01 I, [2016-06-07T19:18:53.543448 #12681] INFO -- : Metadata OK. I, [2016-06-07T19:18:53.666594 #12681] INFO -- : Found 3 controls. I, [2016-06-07T19:18:53.666721 #12681] INFO -- : Control definitions OK. Profile is valid Generate temporary profile archive at /tmp/secureprofile_0120160607-12681-1jpozwr.tar.gz I, [2016-06-07T19:18:53.761495 #12681] INFO -- : Generate archive /tmp/secureprofile_0120160607-12681-1jpozwr.tar.gz. I, [2016-06-07T19:18:53.775046 #12681] INFO -- : Finished archive generation. Start upload to admin/secureprofile_01 Uploading to Chef Compliance Successfully uploaded profile $ inspec compliance upload secureprofile_01 GL: Uploading Your Custom Profile
  • 119. ©2016 Chef Software Inc. 5-119 Available profiles: ------------------- ... * admin/secureprofile_01 * base/apache * base/linux * base/mysql * base/postgres * base/ssh * base/windows * cis/cis-aix-5.3-6.1-level1 * cis/cis-aix-5.3-6.1-level2 * cis/cis-amazonlinux-2014.09-2015.03-level1 ... $ inspec compliance profiles GL: Viewing Compliance Profiles on Your Compliance Server
  • 120. ©2016 Chef Software Inc. 5-120 Successfully logged out $ inspec compliance logout GL: Logging out of Your Compliance server
  • 121. ©2016 Chef Software Inc. 5-121 GL: Viewing Your Uploaded Custom Profile Use a web browser to navigate the Compliance tab of your Compliance server. Notice that your custom profile is present.
  • 122. ©2016 Chef Software Inc. 5-122 GL: Testing Your Uploaded Custom Profile Navigate to the Compliance dashboard, click your Linux target, and then click Scan.
  • 123. ©2016 Chef Software Inc. 5-123 GL: Testing Your Uploaded Custom Profile Select only your custom profile and then click Scan now.
  • 124. ©2016 Chef Software Inc. 5-124 GL: Testing Your Uploaded Custom Profile You should now see that your custom profile works properly and your Linux target is in compliance.
  • 125. ©2016 Chef Software Inc. 5-125 Objective: Group Lab: Uploading the Custom Profile to the Compliance Server Uploading it so it can be used in scans. ü Upload your custom profile to the Compliance server. ü Run a scan from your Compliance server using your custom profile.
  • 126. ©2016 Chef Software Inc. 5-126 Review Questions 1. What is the difference between `inspec check` and `inspec exec'? 2. What does `inspec init profile` do? 3. Where can you get the refresh token that replaces TOKEN in this command? inspec compliance login https://FQDN --user admin -- insecure --refresh_token 'TOKEN'
  • 128. ©2016 Chef Software Inc. 5-128 Further Resources Other Places to Talk About, Practice, and Learn Chef Compliance
  • 129. ©2016 Chef Software Inc. 5-129 Going Forward There are many Chef resources available to you outside this class. During this module we will talk about just a few of those resources. But…remember what we said at the beginning of this class: The best way to learn Chef is to use Chef
  • 130. ©2016 Chef Software Inc. 5-130 docs.chef.io Docs are available to you, 24 hours a day, 7 days a week. Any question you have, you probably will find the answer for on our Docs site.
  • 131. ©2016 Chef Software Inc. 5-131 docs.chef.io Main Chef Compliance doc link: https://docs.chef.io/compliance.html Install Chef Compliance Server: https://docs.chef.io/install_compliance.html
  • 132. ©2016 Chef Software Inc. 5-132 docs.chef.io Upgrade Compliance Server doc link: https://docs.chef.io/upgrade_compliance.html
  • 133. ©2016 Chef Software Inc. 5-133 docs.chef.io Compliance DSL (domain-specific language): https://docs.chef.io/dsl_compliance.html That link contains descriptions and examples of the InSpec syntax used to define controls.
  • 134. ©2016 Chef Software Inc. 5-134 docs.chef.io Compliance API: https://docs.chef.io/release/compliance_1- 0/api_compliance.html The Compliance API is a REST-based API that is designed to be easy and predictable.
  • 135. 1500 Attendees! 55+ Speakers! Registration Open! Community Celebration!CHEFCONF 2016 AT A GLANCE Workshops & Chef Training Community Summit Partner Summit Welcome Reception Keynotes Technical Sessions Happy Hour Keynotes Technical Sessions Awesome Chef Awards Community Celebration DAY 1 // JULY 11 DAY 2 // JULY 12 DAY 3 // JULY 13 THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM chefconf.chef.io DAY 1 // JULY 11 « Workshops & ChefTraining « Community Summit « Partner Summit « Welcome Reception DAY 2 // JULY 12 « Keynotes « Technical Sessions « Happy Hour DAY 3 // JULY 13 « Keynotes « Technical Sessions « Awesome ChefAwards « Community Celebration THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM
  • 136. ©2016 Chef Software Inc. Thank You!