การจัดการความมั่นคงปลอดภัย...

68
การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic Container Security) มหาวิทยาลัยบูรพา 35 th WUNCA

Transcript of การจัดการความมั่นคงปลอดภัย...

Page 1: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

การจัดการความมั่นคงปลอดภัยระบบคอนเทนเนอร์เบื้องต้น (Basic Container Security)

มหาวิทยาลัยบูรพา35th WUNCA

Page 2: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Agenda•การรักษาความมั่นคงปลอดภัยของระบบเบื้องต้น•สถาปัตยกรรม คุณลักษณะ วงจรชีวิต และการใช้งานระบบคอนเทนเนอร์•ความเสี่ยงและภัยคุกคามที่พบในการใช้งานระบบคอนเทนเนอร์•Security Benchmark ส าหรับระบบคอนเทนเนอร์•การออกแบบระบบและการใช้งานระบบคอนเทนเนอร์อย่างปลอดภัย

Page 3: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

การรักษาความมั่นคงปลอดภัยของระบบเบื้องต้น

Page 4: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

ความมั่นคงปลอดภัยทางไซเบอร์ หรือ Cybersecurity

• ส าหรับประเทศไทย สถาบันวิชาการป้องกันประเทศ ได้ให้นิยามค าว่า ความมั่นคงปลอดภัย ไซเบอร์ (Cyber Security) คือกระบวนการทั้งหมดที่จ าเป็น เพื่อท าให้องค์กร ปลอดจากความเสี่ยง ความเสียหายที่มีผลต่อข้อมูลข่าวสาร รวมถึงการระวังป้องกันต่อการอาชญากรรม การโจมตี การบ่อนท าลาย การจารกรรม และความผิดพลาดต่าง ๆ โดยค านึงถึงองค์ประกอบพื้นฐานของความปลอดภัยของข้อมูล หรือ CIA คือ การรักษาความลับของข้อมูล (Confidentiality) การรักษาความคงสภาพของข้อมูล ความสมบูรณ์ของข้อมูล (Integrity) และความพร้อมใช้งานของข้อมูล (Availability)• Cybersecurity คือ การป้องกันอันตรายในโลกออนไลน์หรืออินเทอร์เน็ต ที่มีผลกระทบ

ต่อผู้ใช้งานและทรัพย์สินคือ ข้อมูล

Page 5: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

ความมั่นคงปลอดภัยทางไซเบอร์ หรือ Cybersecurity

• Tool • Policy• Security Concepts• Security Safeguard• Guideline• Risk Management • Action• Training• Best Practice• Assurance• Technology

สินทรัพย์ของผู้ใช้งาน สินทรัพย์ขององค์กร

ปกป้องป้องกัน

Page 6: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

ความเสี่ยงล่าสุด และแนวทางปฏิบัติ

• OWASP (The Open Web Application Security Project) Top 10 ปี 2017 รวบรวมความเสี่ยงและแนวทางปฏิบัติล่าสุด เพื่อรับมือกับภัยคุกคามบนเว็บแอพพลิเคชัน โดยแนะน าให้ นักพัฒนาระบบ ผู้ดูแลระบบ ท าการศึกษา เพื่อที่จะไดอ้อกแบบ แอพพลเิคชัน และระบบรักษาความมั่นคงปลอดภัยได้อย่างมปีระสิทธิภาพ• https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project• OWASP ZAP เป็น Open source ส าหรับ Pen Test เพื่อค้นหาช่องโหว่บนเว็บแอพ

พลเิคชันตาม OWASP ส าหรับนักพัฒนาระบบเว็บแอพพลิเคชัน ผู้ดูแลระบบ และนักทดสอบการเจาะระบบ ตรวจสอบและค้นหาช่องโหว่• https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project

Page 7: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

ความเสี่ยงล่าสุด และแนวทางปฏิบัติ

Page 8: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

สถาปัตยกรรม คุณลักษณะ วงจรชีวิต การใช้งานระบบคอนเทนเนอร์

•Container เป็นเทคโนโลยีที่นักพัฒนาระบบให้ความสนใจเป็นอย่างมากในช่วงนี้ เพื่อช่วยให้นักพัฒนาสามารถออกแบบแอพพลิเคชันบน Container ได้อย่างมั่นคงปลอดภัย จึงน าเสนอประเด็นด้านความมั่นคงปลอดภัยเกี่ยวกับ Container และแนวทางปฏิบัติที่แนะน าให้น าไปใช้ขณะวางแผน ใช้งาน ดูแลรักษาระบบที่ใช้ Container •LXC = Linux Containers•Docker = Commodity Container

