Slide 1

Slide 1 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Integrating Cloud Development, Security and Operations (DevSecOps) SEBASTIEN STORMACQ | AWS TECHNICAL & DEVELOPER EVANGELISM | @sebsto [email protected]

Slide 2

Slide 2 text

What to expect from the session Why security automation Who – security team in a DevSecOps world Where do you want security automation When – pre, post, and everything in between What can you do, practical examples How – tools and partners

Slide 3

Slide 3 text

import re re.search('([Dd]ev[Ss]ec|[Ss]ec[Dd]ev|[Rr]ugged\s[Dd]ev)[Oo]ps') = Security automation

Slide 4

Slide 4 text

import re re.search('([Dd]ev[Ss]ec|[Ss]ec[Dd]ev|[Rr]ugged\s[Dd]ev)[Oo]ps') = Security automation at scale

Slide 5

Slide 5 text

Why?

Slide 6

Slide 6 text

Teams that practice CI/CD ship code faster, and with more confidence 5x Lower change failure rate 440x Faster from commit to deploy 46x More frequent deployments 44% More time spent on new features Source: Puppet 2017 State of DevOps Report

Slide 7

Slide 7 text

Amazon “primitives” graph, 2009

Slide 8

Slide 8 text

= 60 million deployments a year = 1.9 deployments / second Thousands of teams + Microservices architectures + Multiple environments + Continuous delivery?

Slide 9

Slide 9 text

Why - Goals of DevSecOps Pace of innovation… meets pace of security automation Scalable infrastructure needs scalable security Risk/rating based actions Automatic incident response remediation

Slide 10

Slide 10 text

Why security automation Reduce risk of human error - Automation is effective - Automation is reliable - Automation is scalable Don’t worry… we still need humans

Slide 11

Slide 11 text

Who?

Slide 12

Slide 12 text

Purpose Security is a service team, not a blocker Security is everyone's job Allow flexibility and freedom but control the flow and result.

Slide 13

Slide 13 text

Meet the new security team Operations Engineering Application Security Compliance

Slide 14

Slide 14 text

Meet the new security team Operations Engineering Application Security Compliance Development

Slide 15

Slide 15 text

Where? 3(+) places

Slide 16

Slide 16 text

Continuous Integration / Continuous Deployment 1. Security OF the CI/CD Pipeline • Access roles • Hardening build servers/nodes 2. Security IN the CI/CD Pipeline • Artifact validation • Static code analysis

Slide 17

Slide 17 text

CI/CD for DevOps Version Control CI Server Package Builder Deploy Server Commit to Git/master Dev Get / Pull Code Images Send build report to Dev Stop everything if build failed Distributed Builds Run Tests in parallel Staging Env Test Env Code Config Tests Prod Env Push Config Install Create Artifact Repo Deployment templates for infrastructure Generate

Slide 18

Slide 18 text

Version Control CI Server Package Builder Promote Process Block creds From git Dev Get / Pull Code Images Log for audit Staging Env Test Env Code Config Tests Prod Env Audit/Validate Config Checksum Continuous Scan CI/CD for DevSecOps Send build report to Security Stop everything if audit/validation failed Deployment templates for infrastructure Scan hook

Slide 19

Slide 19 text

What about my other stuff?

Slide 20

Slide 20 text

© 2017, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3. Cloud scale security Infrastructure as code • Base requirement! • Split ownership • Pre-deploy validation Elastic security automation • API driven • Auto Scaling groups – hooks • Execution layer scales with targets Run time security • Tag-based targeting • Rip-n-replace • Continuous pen testing Immutable infrastructure • Validation and enforcement • Integrate with managed services … a.k.a. all the other stuff people are really talking about

Slide 21

Slide 21 text

When?

Slide 22

Slide 22 text

Easy All the time!

Slide 23

Slide 23 text

When – Control and Validate Pre-event - When possible • Store infrastructure in code repository • Validate each push (git hooks) • Use managed microservices as execution engine • Scan cloud infrastructure templates for unwanted/risk valued configurations • Validate container definitions • Validate system code early on • Find unwanted libraries, etc. • Force infrastructure changes through templates • Block if needed/unsure

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

When – Control and Validate Post-event - Always • Follow-up on sensitive APIs • IAM, security groups/firewall, encryption keys, logging, etc. • Alert/inform • Use source of truth • Locked to execution function (read only) • Validate source • Human or machine/CICD • Decide on remediation

Slide 26

Slide 26 text

When – Control and Validate Triggers – Event based: • Per change • API based • Event logs • Per day • Per framework • Overall infrastructure, components, and resources • One component, multiple frameworks

