SlideShare a Scribd company logo
Building Security Into Your Workflow
with InSpec
Mandi Walls | mandi@chef.io
HI!
• Mandi Walls
• Technical Community Manager for Chef, EMEA
• mandi@chef.io
• @lnxchk
• Adam Leff – Community Lead for InSpec @adamleff
EVERY business is a software business
We’re going to be a software
company with airplanes.
– CIO, Alaska Airlines
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec
Motivation
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec
Product Ideas and Features
Security Review
Production
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec
Afterthought Scanning
http://mspmentor.net/msp-mentor/botched-server-install-results-214-million-hipaa-breach-fine
https://www.darkreading.com/attacks-breaches/wannacry-forces-honda-to-take-production-plant-offline-/d/d-id/1329192
Equifax
"This vulnerability was disclosed back in March. There were clear and
simple instructions of how to remedy the situation. The responsibility is
then on companies to have procedures in place to follow such advice
promptly.”
- Bas van Schaik, a product manager and researcher at Semmle, an
analytics security firm, via Wired
https://www.wired.com/story/equifax-breach-no-excuse/
What We Have Here Is A Communications Problem
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec
What Is InSpec
InSpec
• Human-readable specification language for tests related to security and
compliance
• Includes facilities for creating, sharing, and reusing profiles
• Extensible language so you can build your own rules for your
applications and systems
• Command-line tools for plugging into your existing workflows / build
servers
• Integrates with Test Kitchen for fast-feedback local testing by developers
SSH Example
• From your security team:
SSH supports two different protocol versions. The
original version, SSHv1, was subject to a number
of security issues. All systems must use SSHv2
instead to avoid these issues.
Remediation
• Identify the file and file location to check your systems
• Figure out some sort of incantation
Do we check it first or just push a new one everywhere?
• What’s the plan for the currently used images?
Rebuild?
Remediate at instantiation?
• You’re likely using a configuration management solution for these types
of changes?
Lifecycle
• When you get a mandate from security, how often is it checked?
• Single big scan, report mailed out with a “due date”?
• Yearly or twice-yearly massive scans with remediation firedrills?
Using InSpec
Find It!
• http://inspec.io/
• Open Source!
• The “spec” is a hint
Check that sshd_config
describe sshd_config do
impact 1.0
title 'SSH Version 2'
desc <<-EOF
SSH supports two different protocol versions. The original version, SSHv1, was subject to a
number of security issues. Please use SSHv2 instead to avoid these.
EOF
its('Protocol') { should cmp 2 }
end
Resources
• Inspec includes built-in resources for common services, system
files, and configurations
See http://inspec.io/docs/reference/resources/ for the current list!
• Built-in resources work on several platforms of Linux. There are
also Windows-specifics
• A resource has characteristics that can be verified for your
requirements, and Matchers that work with those characteristics
Check that sshd_config
describe sshd_config do
impact 1.0
title 'SSH Version 2'
desc <<-EOF
SSH supports two different protocol versions. The original version, SSHv1, was subject to a
number of security issues. Please use SSHv2 instead to avoid these.
EOF
its('Protocol') { should cmp 2 }
end
• Resources take the “grep for x” out of the testing phase
• Parsers included in the InSpec software do the work for you
• It’s built off the premises of rSpec, and meant to be human
readable
its.... should...
• it { should exist }
• it { should be_installed }
• it { should be_enabled }
• its('max_log_file') { should cmp 6 }
• its('exit_status') { should eq 0 }
• its('gid') { should eq 0 }
Run It
• InSpec is command line
Installs as a ruby gem or as part of the ChefDK
• Can be run locally, test the machine it is executing on
• Or remotely
InSpec will log into the target and run the tests for you
• Also a REPL
https://www.inspec.io/docs/reference/shell/
Test Any Target
inspec exec test.rb
inspec exec test.rb -i ~/.aws/mandi_eu.pem -t ssh://ec2-
user@54.152.7.203
inspec exec test.rb -t winrm://Admin@192.168.1.2 --password
super
inspec exec test.rb -t docker://3dda08e75838
Failures
• InSpec runs with failed tests return a non-zero return code
Profile Summary: 0 successful, 1 failures, 0 skipped
[chef@ip-172-31-29-25 ~]$ echo $?
1
[chef@ip-172-31-29-25 ~]$
• Passing tests have 0 return code
Profile Summary: 1 successful, 0 failures, 0 skipped
[chef@ip-172-31-29-25 ~]$ echo $?
0
[chef@ip-172-31-29-25 ~]$
Test Kitchen
• InSpec also runs as an included tester in TK
• https://www.inspec.io/docs/reference/plugin_kitchen_inspec/
Profiles
• InSpec profiles allow you to package and share sets of InSpec
tests for your organization or for a specific application set
• Each profile can have multiple test files included
• The test files generally test for one required outcome, but can
look at different objects to meet requirements
• Flexible!
Create your own profiles for specific software you use
Example – Basic Hardening
• Centos 7.2 host
• Test Kitchen
• os-hardening cookbook from https://supermarket.chef.io
• /dev-sec/linux-baseline InSpec profile from https://supermarket.chef.io
The Cookbook and the InSpec Profile Work Together
suites:
- name: default
run_list:
- recipe[osdc-inspec-talk::default]
- recipe[os-hardening]
verifier:
inspec_tests:
- test/smoke/default
- https://github.com/dev-sec/linux-baseline
attributes:
What’s in the os-hardening Cookbook
Run kitchen test Without Hardening
Profile Summary: 25 successful, 25 failures, 1 skipped
Test Summary: 77 successful, 39 failures, 3 skipped
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Verify failed on instance <default-centos-72>. Please
see .kitchen/logs/default-centos-72.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for
configuration
Run kitchen test With Hardening
Profile Summary: 50 successful, 0 failures, 1 skipped
Test Summary: 116 successful, 0 failures, 3 skipped
Finished verifying <default-centos-72> (0m11.07s).
-----> Destroying <default-centos-72>...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
Vagrant instance <default-centos-72> destroyed.
Finished destroying <default-centos-72> (0m4.97s).
Finished testing <default-centos-72> (2m37.89s).
-----> Kitchen is finished. (2m39.44s)
What’s in the linux-baseline Profile
control 'os-02' do
impact 1.0
title 'Check owner and permissions for /etc/shadow'
desc 'Check periodically the owner and permissions for /etc/shadow'
describe file('/etc/shadow') do
it { should exist }
it { should be_file }
it { should be_owned_by 'root' }
its('group') { should eq shadow_group }
it { should_not be_executable }
it { should be_writable.by('owner') }
...
Over Time
Build a Comprehensive Set of Checks for Your
Systems
Run Them Every Time Someone Needs to Make a
Change
Make it EASY for Everyone to Use
Resources
• https://inspec.io
• https://github.com/chef-training/workshops/
• http://www.anniehedgie.com/inspec-basics-1
• http://blog.johnray.io/chef-inspec-and-dirty-cow
• https://blog.chef.io/2017/05/23/inspec-launches-support-cloud-platform-
assessments/
October 10 – 11, 2017
etc.venues Fenchurch St London
https://chef.io/summits
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec

