SlideShare a Scribd company logo
Securing your DevOps Pipeline
Justin Fox, Lead Solutions Architect
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• About NuData Security
• Disclaimer
• Leveraging CI/CD
• Security vs Compliance
• CIS Benchmarks for AWS
Agenda
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Four Integrated Technology Layers:
– Behavioral Biometrics
– Behavioral Analytics
– Device & Access Intel
– Cloud Consortium of Trusted Intelligence
• Quick facts:
– 100 Billion Behavioral Events Monitored Annually
– 4.3 Billion Behavioral Identity Profiles
– 100% Real-time
• Learn how to prevent more fraud: sales@nudatasecurity.com
About NuData Security
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Lead Solutions Architect
– NuData Security’s Platform Team
• Previously:
– DevOps Engineer
– Systems Adminsitrator
• Sometimes more of a Chaos Engineer 
• Website: https://justinfox.me
• Twitter: @666jfox777
About Justin Fox
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• All views expressed in this presentation are my own and do
not represent the opinions of any entity with which I have
been, am now, or will be in the future affiliated with.
• Presentations are intended for educational purposes only and
do not replace independent professional judgment.
• Attendees should note that sessions are audio-recorded and
may be published in various media, including print, audio and
video formats without further notice.
Disclaimer
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• A few terms:
– Continuous Integration
– Continuous Delivery
– Continuous Deployment
– Continuous Release
• AWS Definitions:
– Continuous delivery is a software development methodology where
the release process is automated.
– Continuous integration is a software development practice where
members of a team use a version control system and frequently
integrate their work to the same location, such as a master branch.
What is Continuous [term]
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• What do you automate with Jenkins?
– Deploying AMIs or software updates?
– Creating, updating, deleting CloudFormation stacks?
– Managing Auto Scaling Groups?
– … and otherwise simplify complex tasks through automation
• How do you grant access?
– User / password?
– Hidden behind a VPN?
– 2F MFA?
– Shared service users?
Using Jenkins to Automate AWS Actions
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Sloppy, old, or “legacy” code or
automation scripts
• Old, vulnerable versions of
Jenkins
• Default users, left enabled
• Ex-employee accounts, or
similarly forgotten accounts
• Developers who want to get
work done
• … there might be many ways in,
all that matters is that it
succeeds once!
The Threat(s)
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Jenkins was created using automation
• Administrative user logs in with initial account
– Configures LDAP
• Users add jobs, pipelines, and various configuration
• Months later, the Administrative user walks in one morning…
– All S3 data deleted, instance counts maxed out, limits maxed
out
• … That administrative user never deleted the initial account
• The IAM role on Jenkins let the attacker run random API calls
What if?
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• During all phases of all the projects that you work on, consider the
security aspect.
• Examples:
– “We need a service user…”
– “That’s the vendor’s default account…”
• Consider what permissions you hand out – you never know how
they could be used!
• Remember, you never know where your users/code will end up!
• Set up monitoring and alerting for your AWS accounts!
Consider Security
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Have you heard of:
– CodeCommit?
– CodeBuild?
– CodeDeploy?
– CodePipeline?
– Elastic Beanstalk?
– CloudFormation?
– Lambda?
• The goal is to reduce the
number of permission we give
to Jenkins
• Developers only need limited
permissions => CodeCommit
access!
• Jenkins should only need
limited AWS permissions as
well!
Improving Security using AWS
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• CodeCommit
Developers commit code.
• CodeBuild
Build code artifacts and store them on S3.
• CodeDeploy
Deploy artifacts to instances (AWS or elsewhere)
• CodePipeline
Monitors for changes in each stage and triggers the event.
AWS Developer Tools
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
AWS Developer Tools (graphic)
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Security and compliance are not the same!
– Security protects your information from threats by controlling
how that information is used, consumed and provided.
– Compliance is a demonstration — a reporting function — of
how your security program meets specific security standards
as laid out by regulatory organizations.
• Compliance defines minimum security level!
• You are NOT doing it to impress an auditor; you are doing it to
stop an attacker!
Security vs Compliance
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Compliance Certificates:
– SOC (1,2,3), PCI, ISO 9001 / 27001 / 27017 / 27018
– HIPAA BAA, IRAP, MTCS, C5
– FedRAMP (Moderate / High)
– DoD CC SRG IL2, DoD CC SRG IL4, DoD CC SRG IL5
• See: https://aws.amazon.com/compliance/services-in-scope/
• DoD CC SRG = Department of Defense Cloud Computing Security Requirements Guide
• IRAP = InfoSec Registered Assessors Program
• MTCS = Multi-Tier Cloud Security
• C5 = Cloud Computing Compliance Controls Catalogue
AWS Services Compliance
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
AWS Compliance Examples
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
AWS Service SOC 1, 2, 3 PCI ISO HIPAA BAA C5
IAM √ √ √ √
VPC √ √ √
CloudTrail √ √ √ √
AutoScaling *In Progress*
SNS *In Progress*
SQS √ √ √ √ √
DynamoDB √ √ √ √ √
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• CIS = Centre for Internet Security
• Provides guidance for configuring
security features for a variety of
systems.
• Examples:
– CentOS
– Apache
– AWS
– Etc
• Targets AWS Technologies (in 4
sections):
– IAM
– Config
– CloudTrail
– CloudWatch
– SNS
– S3
– VPC
CIS Benchmarks for AWS
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• There are 24 IAM recommendations
• Benchmark Examples (3/24):
– Ensure multi-factor authentication (MFA) is enabled for all
IAM users that have a console password
– Ensure IAM instance roles are used for AWS resource
access from instances (Not Scored)
– Ensure IAM policies that allow full "*:*" administrative
privileges are not created
IAM
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• There are 8 Logging recommendations
• Benchmark Examples (3/8):
– Ensure CloudTrail is enabled in all regions
– Ensure AWS Config is enabled in all regions
– Ensure CloudTrail logs are encrypted at rest using KMS
CMKs
Logging
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• There are 15 Monitoring recommendations
• Benchmark Examples (3/15):
– Ensure a log metric filter and alarm exist for unauthorized
API calls
– Ensure a log metric filter and alarm exist for Management
Console sign-in without MFA
– Ensure a log metric filter and alarm exist for usage of "root"
account
• Note: some AWS services may show as the ”root” account
Monitoring
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• There are 5 networking recommendations
• Benchmark Examples (3/5):
– Ensure no security groups allow ingress from 0.0.0.0/0 to
port 22
– Ensure no security groups allow ingress from 0.0.0.0/0 to
port 3389
– Ensure VPC flow logging is enabled in all VPCs
Networking
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
Ok, now what?
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• AWS Config Rules  We’re going to talk about this one
• AWS Partners:
– https://www.alertlogic.com/
– https://evident.io/cloud-security-compliance-for-aws/
– https://www.threatstack.com/
• Monitoring system?
– Nagios, Zabbix, Sensu, etc.?
How to Monitor / Enforce?
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Generally used to target specific resource types
• Examples:
– IAM Users MFA Enabled
– VPC Flow Logging Enabled
– S3 Buckets have Access Logs
AWS Config Rules: Triggered Rules
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Called “Periodic”.
• Generally used to target GLOBAL resources.
• Examples:
– Root Account MFA Enabled
– CloudTrail Enabled
– Config Enabled
– CloudTrail Log Encryption Enabled
AWS Config Rules: Scheduled Rules
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
1. COMPLIANT
2. NON_COMPLIANT
3. NOT_APPLICABLE
• If you’re seeing a lot of “NOT_APPLICABLE”, adjust your rule.
– It’s costing you money.
AWS Config Rules: Result States
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Time for some technical
examples!
• AWS Config Rules is used to
provide a dashboard overview
and manage alert
configuration
• AWS Config Rules allows for
Triggered and Scheduled
rules
• AWS Lambda is my tool of
choice for detection /
remediation
Examples:
1. Ensure multi-factor
authentication (MFA) is
enabled for all IAM users
that have a console
password
2. Ensure CloudTrail is enabled
in all regions
3. Ensure VPC flow logging is
enabled in all VPCs
Examples
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
if (resourceType == 'AWS::IAM::User') {
iam.listMFADevices({ UserName:
invokingEvent.configurationItem.resourceName }, function(err, mfa) {
var compliance = 'NON_COMPLIANT';
if (!err) {
if (mfa.MFADevices.length > 0) {
compliance = 'COMPLIANT';
}
} else {
console.log(err);
}
putEval(event,context,resType,resId,compliance,timestamp);
});
} else {
putEval(event,context,resType,resId,'NOT_APPLICABLE',timestamp);
}
Example #1 – MFA for IAM Users
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
readSnapshot(s3, s3key, s3bucket, function(err, snapshot) {
if (err === null) {
var compliance = 'NON_COMPLIANT';
for (var i = 0; i < snapshot.configurationItems.length; i++) {
var item = snapshot.configurationItems[i];
if (item.resourceType === 'AWS::CloudTrail::Trail') {
if (item.configuration.isMultiRegionTrail) {
compliance = 'COMPLIANT';
}
}
}
putEval(event,context,resType,resId,compliance,timestamp);
} else {
context.fail(err);
}
});
Example #2 – AWS CloudTrail Enabled
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
ec2.describeFlowLogs(
{ Filter: [ { Name: 'resource-id', Values: [ resourceId ] } ]
},
function(err, data) {
var compliance = 'NON_COMPLIANT';
if (!err) {
if (data.FlowLogStatus == 'ACTIVE') {
compliance = 'COMPLIANT';
}
}
putEval(event,context,resType,resId,compliance,timestamp);
});
Example #3 – VPC Flow Logging
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
Example #4 – AWS Config Rules
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
Example #4 – AWS Config Rules
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Note: Time dependant, don’t worry folks links at the end for
walkthroughs and examples!
• CodeCommit => CodeBuild => CodeDeploy w/ CodePipeline
• Config Rules + Dashboard
Demo
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
Wrap Up
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• Tryout CodePipeline for your CI/CD pipeline
• Add auto remediation to the AWS Config Rules example
– E.g.: Disable IAM user keys when they expire.
• Use AWS CloudWatch Events to intercept API calls
– E.g.: Don’t allow AWS CloudTrail to be disabled!
• Use AWS CloudWatch Events like CROND.
• Use AWS Service Catalog to provide AWS CloudFormation Templates for
reuse
• If you enjoyed this session, be sure to check out my blog:
https://justinfox.me/
Follow-up
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments
• For today’s slides:
https://justinfox.me/articles/devopscloudsummit-toronto-2017
• Related Blog Posts:
https://justinfox.me/articles/compliance-with-aws-config
https://justinfox.me/articles/aws-developer-tools-for-cicd
• Github Repository:
https://github.com/666jfox777/aws-config-rules-template
https://github.com/666jfox777/aws-codepipeline-example
Questions
SECURING YOUR DEVOPS PIPELINE ON AWS
DevOps Cloud Summit – Toronto 2017
Thank You!

