Top Banner
Cem Gurkok Lead InfoSec Engineer [email protected] @CGurkok Containers and Security
37

Containers and Security for DevOps

Jan 21, 2018

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Containers and Security for DevOps

Cem Gurkok

Lead InfoSec Engineer

[email protected]

@CGurkok

Containers and Security

Page 2: Containers and Security for DevOps

Agenda• Threats

• Container pipelines and integrity

• Monitoring containers, hosts, apps, networks

• Digital Forensics

• Vulnerability Management

• Hardening

• Demo?

Page 3: Containers and Security for DevOps

Threat

s

Page 4: Containers and Security for DevOps

Container Threats & Challenges

Run-time

• Container exploit and resource exposure (App)

• Breaking out of container

• Cross-container attacks

• Resource overuse (DoS)

At-rest or transport

• Tampering of images

• Unpatched OS or applications

Page 5: Containers and Security for DevOps

Mitigations

Page 6: Containers and Security for DevOps

Securing the Pipeline

Docker

Security

Platform Security

Access Controls

Content Security

Monitoring and

Response

Page 7: Containers and Security for DevOps

The Pipeline

Page 8: Containers and Security for DevOps

Container Pipeline & Security

Base OS and Docker File

Base OS Image

DEV Docker Trusted Registry +

Notary

Developer

RelEng Image

DEV Docker Trusted Registry +

Notary

Continuous

Integration

PROD Docker Trusted Registry +

Notary

Running in PROD

Monitoring in all steps.

1. Security Review and Hardening

2. Signing, Authentication, Image

Vulnerability Scans

3. Authentication, Verification4. Signing, Authentication, Image

Vulnerability Scans

5. Authentication6. Authentication, Verification

7. Authentication, Verification,

Vulnerability Scans8. Incident Response, Digital

Forensics, Patching

Page 9: Containers and Security for DevOps

Access Control: Authentication

• LDAP Auth over SSL for Docker image transactions:

• Users (Devs, RelEng)

• Service accounts

• Mutual TLS Authentication for registry replication

Dev Systems

Dev Registry

Prod Registry

Build & Test

DMZ Services

Master Registry

TLS

Page 10: Containers and Security for DevOps

Container Integrity

Docker Trusted Registry (DTR)

• On-premise

• Authenticated transactions with LDAPS authentication

• DEV and PROD user and image separation

• Users will not be able to disable signing validation

• Validation will be transparent to the users

Page 11: Containers and Security for DevOps

Container Integrity

Build & Test

Docker Notary

• Enable Docker Content Trust on consumers

• Can enable signing checks on every managed host

• Signature verification transparent to users

Notary Master

DMZ Services

Prod Services

Sign

Validate

Validate

Page 12: Containers and Security for DevOps

Master Docker Registry

DE

V

DMZ

Notary Master

LDAPS Auth

Notary Signing

Dev Docker Registry

PRO

D

Mirrored Read-only

Registry or CachingProxy

Docker packaged services

Mutual TLS Auth

HTTPS Pull

Validate

Dev Systems

LDAPS user acct

HTTPS Push to Dev

Authenticated pulls

LDAPS Auth

HTTPS

Push and

Sign HTTPS Pull

Sign

LDAPS Auth

HTTPS Push

Already Signed

Docker packaged

services in DMZ

HTTPS No

Auth Pull

Validate

RelEng

promotes

to DMZ

Release case

Ticketing

System

Page 13: Containers and Security for DevOps

Hardening

Page 14: Containers and Security for DevOps

Hardening: Host

• Frequent patching

• Install only needed components and libraries (i.e. no gcc or

bash)

• Grsecurity/PaX for the kernel

• File system integrity monitoring (no docker bin mods!)

• Leverage Linux isolation capabilities!!

Page 15: Containers and Security for DevOps

Hardening: Container

• Base image and app with latest updates/patches

• Leverage User namespaces (run as low priv user on host)

• Leverage the Docker AuthZ Plugin for granular access control

• Use Secure Computing Mode profiles (seccomp) for runtime

syscall filtering

• docker --security-opt seccomp=/pathkernel

?

Page 16: Containers and Security for DevOps

Hardening: Container

• Avoid using Docker with the --privileged flag

• Limit access to the docker user and group

• Limit and/or separate host and kernel device access

• Use --read-only when running containers (immutability)

• Install only needed components and libraries (i.e. no gcc or

ssh)

Page 17: Containers and Security for DevOps

Hardening: Docker Bench for Security

• Docker Bench for Security to

the rescue!

• https://github.com/docker/

docker-bench-security

• Checks based on best

practices for hosts and

containers

* https://github.com/docker/docker-bench-security

Page 18: Containers and Security for DevOps

Hardening: Vulnerability Management

Image Scans with tools, such as Docker

Security Scanning:

• Operating System

• Application source code and libraries

Network Scans with traditional vuln