Page 9: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Virtual Machine and Container Architectures

Page 10: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Container Lifecycle Phases

Page 11: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Container Technology Stack

Page 12: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

ความเสี่ยงและภัยคุกคามที่พบในการใช้งานระบบคอนเทนเนอร์

•ความเสี่ยงใน Container Stack •Operational Differences Between Containers and VMs•Host OS Risks•Container Runtime Risks• Image Risks•Registry Risks•Orchestrator Risks

Page 13: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secure ?

•Applications Deployed in Containers more Secure ?•No Automated Security Updates•Security Control from Operation to Developer •Multiple App on Host OS

Page 14: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security - Best Practices

• Have separate containers for each micro-service keeping Container image size small.• Don’t put ssh inside container, “docker exec” can be used to ssh to Container.• Use only signed Container images. • Mount devices and volumes as read-only.• Run application as non-root. If root access is needed, run as root only for limited operations using features like

Capabilities, Seccomp, SELinux/AppArmor.• Keep OS secure with regular updates. Using Container optimized OS is an option here since they provide automatic

pushed update.• Store root keys, passphrase in a safe place and not expose in Dockerfile. Docker has plans to manage keys with Docker

datacenter.• Use Docker official images. These images are curated by Docker so that the highest quality and security is maintained

for the official images.• Use Container security scanning to check for vulnerabilities.• Use TLS for remote Docker daemon access.Ref.: Docker Security Overview from Sreenivas Makam

Page 15: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security

• Content Trust• Content Trust Basics• Secrets Management• Secrets Management with Docker Datacenter• Secure Networking Basics• Security Scanning• Swarm Mode Security Basics

Page 16: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security (Linux Docker Host)

•AppArmor•Capabilities•Control Groups•Seccomp•User Namespaces

Page 17: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Benchmark

• Open-source tool for running automated tests • Runs against containers currently running on same host• Runs against containers currently running on same host

Page 18: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Benchmark

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

docker run -it --net host --pid host --cap-add audit_control \-e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \-v /var/lib:/var/lib \-v /var/run/docker.sock:/var/run/docker.sock \-v /usr/lib/systemd:/usr/lib/systemd \-v /etc:/etc --label docker_bench_security \docker/docker-bench-security

Page 19: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

การออกแบบระบบและการใช้งานระบบคอนเทนเนอร์อย่างปลอดภัย

• นโยบายการรักษาความปลอดภัย container technology stack• Initiation Phase• Planning and Design Phase• Implementation Phase• Operations and Maintenance Phase

Page 20: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

การออกแบบระบบและการใช้งานระบบคอนเทนเนอร์อย่างปลอดภัย

• ปรับนโยบายด้าน Security ที่มีอยู่เดิมให้สอดคล้องกับการใช้ Container ใน DevOps• เช่น อาจต้องมีการปรับนโยบายเรื่องการตอบสนองต่อเหตุการณ์ และการจัดการช่องโหว่ที่

เกิด• การใช้ Container ต้องปรับให้เข้ากับการพัฒนาระบบแบบเดิมได้อย่างไม่ติดขัด• การศึกษาและการฝึกอบรมส าหรับวงจรชีวิตการพัฒนาซอฟต์แวร์ ทั้ง DevOps ได้• เตรียม Forensics ส าหรับ OS และ Container มีความจ าเป็นกับ Planning and Design• เตรียมแบบจ าลองก่อนใช้งานระบบจริงเพื่อลดผลกระทบให้น้อยที่สุด• Updating Images

Page 21: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security Checklist• Build

• Use minimal images (alpine)• Use official images• Using images pulled by content trust (fresh, pulled by digest from authors you trust)

• Ship• Use minimal images (alpine)• Use official images• Using images pulled by content trust (fresh, pulled by digest from authors you trust)

• Run• Mutual TLS between client/engine• Read-only volumes and containers• User namespaces in the daemon• Limit resources with cgroups• Use the default apparmor/seccomp/capabilities, or your own tested profiles (not --privileged!)

Page 22: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Basic Container SecurityLAB

มหาวิทยาลัยบูรพา35th WUNCA

Page 23: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker aims to be Secure by Default