More Related Content

PPTX
InSpec Workflow for DevOpsDays Riga 2017
PPTX
InSpec at DevOps ATL Meetup January 22, 2020
PPTX
Adding Security to Your Workflow With InSpec - SCaLE17x
PPTX
Prescriptive Security with InSpec - All Things Open 2019
PPTX
InSpec For DevOpsDays Amsterdam 2017
PDF
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
PDF
Prescriptive System Security with InSpec
PPTX
Using Chef InSpec for Infrastructure Security
InSpec Workflow for DevOpsDays Riga 2017
InSpec at DevOps ATL Meetup January 22, 2020
Adding Security to Your Workflow With InSpec - SCaLE17x
Prescriptive Security with InSpec - All Things Open 2019
InSpec For DevOpsDays Amsterdam 2017
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
Prescriptive System Security with InSpec
Using Chef InSpec for Infrastructure Security

What's hot (20)

PPTX
Adding Security to Your Workflow with InSpec (MAY 2017)
PPTX
Adding Security and Compliance to Your Workflow with InSpec
PDF
Automating Compliance with InSpec - Chef Singapore Meetup
PPTX
Building Security into Your Workflow with InSpec
PPTX
InSpec - June 2018 at Open28.be
PDF
Inspec: Turn your compliance, security, and other policy requirements into au...
PPTX
Banfootguns devseccon 2019
PDF
Compliance as Code
PPTX
InSpec Workshop DevSecCon 2017
PPTX
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
PPTX
Ingite Slides for InSpec
PPTX
Introduction to InSpec and 1.0 release update
PPTX
Automated Infrastructure Testing
PPTX
Compliance Automation with Inspec Part 4
PPTX
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
PPTX
Compliance Automation with Inspec Part 2
PDF
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
PPTX
Splunk: Forward me the REST of those shells
PDF
Introduction to Infrastructure as Code & Automation / Introduction to Chef
PPTX
Drupal Continuous Integration with Jenkins - The Basics
Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security and Compliance to Your Workflow with InSpec
Automating Compliance with InSpec - Chef Singapore Meetup
Building Security into Your Workflow with InSpec
InSpec - June 2018 at Open28.be
Inspec: Turn your compliance, security, and other policy requirements into au...
Banfootguns devseccon 2019
Compliance as Code
InSpec Workshop DevSecCon 2017
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
Ingite Slides for InSpec
Introduction to InSpec and 1.0 release update
Automated Infrastructure Testing
Compliance Automation with Inspec Part 4
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
Compliance Automation with Inspec Part 2
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
Splunk: Forward me the REST of those shells
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Drupal Continuous Integration with Jenkins - The Basics
Ad

