Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Maintaining control by letting go - security and devops

Maintaining control by letting go - security and devops

Talk at Infosecurity Europe all about the intersection of security and devops, focusing on the continuous delivery pipeline as an opportunity for conversation and automated security testing.

Gareth Rushgrove

June 04, 2015
Tweet

More Decks by Gareth Rushgrove

Other Decks in Technology

Transcript

  1. We can build more secure systems, not just react to

    problems better Gareth Rushgrove
  2. Automation is also the perfect middle-ground to build better relationships

    between security, development and operations Gareth Rushgrove
  3. WARNING This talk will feature code but is not about

    software development Gareth Rushgrove
  4. Why share? - Common language between teams - Builds trust

    amongst team members - Avoid duplication of effort and data - Limits the number of systems Gareth Rushgrove
  5. Machines check they match the model every half an hour,

    and automatically remediate and report any differences Gareth Rushgrove
  6. Gareth Rushgrove You can see what is changing across your

    infrastructure, all from the Puppet Enterprise Console
  7. “The constant discussion between software and infrastructure teams really helps

    us proactively find issues before deploying to production.”
  8. All of the configuration information ends up in PuppetDB. How

    might that be of interest to a security team? Gareth Rushgrove
  9. (The framework for this is about 20 lines of code

    and could be written by any good developer in an hour) Gareth Rushgrove
  10. (expect (every? ubuntu? (facts "operatingsystem"))) A one line test to

    check all machines are using the permitted Operating System
  11. Hook the tests into your operations teams monitoring system and

    security can get alerts when tests fail Gareth Rushgrove
  12. Combine existing operations data with developers willingness to write code

    and the security teams knowledge of potential threats Gareth Rushgrove
  13. “We went from all-hands-on- deck, war-room sort of deployments to

    non-events” Gareth Rushgrove Jez Miller, Heartland Payment Systems, Puppet Enterprise Customer
  14. As applicable to changes to web applications as infrastructure, end

    user devices, network hardware and more Gareth Rushgrove
  15. Gareth Rushgrove Write the code Check syntax Check style Unit

    tests Acceptance tests Deploy Deploy to staging Preflight checks
  16. Gareth Rushgrove Write the code Check syntax Check style Unit

    tests Acceptance tests Deploy Security tests
  17. Gareth Rushgrove Acceptance tests Deploy Security tests Manual review by

    security Automated security tests Automated security tests Is this a high risk change?
  18. What is a high risk change? - Change to firewall

    policy? - Change to authentication code? - Change to SSH configuration? - New user added? Gareth Rushgrove
  19. Once you know about the pipeline, you can add steps

    related to security Gareth Rushgrove
  20. Useful in different contexts: - Production monitoring system - Tests

    in development - Smoke tests for deployment Gareth Rushgrove
  21. Discovered open port 22/tcp on 45.56.74.113 Completed Connect Scan at

    07:09, 3.31s elapsed (12 total ports) Nmap scan report for www.puppetlabs.com (45.56.74.113) Host is up (0.082s latency). rDNS record for 45.56.74.113: li924-113.members.linode.com PORT STATE SERVICE 20/tcp filtered ftp-data 21/tcp filtered ftp 22/tcp open ssh 23/tcp filtered telnet 25/tcp filtered smtp 80/tcp open http 110/tcp filtered pop3 443/tcp open https 512/tcp filtered exec 522/tcp filtered ulp 1080/tcp filtered socks 8080/tcp open http-proxy Standard nmap output requires manual analysis
  22. it 'has only a limited number of open ports' do

    expect(@open_ports.count).to eq(3) end it 'exposes a web server' do expect(@open_ports).to include('80/tcp') expect(@open_ports).to include('443/tcp') end it 'exposes an SSH server' do expect(@open_ports).to include('22/tcp') end it 'rejects email traffic' do expect(@closed_ports).to include('25/tcp') end Using a unit testing framework we can make explicit assertions
  23. www.puppetlabs.com from 192.168.1.10 has only a limited number of open

    ports (FAILED - 3) exposes a web server exposes an SSH server rejects accept email traffic (FAILED - 4) Anyone can run the tests and understand what is expected and what is currently broken
  24. source "https://rubygems.org" gem "bundler-audit" gem "rake" gem "pry" group :vulnerable

    do gem "actionpack", "=3.2.10" end An example Gemfile, a list of ruby packages used in an application or environment, with a vulnerable package
  25. Name: actionpack Version: 3.2.10 Advisory: OSVDB-103440 Name: actionpack Version: 3.2.10

    Advisory: OSVDB-89026 Criticality: High URL: http://osvdb.org/show/osvdb/89026 Description: Ruby on Rails contains a flaw in params_parser.rb of the Action Pack. The issue is triggered when a type casting error occurs during the parsing of parameters. This may allow a remote attacker to potentially execute arbitrary code. Solution: upgrade to ~> 2.3.15, ~> 3.0.19, ~> 3.1.10, >= 3.2.11 An example report from bunder-audit
  26. An example test for checking for SQL injection vulnerabilities Scenario:

    The application should not contain SQL injection vulnerabilities Meta: @id scan_sql_injection @cwe-89 Given a scanner with all policies disabled And the SQL-Injection policy is enabled And the attack strength is set to High And the alert threshold is set to Low When the scanner is run And the XML report is written to the file sql_injection.xml Then no Medium or higher risk vulnerabilities should be present
  27. An example test for checking for XSS. Lots more build-in

    Scenario: The application should not contain XSS vulnerabilities Meta: @id scan_sql_injection @cwe-89 Given a scanner with all policies disabled And the Cross-Site-Scripting policy is enabled And the attack strength is set to High When the scanner is run Then no Medium or higher risk vulnerabilities should be present
  28. Gareth Rushgrove Security tests Run network security tests Check for

    vulnerable packages Run web application security tests
  29. Gareth Rushgrove Security tests Run network security tests Check for

    vulnerable packages Run web application security tests Static analysis Metrics analysis SSL config
  30. These are just quick examples. The point is automated testing

    and security go together incredibly well Gareth Rushgrove
  31. Focus on steps in the pipeline. No single tool will

    fix all problems Gareth Rushgrove
  32. Favour tools (open source, in-house or commercial) with APIs that

    can be integrated into a pipeline Gareth Rushgrove
  33. Adding steps into a continuous delivery pipeline is the perfect

    opportunity for a conversation Gareth Rushgrove