scanners:

• Discovery

• Exposed services

Auto and Manual source code audits

* “Securing the Software Supply Chain with Docker, ” May 2016, Nathan McCauley

Page 19: Containers and Security for DevOps

Hardening: Vulnerability Management

• Scanning

• Docker Images

• Applications

• Remediation

• Prioritization and SLAs for Patching

• Relaunching containers after patching

Δt

Page 20: Containers and Security for DevOps

Monitoring

Page 21: Containers and Security for DevOps

Network Infrastructure

• Bridged networking on Host

• Containers assigned VNICs, IP

addresses, and hostnames

• Containers isolated via VLANs (i.e.

DB, Web App)

• Tap interface for monitoring

• Security Policies per VLANs and

Zones

Page 22: Containers and Security for DevOps

Network Infrastructure

Page 23: Containers and Security for DevOps

Monitoring: Network

Network traffic captured for:

• Inter-container communications

• Host communications

• Resource communications (i.e. DB,

Public Internet)

Network traffic sent to:

• IDS (Intrusion Detection System)

• Netflow generator

• Output sent to SIEM for analysis

Page 24: Containers and Security for DevOps

Monitoring: Hosts

Logs:

• All host logs are saved (including auditd for syscall monitoring)

• SIEM agents consume and forward the logs from hosts

• Monitoring, Dashboarding, Alerting at SIEM

Host SIEM

Page 25: Containers and Security for DevOps

Monitoring: Containers & Apps

• Logs are monitored similar to host

• OS + Application logs

• Network activity monitoring

• IP address assignments

• Netflows

• IDS (Intrusion Detection System)

• Raw Network Traffic Capture

Page 26: Containers and Security for DevOps

Monitoring: Host, Containers & Apps

Disk activity monitoring

• File system integrity

• Run time layer monitoring

Memory monitoring

• Docker and container process activity

• Process integrity: Engine + Containers

Page 27: Containers and Security for DevOps

Digital

Forensics

Page 28: Containers and Security for DevOps

Digital Forensics

• Incident Response Plan/Policies

• Live/Post-mortem Memory Forensics

• Disk Forensics

• Network Monitoring/Forensics

Page 29: Containers and Security for DevOps

Disk Forensics

• Build supertimeline to have integrated view of events

• Data Sources:

• Raw Disk Image

• Log Files

• Binaries

• Tools

• The Sleuth Kit: File system analysis

• Plaso: Build supertimeline

• dd: Raw disk image

dd

Sleuth Kit

Plaso

Page 30: Containers and Security for DevOps

Memory Forensics

Why Memory Forensics?

• Nothing can hide in memory!

• Faster artifact discovery vs. disk forensics

Page 31: Containers and Security for DevOps

Memory Forensics

Analyze host memory

• Live /dev/*mem

• VM memory file

• Memory dump/sample

Tools:

• Analysis (most OS and sample format):

• The Volatility Framework

• Memory sampling on Linux: LiME, linpmem

LiME

linpmem

Page 32: Containers and Security for DevOps

Memory Forensics: Process Hierarchy

• pstree_hash [new]: View Docker

processes in a tree view based

on the PID hash table vs. linked

list

• Use case: Detect rogue or

injected child processes/

containers

Page 33: Containers and Security for DevOps

Memory Forensics: Loaded Libraries

• linux_proc_maps: shows process memory maps, their

permissions and original file paths (executable and libraries)

• Use case: Detect Shared Library Injections

Page 34: Containers and Security for DevOps

Memory Forensics: Process Integrity

• process_compare [new]: Detect if user space binary has

been tampered with in memory (in memory binary vs. on

disk) [5]

• Works when binary symbols can’t be extracted

Page 35: Containers and Security for DevOps

Summary

Platform Security

Isolation

Hardening

Best Practices

Vulnerability Scans

Content Security

Registry

Notary

Image/Code Signing

Image/Code Scanning

Access Controls

LDAP

S

User Authentication

System Authentication

Monitoring and

Response

IR Plan & Testing

Vulnerability Management

Network

Logs

Forensics

Page 36: Containers and Security for DevOps

Thank Y u

Page 37: Containers and Security for DevOps

References

1. “CIS Docker 1.6 Benchmark,” Center for Internet Security

2. “Introduction to Container Security,” Docker.com

3. “Understanding and Hardening Linux Containers,” NCC Group

4. “Abusing Privileged and Unprivileged Linux Containers,” NCC Group

5. “The Volatility Framework,” https://github.com/volatilityfoundation/volatility 6.

“Identifying the Unknown in User Space Memory,” Andrew White

7. “LiME,” https://github.com/504ensicsLabs/LiME

8. “linpmem,” http://www.rekall-forensic.com/docs/Tools/ 9.

“The Sleuth Kit,” http://www.sleuthkit.org/

10. “Plaso,” https://github.com/log2timeline/plaso