Similar to DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec (20)

PPTX
OSDC 2017 - Mandi Walls - Building security into your workflow with inspec
PPTX
DevSecCon London 2017: Inspec workshop by Mandi Walls
PPTX
DevOpsDays InSpec Workshop
PPTX
InSpec Workshop at Velocity London 2018
PPTX
BuildStuff.LT 2018 InSpec Workshop
PPTX
Compliance as Code: Velocity with Security - Fraser Pollock, Chef
PPTX
Quality code in wordpress
PPTX
Version Control and Continuous Integration
PDF
stackconf 2024 | How to hack and defend (your) open source by Roman Zhukov.pdf
PDF
we45 DEFCON Workshop - Building AppSec Automation with Python
PDF
Comment améliorer le quotidien des Développeurs PHP ?
PDF
Melbourne Chef Meetup: Automating Azure Compliance with InSpec
PDF
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
PDF
CI / CD / CS - Continuous Security in Kubernetes
PDF
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
PPTX
Achieving DevOps Success with Chef Automate
PDF
Django dev-env-my-way
PPTX
Automatize everything
PDF
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
PDF
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
OSDC 2017 - Mandi Walls - Building security into your workflow with inspec
DevSecCon London 2017: Inspec workshop by Mandi Walls
DevOpsDays InSpec Workshop
InSpec Workshop at Velocity London 2018
BuildStuff.LT 2018 InSpec Workshop
Compliance as Code: Velocity with Security - Fraser Pollock, Chef
Quality code in wordpress
Version Control and Continuous Integration
stackconf 2024 | How to hack and defend (your) open source by Roman Zhukov.pdf
we45 DEFCON Workshop - Building AppSec Automation with Python
Comment améliorer le quotidien des Développeurs PHP ?
Melbourne Chef Meetup: Automating Azure Compliance with InSpec
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
CI / CD / CS - Continuous Security in Kubernetes
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
Achieving DevOps Success with Chef Automate
Django dev-env-my-way
Automatize everything
DevSec Delight with Compliance as Code - Matt Ray - AgileNZ 2017
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Ad

More from DevOpsDays Riga (20)

