Slide 1

Slide 1 text

Securing Drupal on Kubernetes Sydney Drupal Meetup - March 2020

Slide 2

Slide 2 text

Disclaimers * Presentation not finished - DrupalCon postponed :( * Assumes knowledge of infrastructure and Kubernetes concepts * Not a comprehensive guide to security on Kubernetes

Slide 3

Slide 3 text

Stop the Boats Bots

Slide 4

Slide 4 text

Web Application Firewall (WAF) ● Configure rules to identify malicious requests. ● Analyse incoming requests against configured rules. ● Block matching requests.

Slide 5

Slide 5 text

Web Application Firewall (WAF) ● Block common paths for other frameworks /wp-admin.php *.aspx *.cgi /autodiscover/autodiscover.xml ● Managed Rules (eg OWASP Top 10) ● Drupal Steward(?)

Slide 6

Slide 6 text

Web Application Firewall (WAF) ● AWS WAF ○ https://aws.amazon.com/waf/ ● CloudFlare WAF ○ https://www.cloudflare.com/waf/ ○ https://www.videodrupal.org/video/20190707/sean-hamlin-securing-your-drupal-site-clou dflare ● Google Cloud Armor ○ https://cloud.google.com/armor

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Encryption at Rest ● Public Files ● Private Files ● Database Volume ● Backups

Slide 9

Slide 9 text

Encryption at Rest - S3 Server-Side Encryption ● Pros ○ Easy to setup and use ○ No need to manage keys yourself ○ Good level of protection ● Cons ○ Might not satisfy security requirements of your org. Client-Side Encryption ● Pros ○ Flexibility ○ Portable - can be used on other blob storage services ● Cons ○ Key management is up to you ○ Don’t roll your own crypto...

Slide 10

Slide 10 text

Server-Side Encryption https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncrypti on.html Client-Side Encryption https://github.com/jedisct1/libsodium Encryption at Rest - S3

Slide 11

Slide 11 text

Encryption at Rest - EFS https://docs.aws.amazon.com/efs/latest/ug/encryption-at-rest.html

Slide 12

Slide 12 text

Encryption at Rest - RDS https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encry ption.html

Slide 13

Slide 13 text

Encryption in Transit ● Incoming HTTP requests ● Connections to database ● Connections to ancillary services - redis, solr, clamd

Slide 14

Slide 14 text

Encryption in Transit - DB Connections settings.php https://www.previousnext.com.au/blog/encrypted-drupal-database-connections-amazon-rds $rds_cert_path = "/etc/ssl/certs/rds-combined-ca-bundle.pem"; if (is_readable($rds_cert_path)) { $databases['default']['default']['pdo'][PDO::MYSQL_ATTR_SSL_CA] = $rds_cert_path; }

Slide 15

Slide 15 text

Encryption in Transit - Incoming HTTP Requests

Slide 16

Slide 16 text

Encryption in Transit - Ancillary Services

Slide 17

Slide 17 text

Encryption in Transit - Options Service Mesh ● Pros ○ Encryption everywhere! ● Cons ○ Setup and maintenance ○ Additional TCP hops / latency ○ Additional resources to run sidecars DIY Certificates ● Pros ○ “Simpler” system ● Cons ○ Only encrypts a single hop - ingress to app ○ Manage certificates yourself

Slide 18

Slide 18 text

Service Meshes

Slide 19

Slide 19 text

Navigating the Service Mesh Landscape - Paul Bower https://www.youtube.com/watch?v=ZykpIhy6FHo Service Meshes

Slide 20

Slide 20 text

Navigating the Service Mesh Landscape - Paul Bower https://www.youtube.com/watch?v=ZykpIhy6FHo Service Meshes

Slide 21

Slide 21 text

Open Policy Agent

Slide 22

Slide 22 text

Validates objects in kubernetes API meet rules specified in policy documents. ● Ensure images come from a trusted registry only. ● Ensure images run as non-root users. ● Ensure hostnames in ingress rules are allowed. ● So much more! Open Policy Agent (OPA)

Slide 23

Slide 23 text

Open Policy Agent (OPA)

Slide 24

Slide 24 text

Runtime Monitoring / Anomaly Detection

Slide 25

Slide 25 text

Monitors your running containers for all kinds of nefarious things. Uses BPF to monitor syscalls ● Unexpected processes ○ Breaking into a shell ○ Cryptominers ○ RCE ● Unexpected users ● Lots of other good stuff Runtime Monitoring

Slide 26

Slide 26 text

● Sysdig Falco - https://github.com/falcosecurity/falco Runtime Monitoring

Slide 27

Slide 27 text

Read-Only Filesystems

Slide 28

Slide 28 text

Stops: ● Developers changing files in the container to “hotfix” problems. ● Many classes of attacks where files are added or modified for arbitrary code execution. Read-Only Filesystems

Slide 29

Slide 29 text

Read-Only Filesystems

Slide 30

Slide 30 text

Images

Slide 31

Slide 31 text

Scans images for vulnerable OS packages and project dependencies. Put in your CICD Pipeline & regularly scheduled builds ● AquaSec Trivy https://github.com/aquasecurity/trivy ● Clair https://github.com/quay/clair Image Vulnerability Scanning

Slide 32

Slide 32 text

Ensures an attacker has not modified an image. ● Notary https://github.com/theupdateframework/notary ● Portieris https://github.com/IBM/portieris Image Signing & Notaries

Slide 33

Slide 33 text

Thanks!

Slide 34

Slide 34 text

Web Application Firewall Configuration Encryption Packaging Runtime