• Docker’s approach to secure by default• Apparmor - AppArmor is a Linux kernel security module.• Seccomp - kernel module that acts like a firewall for syscalls.• Capabilities - slice root privileges into smaller chunks.

•https://docs.docker.com/engine/security/non-events/

Page 24: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security Technologies

•Content Trust•Secrets Management•Security Scanning•Swarm Mode Security Basics•Secure Networking Basics

Page 25: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Security (Linux Docker Host)

•AppArmor•Capabilities•Control Groups•Seccomp•User Namespaces

Page 26: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Distribution and Trust• การตรวจสอบความถูกต้องว่าImage ไม่ได้ถูกแก้ไข ก่อนที่จะ

Push Image ไปที่ Registry ตัว Docker Engine จะเซ็นก ากับไว้ เมื่อสั่ง PullImages จะถูกตรวจสอบความถูกต้องก่อน

Page 27: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Distribution and Trust

•Provenance•Verify the publisher of the image

•Trust•Verify the integrity of the image

Page 28: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Distribution and Trust

•Securing image distribution. We'll start with a simple docker pull and build up to using Docker Content Trust (DCT).

Page 29: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Pulling by tag•$ docker pull alpine:latest•Name resolution takes place in registry to find content-address of

image

•$ docker pull alpine•Using default tag: latest•Notice that the tag defaults to latest if no tags are given!

Page 30: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Pulling by digest

•$ docker pull alpine@sha256:ea0d1389812...•No name resolution!

•Security best practice: pulling by digest to enforce consistent and “immutable” pulls because of content-addressability

Page 31: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Content Trust

•$ export DOCKER_CONTENT_TRUST=1•$ docker pull alpine:latest•Pull (1 of 1): alpine:latest@sha256:ea0d1389...•Benefits of pull by digest with ease of pull by tag

Page 32: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Content Trust (on push)

• $ export DOCKER_CONTENT_TRUST=1• $ docker tag alpine:latest <user>/alpine:trust• $ docker push <user>/alpine:trust

• Looks the same as a regular push by tag!

Page 33: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Notary Threat Model

• The Notary project comprises a server and a client for running and interacting with trusted collections. Please see the service architecture documentation for more information.• https://github.com/docker/notary

Page 34: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Content Trust Lab: Official images