More Related Content

PPTX
Dan Crawford - Canadian Executive Cloud & DevOps Summit Presentation
PPTX
Darin Briskman_Amazon_June_9_2017_Presentation
PPTX
Eric_Gales_Amazon_June_9_2017_presentation
PPTX
Virtual Desktops on AWS by Mike Burke, Farm Credit Canada
PDF
DevOps in the Amazon Warehouse - Shawn Gandhi
PDF
Staying Secure When Moving to the Cloud - Dave Millier
PPTX
Top 10 AWS Security and Compliance best practices
PPTX
Multi cloud governance best practices - AWS, Azure, GCP
Dan Crawford - Canadian Executive Cloud & DevOps Summit Presentation
Darin Briskman_Amazon_June_9_2017_Presentation
Eric_Gales_Amazon_June_9_2017_presentation
Virtual Desktops on AWS by Mike Burke, Farm Credit Canada
DevOps in the Amazon Warehouse - Shawn Gandhi
Staying Secure When Moving to the Cloud - Dave Millier
Top 10 AWS Security and Compliance best practices
Multi cloud governance best practices - AWS, Azure, GCP

More from TriNimbus (16)

PDF
Convergence of Containers and Serverless by Mency Woo
PPTX
Juni_Mukherjee_The_DevSecOps_Journey_AntiPatterns_Analytics_and_Insights
PPTX
Teri_Radichel_Top_5_Priorities_for_Cloud_Security
PPTX
Peter_Smith_PhD_ACL_10000_Foot_View_of_Big_Data
PPTX
Darin_Briskman_AWS_Machine_Learning_Beyond_the_Hype
PDF
Amazon Elastic Container Service for Kubernetes (EKS), AWS Fargate and Beyond
PDF
Using Active Directory in AWS
PDF
AWS 2017 re:Invent re:Cap - TriNimbus Presentation Slides
PPTX
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
PPTX
Building and Operating AI Services at Scale by Randall Hunt, Amazon Web Services
PDF
Web App Security Presentation by Ryan Holland - 05-31-2017
PDF
VMware + Amazon Web Services
PDF
The New Normal - Eric Gales, AWS Canada
PDF
Goran (Kima) Kimovski, Beyond Virtualization: IT In a World of Software Defin...
PDF
Darragh Kennedy, Build Products Not Data Centres
PDF
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Convergence of Containers and Serverless by Mency Woo
Juni_Mukherjee_The_DevSecOps_Journey_AntiPatterns_Analytics_and_Insights
Teri_Radichel_Top_5_Priorities_for_Cloud_Security
Peter_Smith_PhD_ACL_10000_Foot_View_of_Big_Data
Darin_Briskman_AWS_Machine_Learning_Beyond_the_Hype
Amazon Elastic Container Service for Kubernetes (EKS), AWS Fargate and Beyond
Using Active Directory in AWS
AWS 2017 re:Invent re:Cap - TriNimbus Presentation Slides
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Building and Operating AI Services at Scale by Randall Hunt, Amazon Web Services
Web App Security Presentation by Ryan Holland - 05-31-2017
VMware + Amazon Web Services
The New Normal - Eric Gales, AWS Canada
Goran (Kima) Kimovski, Beyond Virtualization: IT In a World of Software Defin...
Darragh Kennedy, Build Products Not Data Centres
Chris Munns, DevOps @ Amazon: Microservices, 2 Pizza Teams, & 50 Million Depl...
Ad

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
Teaching material agriculture food technology
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
The AUB Centre for AI in Media Proposal.docx
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
GamePlan Trading System Review: Professional Trader's Honest Take
“AI and Expert System Decision Support & Business Intelligence Systems”
Understanding_Digital_Forensics_Presentation.pptx
Teaching material agriculture food technology
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
cuic standard and advanced reporting.pdf
madgavkar20181017ppt McKinsey Presentation.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Ad

Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation

  • 1. Securing your DevOps Pipeline Justin Fox, Lead Solutions Architect
  • 2. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • About NuData Security • Disclaimer • Leveraging CI/CD • Security vs Compliance • CIS Benchmarks for AWS Agenda SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 3. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Four Integrated Technology Layers: – Behavioral Biometrics – Behavioral Analytics – Device & Access Intel – Cloud Consortium of Trusted Intelligence • Quick facts: – 100 Billion Behavioral Events Monitored Annually – 4.3 Billion Behavioral Identity Profiles – 100% Real-time • Learn how to prevent more fraud: [email protected] About NuData Security SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 4. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Lead Solutions Architect – NuData Security’s Platform Team • Previously: – DevOps Engineer – Systems Adminsitrator • Sometimes more of a Chaos Engineer  • Website: https://justinfox.me • Twitter: @666jfox777 About Justin Fox SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 5. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • All views expressed in this presentation are my own and do not represent the opinions of any entity with which I have been, am now, or will be in the future affiliated with. • Presentations are intended for educational purposes only and do not replace independent professional judgment. • Attendees should note that sessions are audio-recorded and may be published in various media, including print, audio and video formats without further notice. Disclaimer SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 6. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • A few terms: – Continuous Integration – Continuous Delivery – Continuous Deployment – Continuous Release • AWS Definitions: – Continuous delivery is a software development methodology where the release process is automated. – Continuous integration is a software development practice where members of a team use a version control system and frequently integrate their work to the same location, such as a master branch. What is Continuous [term] SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 7. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • What do you automate with Jenkins? – Deploying AMIs or software updates? – Creating, updating, deleting CloudFormation stacks? – Managing Auto Scaling Groups? – … and otherwise simplify complex tasks through automation • How do you grant access? – User / password? – Hidden behind a VPN? – 2F MFA? – Shared service users? Using Jenkins to Automate AWS Actions SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 8. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Sloppy, old, or “legacy” code or automation scripts • Old, vulnerable versions of Jenkins • Default users, left enabled • Ex-employee accounts, or similarly forgotten accounts • Developers who want to get work done • … there might be many ways in, all that matters is that it succeeds once! The Threat(s) SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 9. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Jenkins was created using automation • Administrative user logs in with initial account – Configures LDAP • Users add jobs, pipelines, and various configuration • Months later, the Administrative user walks in one morning… – All S3 data deleted, instance counts maxed out, limits maxed out • … That administrative user never deleted the initial account • The IAM role on Jenkins let the attacker run random API calls What if? SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 10. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • During all phases of all the projects that you work on, consider the security aspect. • Examples: – “We need a service user…” – “That’s the vendor’s default account…” • Consider what permissions you hand out – you never know how they could be used! • Remember, you never know where your users/code will end up! • Set up monitoring and alerting for your AWS accounts! Consider Security SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 11. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Have you heard of: – CodeCommit? – CodeBuild? – CodeDeploy? – CodePipeline? – Elastic Beanstalk? – CloudFormation? – Lambda? • The goal is to reduce the number of permission we give to Jenkins • Developers only need limited permissions => CodeCommit access! • Jenkins should only need limited AWS permissions as well! Improving Security using AWS SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 12. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • CodeCommit Developers commit code. • CodeBuild Build code artifacts and store them on S3. • CodeDeploy Deploy artifacts to instances (AWS or elsewhere) • CodePipeline Monitors for changes in each stage and triggers the event. AWS Developer Tools SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 13. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments AWS Developer Tools (graphic) SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 14. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Security and compliance are not the same! – Security protects your information from threats by controlling how that information is used, consumed and provided. – Compliance is a demonstration — a reporting function — of how your security program meets specific security standards as laid out by regulatory organizations. • Compliance defines minimum security level! • You are NOT doing it to impress an auditor; you are doing it to stop an attacker! Security vs Compliance SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 15. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Compliance Certificates: – SOC (1,2,3), PCI, ISO 9001 / 27001 / 27017 / 27018 – HIPAA BAA, IRAP, MTCS, C5 – FedRAMP (Moderate / High) – DoD CC SRG IL2, DoD CC SRG IL4, DoD CC SRG IL5 • See: https://aws.amazon.com/compliance/services-in-scope/ • DoD CC SRG = Department of Defense Cloud Computing Security Requirements Guide • IRAP = InfoSec Registered Assessors Program • MTCS = Multi-Tier Cloud Security • C5 = Cloud Computing Compliance Controls Catalogue AWS Services Compliance SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 16. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments AWS Compliance Examples SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017 AWS Service SOC 1, 2, 3 PCI ISO HIPAA BAA C5 IAM √ √ √ √ VPC √ √ √ CloudTrail √ √ √ √ AutoScaling *In Progress* SNS *In Progress* SQS √ √ √ √ √ DynamoDB √ √ √ √ √
  • 17. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • CIS = Centre for Internet Security • Provides guidance for configuring security features for a variety of systems. • Examples: – CentOS – Apache – AWS – Etc • Targets AWS Technologies (in 4 sections): – IAM – Config – CloudTrail – CloudWatch – SNS – S3 – VPC CIS Benchmarks for AWS SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 18. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • There are 24 IAM recommendations • Benchmark Examples (3/24): – Ensure multi-factor authentication (MFA) is enabled for all IAM users that have a console password – Ensure IAM instance roles are used for AWS resource access from instances (Not Scored) – Ensure IAM policies that allow full "*:*" administrative privileges are not created IAM SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 19. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • There are 8 Logging recommendations • Benchmark Examples (3/8): – Ensure CloudTrail is enabled in all regions – Ensure AWS Config is enabled in all regions – Ensure CloudTrail logs are encrypted at rest using KMS CMKs Logging SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 20. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • There are 15 Monitoring recommendations • Benchmark Examples (3/15): – Ensure a log metric filter and alarm exist for unauthorized API calls – Ensure a log metric filter and alarm exist for Management Console sign-in without MFA – Ensure a log metric filter and alarm exist for usage of "root" account • Note: some AWS services may show as the ”root” account Monitoring SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 21. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • There are 5 networking recommendations • Benchmark Examples (3/5): – Ensure no security groups allow ingress from 0.0.0.0/0 to port 22 – Ensure no security groups allow ingress from 0.0.0.0/0 to port 3389 – Ensure VPC flow logging is enabled in all VPCs Networking SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 22. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments Ok, now what? SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 23. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • AWS Config Rules  We’re going to talk about this one • AWS Partners: – https://www.alertlogic.com/ – https://evident.io/cloud-security-compliance-for-aws/ – https://www.threatstack.com/ • Monitoring system? – Nagios, Zabbix, Sensu, etc.? How to Monitor / Enforce? SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 24. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Generally used to target specific resource types • Examples: – IAM Users MFA Enabled – VPC Flow Logging Enabled – S3 Buckets have Access Logs AWS Config Rules: Triggered Rules SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 25. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Called “Periodic”. • Generally used to target GLOBAL resources. • Examples: – Root Account MFA Enabled – CloudTrail Enabled – Config Enabled – CloudTrail Log Encryption Enabled AWS Config Rules: Scheduled Rules SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 26. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments 1. COMPLIANT 2. NON_COMPLIANT 3. NOT_APPLICABLE • If you’re seeing a lot of “NOT_APPLICABLE”, adjust your rule. – It’s costing you money. AWS Config Rules: Result States SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 27. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Time for some technical examples! • AWS Config Rules is used to provide a dashboard overview and manage alert configuration • AWS Config Rules allows for Triggered and Scheduled rules • AWS Lambda is my tool of choice for detection / remediation Examples: 1. Ensure multi-factor authentication (MFA) is enabled for all IAM users that have a console password 2. Ensure CloudTrail is enabled in all regions 3. Ensure VPC flow logging is enabled in all VPCs Examples SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 28. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments if (resourceType == 'AWS::IAM::User') { iam.listMFADevices({ UserName: invokingEvent.configurationItem.resourceName }, function(err, mfa) { var compliance = 'NON_COMPLIANT'; if (!err) { if (mfa.MFADevices.length > 0) { compliance = 'COMPLIANT'; } } else { console.log(err); } putEval(event,context,resType,resId,compliance,timestamp); }); } else { putEval(event,context,resType,resId,'NOT_APPLICABLE',timestamp); } Example #1 – MFA for IAM Users SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 29. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments readSnapshot(s3, s3key, s3bucket, function(err, snapshot) { if (err === null) { var compliance = 'NON_COMPLIANT'; for (var i = 0; i < snapshot.configurationItems.length; i++) { var item = snapshot.configurationItems[i]; if (item.resourceType === 'AWS::CloudTrail::Trail') { if (item.configuration.isMultiRegionTrail) { compliance = 'COMPLIANT'; } } } putEval(event,context,resType,resId,compliance,timestamp); } else { context.fail(err); } }); Example #2 – AWS CloudTrail Enabled SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 30. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments ec2.describeFlowLogs( { Filter: [ { Name: 'resource-id', Values: [ resourceId ] } ] }, function(err, data) { var compliance = 'NON_COMPLIANT'; if (!err) { if (data.FlowLogStatus == 'ACTIVE') { compliance = 'COMPLIANT'; } } putEval(event,context,resType,resId,compliance,timestamp); }); Example #3 – VPC Flow Logging SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 31. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments Example #4 – AWS Config Rules SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 32. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments Example #4 – AWS Config Rules SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 33. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Note: Time dependant, don’t worry folks links at the end for walkthroughs and examples! • CodeCommit => CodeBuild => CodeDeploy w/ CodePipeline • Config Rules + Dashboard Demo SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 35. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • Tryout CodePipeline for your CI/CD pipeline • Add auto remediation to the AWS Config Rules example – E.g.: Disable IAM user keys when they expire. • Use AWS CloudWatch Events to intercept API calls – E.g.: Don’t allow AWS CloudTrail to be disabled! • Use AWS CloudWatch Events like CROND. • Use AWS Service Catalog to provide AWS CloudFormation Templates for reuse • If you enjoyed this session, be sure to check out my blog: https://justinfox.me/ Follow-up SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017
  • 36. ©2017 NuData Security Inc., A Mastercard Company. Proprietary.@mastercardnews I #saferpayments • For today’s slides: https://justinfox.me/articles/devopscloudsummit-toronto-2017 • Related Blog Posts: https://justinfox.me/articles/compliance-with-aws-config https://justinfox.me/articles/aws-developer-tools-for-cicd • Github Repository: https://github.com/666jfox777/aws-config-rules-template https://github.com/666jfox777/aws-codepipeline-example Questions SECURING YOUR DEVOPS PIPELINE ON AWS DevOps Cloud Summit – Toronto 2017

