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

Checking and rechecking - security policy in code

Checking and rechecking - security policy in code

Short talk from CyberUK in Practice

Gareth Rushgrove

May 25, 2016
Tweet

More Decks by Gareth Rushgrove

Other Decks in Technology

Transcript

  1. (without introducing more risk) 30x Gareth Rushgrove More frequent deployments

    Faster lead times than their peers 200x 2015 State of DevOps Report
  2. (without introducing more risk) 60x Gareth Rushgrove Change success rate

    Faster mean time to recover 168x 2015 State of DevOps Report
  3. (without introducing more risk) Siloed teams Long cycle times Poor

    visibility Manual processes Gareth Rushgrove Cross-functional teams Short cycle times Fast feedback Automated processes
  4. 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 Rather than saying “the firewall should be configured thusly”
  5. def test_passwd_file(File): passwd = File("/etc/passwd") assert passwd.contains("root") assert passwd.user ==

    "root" assert passwd.group == "root" assert passwd.mode == 0o644 Rather than saying “the passwd file should only be accessible by root”
  6. package { 'openssh': ensure => latest } Rather than saying

    “we should have the latest version of openssh installed”
  7. control 'os-04' do impact 1.0 title 'Dot in PATH variable'

    desc 'Do not include the current working directory in PATH variable. This makes it easier for an attacker to gain extensive rigths by executing a Trojan program' describe os_env('PATH') do its('split') { should_not include('') } its('split') { should_not include('.') } end end Rather than saying “PATH should not include the current directory”
  8. Rather than saying “please don’t introduce 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
  9. Describing policy in code can: - Reduce cost and time

    per release - Make testing repeatable - Make time for the things that can’t be automated Gareth Rushgrove
  10. Embracing software means: - Closer collaboration between policy makers and

    practitioners - No arguments about semantics - Potential for sharing and reuse Gareth Rushgrove