•All images in Docker Hub under the library organization (https://hub.docker.com/explore/) are "Official Images."

Page 35: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Lab1 Content Trust

• Docker Content Trust Basics

• https://github.com/docker/labs/blob/master/security/trust-basics/

Page 36: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Scanning

•Tool/service that scans images for vulnerabilities• Operates in the background• Performs deep binary-level scanning of image layers• Checks against databases of known vulnerabilities• Provides detailed vulnerability report• Helps protect software and achieve software compliance• Strong Vulnerability Detection

Page 37: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Scanning

Page 38: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Scanning

• ระบบที่ช่วยแสกนความปลอดภัยของ Container ที่น ามาใช้งาน โดย Docker Security Scanning แสกน Image ได้ในระดับ Binary Level เพื่อหาช่องโหว่ นอกจากนี้ยังสามารถตรวจสอบ Packages ที่ใช้งานใน Image นั้นๆ กับฐานข้อมูลความปลอดภัย CVE เพื่อคอยแจ้งเตือนช่องโหว่ที่มีให้กับผู้ใช้งานอีกด้วย

Page 39: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Scanning Offerings

Page 40: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Security Scanning: Vulnerability Reports

Page 41: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Lab2

•Security Scanning•https://github.com/docker/labs/blob/master/security/scanning/

Page 42: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secrets Management

• Secret Management ผู้ใช้งานสามารถเก็บข้อมูลที่เป็นความลับ เช่น Password Certificate ในระบบได้ง่าย รองรับการท า Lifecycle Management รวมถึงมีระบบ Audit Log ส าหรับตรวจสอบ

Page 43: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode Security Basics

• Swarm

Page 44: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode: Native clustering of Docker Hosts

• One or more Managers (control plane)• One or more Workers (data plane) Run user workloads• Strong default security

Page 45: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode: Client Certificates

Page 46: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode: Cryptographic Guarantees

Page 47: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Creating a New Swarm

Page 48: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Using and External Root CA

• Swarm supports using external CA

• Pass the --external-ca flag to the docker swarm init command

Page 49: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Adding More Managers

Page 50: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Adding Workers

Page 51: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Protect your Join Tokens

• Only approved nodes should be allowed to join your Swarm!

• To join a Swarm as a manager, a node must specify the manager join token. Keep it safe!

• To join a Swarm as a worker, a node must specify the worker join token. Keep it safe!

• You can rotate join tokens with:

$ docker swarm join-token --rotate worker|manager

docker swarm join \> --token SWMTKN-1-31fx-bz14... \> 172.31.45.44:2377This node joined a swarm as a worker.

Page 52: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode: Client Certificates

Page 53: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Mode: Client Certificates

Page 54: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Swarm Info

The docker info commandcan be used to displayinformation about the Swarmthat a node belongs to.

Some security related itemsare shown in yellow

Page 55: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Simple Certificate Rotation

Automatic client certificate

rotation

• defaults to 90 days

• Customizable

Swarm operates a whitelist of

valid certificates

Renewal times are randomized toprevent overloading the CA

Name: manager1ID (CN): ofcm6bdy5qcrlievawsw9wqfpSwarm (O): lgz5xj1eqg4pcd0bib75i4fhdRole (OU): swarm-managerNot before: Mar 9 15:21:00 2017 GMTNot after: Jun 7 16:21:00 2017 GMTsha256: hxi3…

Page 56: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Certificate Rotation

• Only client certificates can be rotated*

• Use the --cert-expiry flag to change the rotation period

• The following command will build a Swarm that rotates client

certificates every 30 days

docker swarm init --cert-expiry 720h0m0s

• The following command updates a Swarm to rotate client

certificates every 60 days

docker swarm update --cert-expiry 1440h

Page 57: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Swarm Security

Page 58: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Lab3 Swarm Mode Security

• Building A Secure Swarm

• https://github.com/docker/labs/blob/master/security/swarm/

Page 59: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

AppArmor

• AppArmor (Application Armor) is a Linux Security Module (LSM). It protects the operating system by applying profiles to individual applications or containers. In contrast to managing capabilities with CAP_DROP and syscalls with seccomp, AppArmor allows for much finer-grained control. For example, AppArmor can restrict file operations on specified paths.

• เป็นสว่นท่ีใช้ในการเสริมการรักษาความปลอดภยัของLinux (คล้ายกบั SELinux)

Page 60: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Linux Kernel Capabilities

• The Unix world has traditionally divided process into two categories:

– Privileged (root)

– Unprivileged (non-root)

• Modern Linux kernels slice root privileges into smaller chunks called

capabilities.

– It is now possible to assign some root privileges to a process without assigning them all.

Net result = reduced attack surface

Page 61: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker and Capabilities

• Docker operates a whitelist approach to implementing capabilities.

• If a capability isn’t on the whitelist it is dropped.

• The list on the right shows the current capabilities whitelist for the

default profile.

Page 62: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker and Capabilities

• You can use the --cap-add and --cap-drop flags to add an remove capabilities from a container.

$ docker container run --rm -it --cap-drop NET_BIND_SERVICE alpine sh

$ docker container run --rm -it \

--cap-drop ALL --cap-add NET_BIND_SERVICE \

alpine sh

$ docker container run --rm -it \

--cap-add CHOWN \

alpine sh

Page 63: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Docker Bench Audit Your Docker Security

• Open-source tool for running automated tests• Inspired by the CIS Docker 1.13 benchmark

• Regularly updated

• Checks Docker host

• Runs against containers on same host

• Checks for AppArmor, read-only volumes, etc...

• https://dockerbench.com

Page 64: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secure Networks

• Networking is integral to distributed applications.

• Networking is hard, vast, and complex!

• Goal: Docker networking SIMPLE and SECURE.

Page 65: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secure Networking: Container to Container

• Control Plane : Encrypted by default• AES (GCM)

• Keys rotated every 12 hours

• Data Plane : Can be easily encrypted

--opt encrypted• AES (GCM)

• Keys rotated every 12 hours

• $ docker network create -d overlay --opt encrypted my-net

Page 66: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secure Networking : Isolation

• Micro segmentation

• Containers can only talk to other containers on the same network

• Containers cannot automatically discover services and containers on

other networks

Page 67: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Secure Networking : Avoid

• Container to see all networking traffic on the Docker Host

$ docker container run --rm -it \

--net=host \

alpine sh

Page 68: การจัดการความมั่นคงปลอดภัย ระบบคอนเทนเนอร์เบื้องต้น (Basic ... · Swarm Mode: Native

Lab4 : Secure Networking

• https://github.com/docker/labs/blob/master/security/networking/