Slide 27

Slide 27 text

What? Give me some examples

Slide 28

Slide 28 text

Give me some examples Automatic Incident Response Remediation • Autoheal Cloudtrail logging • Disable offenders Integrate host-based action with cloud-based control • Immutable infrastructure – Auto isolate instances

Slide 29

Slide 29 text

User SSH ALLOWED EC2 Instance CloudWatch Events AWS Lambda Tag Updated Remove Access ISOLATED HOST X Example – Auto isolation – Host meets Cloud DynamoDB Is there a ticket? 1 2 3 4 5 6

Slide 30

Slide 30 text

Example – Auto isolation – Host meets Cloud Modify • /etc/pam.d/sshd Execute script upon logon • session optional pam_exec.so /path/trigger.sh Trigger AWS event as marker using IAM roles for EC2 #!/bin/bash INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id) REGION=$(wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone|sed 's/.\\{1\\}$//')DATE=$(date) aws ec2 --region $REGION create-tags --resources $INSTANCE_ID --tags \"Key=Tainted,Value=$DATE\” Execute Lambda function using CloudWatch Events on marker detection • Remove from load balancer/scaling groups (will auto-heal) • Block in/outgoing traffic using security groups and ACL

Slide 31

Slide 31 text

Example – Auto isolation – Host meets Cloud Don’t forget safeguards! • How many instances can I isolate before failure • If isolated > x: wake_human() • Remember, x could be 0

Slide 32

Slide 32 text

Demo Clouwatch Events + Lambda

Slide 33

Slide 33 text

Example – Log enforcement Detect • CloudTrail logging disabled Priority • Enable logging Forensics • Has this happened before? Countermeasures • If num_disabled > x: # x could be zero based on type and user disable_user() • Safeguard: Should I temporarily disable the user? Who is the user? Alert!

Slide 34

Slide 34 text

Demo Cloud Trail Analytics

Slide 35

Slide 35 text

How?

Slide 36

Slide 36 text

® ® SaaS Subscriptions Dozens of SaaS applications addressing multiple use cases

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

AWS Tools

Slide 40

Slide 40 text

AWS CloudTrail

Slide 41

Slide 41 text

Normalize Record AWS Config & Config Rules Deliver Stream Snapshot (ex. 2014-11-05) AWS Config Store History

Slide 42

Slide 42 text

Sample Custom AWS Config Rule

Slide 43

Slide 43 text

Sample AWS Config Rule

Slide 44

Slide 44 text

Putting it all together AWS CloudTrail Amazon CloudWatch Events AWS Lambda Amazon Simple Notification Service AWS API endpoints Your Staff Amazon S3 bucket Your security team IAM role AWS API Your SaaS tools

Slide 45

Slide 45 text

Cool… so I just fix things?? Well, yes... but...

Slide 46

Slide 46 text

Implement remediation framework

Slide 47

Slide 47 text

The anatomy of remediation Continuous / event based Execution constraints Will action risk breaking something Will change affect cost Is there a source of truth Priority action Forensic Counter measures Alerts Log Know Execute

Slide 48

Slide 48 text

What else can I do?

Slide 49

Slide 49 text

Benchmarking infrastructure Map your infrastructure against control frameworks Single run for single account health check AWS Config / Config Rules for compliance tracking Example: OSS validation for CIS AWS Foundation Framework • https://github.com/awslabs/aws-security-benchmark

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

At the end of the day… What are we trying to accomplish?

Slide 52

Slide 52 text

Goals Prevent bad configurations before they are implemented Autocorrect/remediate violations where possible

Slide 53

Slide 53 text

OSS Code to learn from git-secrets - Prevents you from committing passwords and other sensitive information to a Git repository. aws-security-benchmark - Benchmark scripts mapped against trusted security frameworks. aws-config-rules - [Node, Python, Java] Repository of sample custom rules for AWS Config Netflix/security_monkey - Monitors policy changes and alerts on insecure configurations in an AWS account. Netflix/edda - Edda is a service to track changes in your cloud deployments. ThreatResponse - Open Source Security Suite for hardening and responding in AWS. CloudSploit – Capturing things like open security groups, misconfigured VPCs, and more. Stelligent/Cfn_nag – Looks for patterns in CloudFormation templates that may indicate insecure infrastructure. Capitalone/cloud-custodian - Rules engine for AWS fleet management.

Slide 54

Slide 54 text

Thank you! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. SEBASTIEN STORMACQ | AWS TECHNICAL & DEVELOPER EVANGELISM | @sebsto [email protected]