PDF
DevOpsDaysRiga 2017: Mark Smalley - Kill DevOps
PDF
DevOpsDaysRiga 2018: Serhat Can - The Rocky Path to Migrating Production Appl...
PPTX
DevOpsDaysRiga 2018: Uldis Karlovs-Karlovskis - DevOpsDays Ignite Karaoke - S...
PDF
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
PDF
DevOpsDaysRiga 2018: Juris Puce - GDPR and other security regulation imposed ...
PPTX
DevOpsDaysRiga 2018: Heather Wild - Keep Yourself Alive -Stopping the effects...
PDF
DevOpsDaysRiga 2018: Philipp Krenn - Building Distributed Systems in Distribu...
PPTX
DevOpsDaysRiga 2018: Antonio Pigna - Put the brAIn into your DevOps workflow
PPTX
DevOpsDaysRiga 2018: Christina Aldan - Fearing the Robot Overlords
PDF
DevOpsDaysRiga 2018: Jan de Vries - Realising the power of antifragility is l...
PDF
DevOpsDaysRiga 2018: Ken Mugrage - DevOps and DevOpsDays - Where it started, ...
PDF
DevOpsDaysRiga 2018: Matty Stratton - How Do You Infect Your Organization Wit...
PDF
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
PPTX
DevOpsDaysRiga 2018: Jon Hall - DevOps in the enterprise: how "swarming" can ...
PDF
DevOpsDaysRiga 2018: Stas Zvinyatskovsky - Transformation: how big can you dr...
PDF
DevOpsDaysRiga 2018: Joep Piscaer - Reducing inertia with Public Cloud and Op...
PDF
DevOpsDaysRiga 2018: Andrey Adamovich - DevOps Transformations: Tools vs Culture
PDF
DevOpsDaysRiga 2018: Thiago de Faria - Chaos while deploying ML and making su...
PDF
DevOpsDaysRiga 2018: Anton Arhipov - Build pipelines with TeamCity
PDF
DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...
DevOpsDaysRiga 2017: Mark Smalley - Kill DevOps
DevOpsDaysRiga 2018: Serhat Can - The Rocky Path to Migrating Production Appl...
DevOpsDaysRiga 2018: Uldis Karlovs-Karlovskis - DevOpsDays Ignite Karaoke - S...
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
DevOpsDaysRiga 2018: Juris Puce - GDPR and other security regulation imposed ...
DevOpsDaysRiga 2018: Heather Wild - Keep Yourself Alive -Stopping the effects...
DevOpsDaysRiga 2018: Philipp Krenn - Building Distributed Systems in Distribu...
DevOpsDaysRiga 2018: Antonio Pigna - Put the brAIn into your DevOps workflow
DevOpsDaysRiga 2018: Christina Aldan - Fearing the Robot Overlords
DevOpsDaysRiga 2018: Jan de Vries - Realising the power of antifragility is l...
DevOpsDaysRiga 2018: Ken Mugrage - DevOps and DevOpsDays - Where it started, ...
DevOpsDaysRiga 2018: Matty Stratton - How Do You Infect Your Organization Wit...
DevOpsDaysRiga 2018: Eric Skoglund, Lars Albertsson - Kubernetes as data plat...
DevOpsDaysRiga 2018: Jon Hall - DevOps in the enterprise: how "swarming" can ...
DevOpsDaysRiga 2018: Stas Zvinyatskovsky - Transformation: how big can you dr...
DevOpsDaysRiga 2018: Joep Piscaer - Reducing inertia with Public Cloud and Op...
DevOpsDaysRiga 2018: Andrey Adamovich - DevOps Transformations: Tools vs Culture
DevOpsDaysRiga 2018: Thiago de Faria - Chaos while deploying ML and making su...
DevOpsDaysRiga 2018: Anton Arhipov - Build pipelines with TeamCity
DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...

Recently uploaded (20)

PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
innovation process that make everything different.pptx
PPTX
Internet___Basics___Styled_ presentation
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
Testing WebRTC applications at scale.pdf
PPTX
artificial intelligence overview of it and more
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
Funds Management Learning Material for Beg
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
presentation_pfe-universite-molay-seltan.pptx
DOCX
Unit-3 cyber security network security of internet system
PDF
Sims 4 Historia para lo sims 4 para jugar
Introuction about ICD -10 and ICD-11 PPT.pptx
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
innovation process that make everything different.pptx
Internet___Basics___Styled_ presentation
WebRTC in SignalWire - troubleshooting media negotiation
international classification of diseases ICD-10 review PPT.pptx
Introduction to Information and Communication Technology
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Testing WebRTC applications at scale.pdf
artificial intelligence overview of it and more
PptxGenJS_Demo_Chart_20250317130215833.pptx
Funds Management Learning Material for Beg
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
Paper PDF World Game (s) Great Redesign.pdf
SAP Ariba Sourcing PPT for learning material
presentation_pfe-universite-molay-seltan.pptx
Unit-3 cyber security network security of internet system
Sims 4 Historia para lo sims 4 para jugar

DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with InSpec

  • 1. Building Security Into Your Workflow with InSpec Mandi Walls | mandi@chef.io
  • 2. HI! • Mandi Walls • Technical Community Manager for Chef, EMEA • mandi@chef.io • @lnxchk • Adam Leff – Community Lead for InSpec @adamleff
  • 3. EVERY business is a software business We’re going to be a software company with airplanes. – CIO, Alaska Airlines
  • 7. Product Ideas and Features Security Review Production
  • 12. Equifax "This vulnerability was disclosed back in March. There were clear and simple instructions of how to remedy the situation. The responsibility is then on companies to have procedures in place to follow such advice promptly.” - Bas van Schaik, a product manager and researcher at Semmle, an analytics security firm, via Wired https://www.wired.com/story/equifax-breach-no-excuse/
  • 13. What We Have Here Is A Communications Problem
  • 16. InSpec • Human-readable specification language for tests related to security and compliance • Includes facilities for creating, sharing, and reusing profiles • Extensible language so you can build your own rules for your applications and systems • Command-line tools for plugging into your existing workflows / build servers • Integrates with Test Kitchen for fast-feedback local testing by developers
  • 17. SSH Example • From your security team: SSH supports two different protocol versions. The original version, SSHv1, was subject to a number of security issues. All systems must use SSHv2 instead to avoid these issues.
  • 18. Remediation • Identify the file and file location to check your systems • Figure out some sort of incantation Do we check it first or just push a new one everywhere? • What’s the plan for the currently used images? Rebuild? Remediate at instantiation? • You’re likely using a configuration management solution for these types of changes?
  • 19. Lifecycle • When you get a mandate from security, how often is it checked? • Single big scan, report mailed out with a “due date”? • Yearly or twice-yearly massive scans with remediation firedrills?
  • 21. Find It! • http://inspec.io/ • Open Source! • The “spec” is a hint
  • 22. Check that sshd_config describe sshd_config do impact 1.0 title 'SSH Version 2' desc <<-EOF SSH supports two different protocol versions. The original version, SSHv1, was subject to a number of security issues. Please use SSHv2 instead to avoid these. EOF its('Protocol') { should cmp 2 } end
  • 23. Resources • Inspec includes built-in resources for common services, system files, and configurations See http://inspec.io/docs/reference/resources/ for the current list! • Built-in resources work on several platforms of Linux. There are also Windows-specifics • A resource has characteristics that can be verified for your requirements, and Matchers that work with those characteristics
  • 24. Check that sshd_config describe sshd_config do impact 1.0 title 'SSH Version 2' desc <<-EOF SSH supports two different protocol versions. The original version, SSHv1, was subject to a number of security issues. Please use SSHv2 instead to avoid these. EOF its('Protocol') { should cmp 2 } end
  • 25. • Resources take the “grep for x” out of the testing phase • Parsers included in the InSpec software do the work for you • It’s built off the premises of rSpec, and meant to be human readable
  • 26. its.... should... • it { should exist } • it { should be_installed } • it { should be_enabled } • its('max_log_file') { should cmp 6 } • its('exit_status') { should eq 0 } • its('gid') { should eq 0 }
  • 27. Run It • InSpec is command line Installs as a ruby gem or as part of the ChefDK • Can be run locally, test the machine it is executing on • Or remotely InSpec will log into the target and run the tests for you • Also a REPL https://www.inspec.io/docs/reference/shell/
  • 28. Test Any Target inspec exec test.rb inspec exec test.rb -i ~/.aws/mandi_eu.pem -t ssh://ec2- user@54.152.7.203 inspec exec test.rb -t winrm://Admin@192.168.1.2 --password super inspec exec test.rb -t docker://3dda08e75838
  • 29. Failures • InSpec runs with failed tests return a non-zero return code Profile Summary: 0 successful, 1 failures, 0 skipped [chef@ip-172-31-29-25 ~]$ echo $? 1 [chef@ip-172-31-29-25 ~]$ • Passing tests have 0 return code Profile Summary: 1 successful, 0 failures, 0 skipped [chef@ip-172-31-29-25 ~]$ echo $? 0 [chef@ip-172-31-29-25 ~]$
  • 30. Test Kitchen • InSpec also runs as an included tester in TK • https://www.inspec.io/docs/reference/plugin_kitchen_inspec/
  • 31. Profiles • InSpec profiles allow you to package and share sets of InSpec tests for your organization or for a specific application set • Each profile can have multiple test files included • The test files generally test for one required outcome, but can look at different objects to meet requirements • Flexible! Create your own profiles for specific software you use
  • 32. Example – Basic Hardening • Centos 7.2 host • Test Kitchen • os-hardening cookbook from https://supermarket.chef.io • /dev-sec/linux-baseline InSpec profile from https://supermarket.chef.io
  • 33. The Cookbook and the InSpec Profile Work Together suites: - name: default run_list: - recipe[osdc-inspec-talk::default] - recipe[os-hardening] verifier: inspec_tests: - test/smoke/default - https://github.com/dev-sec/linux-baseline attributes:
  • 34. What’s in the os-hardening Cookbook
  • 35. Run kitchen test Without Hardening Profile Summary: 25 successful, 25 failures, 1 skipped Test Summary: 77 successful, 39 failures, 3 skipped >>>>>> ------Exception------- >>>>>> Class: Kitchen::ActionFailed >>>>>> Message: 1 actions failed. >>>>>> Verify failed on instance <default-centos-72>. Please see .kitchen/logs/default-centos-72.log for more details >>>>>> ---------------------- >>>>>> Please see .kitchen/logs/kitchen.log for more details >>>>>> Also try running `kitchen diagnose --all` for configuration
  • 36. Run kitchen test With Hardening Profile Summary: 50 successful, 0 failures, 1 skipped Test Summary: 116 successful, 0 failures, 3 skipped Finished verifying <default-centos-72> (0m11.07s). -----> Destroying <default-centos-72>... ==> default: Forcing shutdown of VM... ==> default: Destroying VM and associated drives... Vagrant instance <default-centos-72> destroyed. Finished destroying <default-centos-72> (0m4.97s). Finished testing <default-centos-72> (2m37.89s). -----> Kitchen is finished. (2m39.44s)
  • 37. What’s in the linux-baseline Profile control 'os-02' do impact 1.0 title 'Check owner and permissions for /etc/shadow' desc 'Check periodically the owner and permissions for /etc/shadow' describe file('/etc/shadow') do it { should exist } it { should be_file } it { should be_owned_by 'root' } its('group') { should eq shadow_group } it { should_not be_executable } it { should be_writable.by('owner') } ...
  • 38. Over Time Build a Comprehensive Set of Checks for Your Systems Run Them Every Time Someone Needs to Make a Change Make it EASY for Everyone to Use
  • 39. Resources • https://inspec.io • https://github.com/chef-training/workshops/ • http://www.anniehedgie.com/inspec-basics-1 • http://blog.johnray.io/chef-inspec-and-dirty-cow • https://blog.chef.io/2017/05/23/inspec-launches-support-cloud-platform- assessments/
  • 40. October 10 – 11, 2017 etc.venues Fenchurch St London https://chef.io/summits