Editor's Notes

  • #29: // Description: Checks that all IAM Users have MFA Enabled // Trigger Type: Change Triggered // Scope of Changes: IAM:User // Required Parameter: None function evaluateIamUsersMfaIsEnabled(event,context,resourceType,resourceId,orderingTimestamp){ var invokingEvent = JSON.parse(event.invokingEvent); if (resourceType == 'AWS::IAM::User') { iam.listMFADevices({ UserName: invokingEvent.configurationItem.resourceName }, function(mfaerr, mfadata) { var compliance = 'NON_COMPLIANT'; if (!mfaerr) { if (mfadata.MFADevices.length > 0) { compliance = 'COMPLIANT'; } } else { console.log(mfaerr); } putEvaluation(event,context,resourceType,resourceId,compliance,orderingTimestamp); }); } else { putEvaluation(event,context,resourceType,resourceId,'NOT_APPLICABLE',orderingTimestamp); } }
  • #30: readSnapshot = s3 get object // Description: Checks that a CloudTrail exists that is set to multi-region // Trigger Type: Periodic // Scope of Changes: Global // Required Parameter: None function evaluateCloudTrailIsEnabled(event,context,resourceType,resourceId,orderingTimestamp){ var invokingEvent = JSON.parse(event.invokingEvent); var s3key = invokingEvent.s3ObjectKey; var s3bucket = invokingEvent.s3Bucket; readSnapshot(s3, s3key, s3bucket, function(err, snapshot) { if (err === null) { var compliance = 'NON_COMPLIANT'; for (var i = 0; i < snapshot.configurationItems.length; i++) { var item = snapshot.configurationItems[i]; if (item.resourceType === 'AWS::CloudTrail::Trail') { if (item.configuration.isMultiRegionTrail) { compliance = 'COMPLIANT'; } } } putEvaluation(event,context,resourceType,resourceId,compliance,orderingTimestamp); } else { context.fail(err); } }); }
  • #31: // Checks that all Vpc networks have flow logging enabled. // Trigger Type: Change Triggered // Scope of Changes: AWS::EC2::VPC // Required Parameter: None