SlideShare uma empresa Scribd logo
1 de 28
It’s More Ops Than You Think
June 2018
Bob Balaban, CA/Veracode
Copyright © 2018 CA. All rights reserved.
Agenda
• The “promise” of serverless
• Veracode Dynamic Analysis
• Replacing a “server” with a “service”
– Advantages
– Dev and DevOps processes
– Demos
– Dev effort summary
– Ops effort summary
• Lessons Learned (including…security!)
• Q & A
Copyright © 2018 CA. All rights reserved.
Advantages of Serverless (from Wayne)
 Automated Scalability
 Built-in Fault Tolerance
 LessOps – No infrastructure to manage
 Lower Cost - Pay only for what you use
 Faster development - Small functions easier to code and business logic focused
 Lower Risk – responsibility transferred to provider
 Integrated security – No patching, remote into O/S (SSH/RDP)
 Automatic logging
We will come back to this later
Copyright © 2018 CA. All rights reserved.
Veracode Dynamic Analysis
• Scans a “target app” (website) looking for security
vulnerabilities
– Cross-site scripting (XSS)
– SQL Injection (SQLi)
– XML External Entity (XXE)
– Remote File Inclusion (RFI)
– OS Command Injection
– Server-side Request Forgery (SSRF)
– Directory Traversal
– …and many more
• See OWASP: http://www.owasp.org
Copyright © 2018 CA. All rights reserved.
How Do We Find Vulnerabilities?
• “Ethical hacking”
• We “attack” the target (in ways that don’t damage data or
functionality)
• If an attack succeeds, we report a vulnerability
– And help you fix it!
• Example: SQL Injection
– “Select (sleep(15)) where true”
– We can tell if it works because the response is sloooowwww
Copyright © 2018 CA. All rights reserved.
What a “callback” server does
1. Scan engine attacks a target app with (ethically)
malicious XML, Javascript, etc.
2. If successful, the attack causes the app to make a call to
the Veracode “callback server”
3. The server records the successful attack
4. The scan engine polls the server later to fetch data on
successful attacks, and reports vulnerabilities
Copyright © 2018 CA. All rights reserved.
Callback Server (“Before”)
Callback
Server
Target App
Scan Engine
1. Inject attack,
e.g., “include remote
PHP file from callback
service”
3. Get results
2. “I was
hacked!”
Copyright © 2018 CA. All rights reserved.
Existing Callback Server
• AWS EC2, golang
• Simple “GET” response to target apps
– Serves static file
– Records successful attacks
• Simple REST API for scanner engine
– Register/unregister scanners
– Fetch successful attack data
– Clean up attack data
• Postgres RDB for attack data
– Auto-purges after 7 days
Copyright © 2018 CA. All rights reserved.
New Callback SERVICE Objectives
Re-architect as “serverless”:
1. Lambda functions only run when invoked
2. AWS API Gateway offloads authorization, firewall and load
balancing
3. DynamoDB nosql database easy to use from lambdas
4. Both Lambda and DynamoDB usage can auto-scale
5. Simplify REST API, otherwise maintain the same interfaces
6. Add some metrics tracking (count of invocations)
Copyright © 2018 CA. All rights reserved.
New Callback Service (“After”)
Callback
Service
Target App
Scan Engine
1. Inject attack
3. Get results
2. “I was
hacked!”
Copyright © 2018 CA. All rights reserved.
Callback Service Components (AWS)
DynamoDb
Query attack info
Capture attacks,
Serve text
A
P
I
G
a
t
e
w
a
y
From target app
From scanner
λ
λ
Copyright © 2018 CA. All rights reserved.
Tour of new Callback Service
Copyright © 2018 CA. All rights reserved.
Advantages of New Architecture
• DynamoDB TTL feature means we can simplify the
service’s REST API
– No need for cleanup calls
– No need for Postgres
• Lambdas do not get billed for idle time
• API Gateway will auto-scale lambda invocations when
needed (no need for auto-scaling groups)
• Logging calls go automatically to CloudWatch
Copyright © 2018 CA. All rights reserved.
Development Process Changes
• Smaller, independent functions (good!)
• No runtime debugging (bad!) – didn’t try Cloud9
– Fallback to “Printf debugging”
– Also required to see what your function is being called with (e.g.,
http event data structure not documented)
• Create AWS resources manually, the first time
– API Gateway (can start with a Swagger definition)
– Lambdas
– IAM
– DynamoDB tables
– S3 (backup Terraform db file)
Copyright © 2018 CA. All rights reserved.
Development Process Changes - 2
• Dev/test cycle
– Make code changes
– Manually (or semi-manually) deploy to AWS
• Need to figure out how to get code from IDE to AWS
• We use gitlab and Terraform
• Terraform can be used locally to push changes to AWS
• (Have to zip .js files first!)
– Test (Postman/curl)
– Commit changes to repo
– Repeat
Copyright © 2018 CA. All rights reserved.
Devops!
• Manual deployment is not sustainable long-term
• Must automate!
• Chose Terraform to script AWS resource
creation/configuration
– Injectable “variables” for AWS keys, config parameters,
environment variables
– Resource dependencies (e.g., create lambdas before api
gateway)
– Incremental changes! (if you keep a copy of the tf db)
• Chose Gitlab for CI/CD scripting
– Triggered on merge to Master branch
– Build zip files, manage Terraform invocation
Copyright © 2018 CA. All rights reserved.
Devops - 2
• Ongoing re-factoring of the project
– When and how to supply production account AWS keys
– Coordinate Gitlab deploys and “legacy” (Bitbucket) builds
– Who decides on gateway “stages”?
• Who monitors the logs?
– Some teams ship their logs to Sumo (more lambdas)
• Who watches scalability of the gateway and lambdas?
• Oh, and who watches cost?
Copyright © 2018 CA. All rights reserved.
Time Commitment – Dev and DevOps
• Dev was about 20% of “time to beta”
• DevOps (pipeline automation, config automation…) was
80%
• Why?
– The pipeline automation tools were new to us, we had to learn
them
– Some AWS features were new
Copyright © 2018 CA. All rights reserved.
Stuff We Had to Learn From Scratch
• API Gateway setup/config
• Lambda deployment/config
– Permissions, environment variables
• Querying DynamoDB efficiently
• Terraform – create/update entire AWS infrastructure
• Gitlab CI tools
Copyright © 2018 CA. All rights reserved.
Skills We Had to Improve
• Node.js
– Coding
– Debugging (via console.log() output, ew)
• Cloudwatch
• IAM for inter-component authorization
– E.g., API Gateway calling Lambda
– Lambda calling Cloudwatch and DynamoDB
• PostMan/curl
– Create http POST and GET tests
Copyright © 2018 CA. All rights reserved.
Recap: Advantages of Serverless
 Automated Scalability √
 Built-in Fault Tolerance √
 LessOps – No infrastructure to manage meh
 Lower Cost - Pay only for what you use √
 Faster development - Small functions easier to code and business logic focused √
 Lower Risk – responsibility transferred to provider meh
 Integrated security – No patching, remote into O/S (SSH/RDP) √
 Automatic logging meh
Copyright © 2018 CA. All rights reserved.
Lessons Learned
• Serverless is great, where appropriate
– Keep it simple
• Figure out the DevOps as you go
– Assume you will automate everything:
• Build
• Unit test
• Deploy
• Integration test
• You will re-factor the project at least as often as you
refactor your code
Copyright © 2018 CA. All rights reserved.
And Oh Yeah, Security!
“Security is like performance, you bolt it on at the end of the project”
Copyright © 2018 CA. All rights reserved.
“Security is like performance, you bolt it on at the end of the project”
(Said no one we want to listen to)
Copyright © 2018 CA. All rights reserved.
Severless Security: Application Dependencies
Application dependencies are going to become one of the main vectors for attackers
to compromise your FaaS infrastructure. It is crucial that you scan third party libraries
for vulnerabilities.
 To drive home that point - a researcher recently found a way to get push rights to over 14% of
NPM Packages and mainstream ones at that, e.g. : debug, request, react, gulp... How? It was a
combination of brute force and credential leaks from GitHub.
 In an evaluation of 1,000 open-source serverless projects, a threat research team revealed that
21% of them contained one or more critical vulnerabilities or misconfigurations, allowing
attackers to manipulate applications and perform various malicious actions.
Mitigations
 Maintaining an inventory list of software packages and other dependencies and their versions
 Scanning libraries for known vulnerable dependencies. Vulnerability scanning should be done as
part of your ongoing CI/CD process
Copyright © 2018 CA. All rights reserved.
Serverless Security: At-Rest and In-Transit equally vulnerable!
Serverless exudes a false sense of security due to secure API calls and encrypted
databases.
1. OWASP top 10 is still as relevant as ever!
2. SQL injection and other forms of injection attacks are still possible in the
serverless world, as are cross-site scripting attacks.
3. Keep your secrets in an Key Management System, not code.
4. Ensure your services have the least amount of privilege to read/write to your
databases.
5. Use direct/private connections between your VPCs and Databases wherever
possible.
Mitigations
 Always use safe APIs that either sanitize or validate user input, or APIs which provide a
mechanism for binding variables or parameterizing them for underlying infrastructure (e.g.
stored procedures or prepared statements in the case of SQL queries)
 Always use safe APIs that either sanitize or validate user input, or APIs which provide a
mechanism for binding variables or parameterizing them for underlying infrastructure.
Copyright © 2018 CA. All rights reserved.
Severless Security: Monitoring becomes extremely important
The one thing that the advent of serverless has made more difficult is monitoring and the
lack of understanding of security implications for various serverless assets.
 Logging is key. Ensure you have CloudTrail enabled on all accounts for all regions. Don’t
assume a developer or malicious actor won’t create an asset outside of us-east-1.
 The days of agents are gone! You now have to use platform-specific tools to monitor…
 …using Cloudwatch Metrics (with alarms) to monitor resources and set limits on either calls or
spend. When alerted, investigate when/why those limits are being exceeded.
 If you have a SIEM Tool or a 3rd-party monitoring service, send CloudWatch/Cloudtrail logs to
their services to be monitored. You’ll be amazed at what is already actively scanning your
public assets.
 RYOM – (rolling your own monitoring) – Lambda’s written in Python using the Boto SDK are
extremely powerful to monitor/modify your assets and alert based on customized parameters.
e.g. - A developer adds their home ip address to connect to an asset for debugging
from home, but a metric was defined to only allow connections of a specific CIDR range and
kicked off the Lambda written with Boto to remove that home ip entry automatically from
accessing that asset.
Copyright © 2018 CA. All rights reserved.
Thank you!
We’re hiring!
Q & A

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Advanced Continuous Delivery on AWS
Advanced Continuous Delivery on AWSAdvanced Continuous Delivery on AWS
Advanced Continuous Delivery on AWS
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
 
Twelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsTwelve Factor Serverless Applications
Twelve Factor Serverless Applications
 
Serverless Security: Best practices and mitigation strategies (re:Inforce 2019)
Serverless Security: Best practices and mitigation strategies (re:Inforce 2019)Serverless Security: Best practices and mitigation strategies (re:Inforce 2019)
Serverless Security: Best practices and mitigation strategies (re:Inforce 2019)
 
Testing on AWS - AWS IL meetup
Testing on AWS - AWS IL meetupTesting on AWS - AWS IL meetup
Testing on AWS - AWS IL meetup
 
AWS re:Invent 2016: DevOps on AWS: Advanced Continuous Delivery Techniques (D...
AWS re:Invent 2016: DevOps on AWS: Advanced Continuous Delivery Techniques (D...AWS re:Invent 2016: DevOps on AWS: Advanced Continuous Delivery Techniques (D...
AWS re:Invent 2016: DevOps on AWS: Advanced Continuous Delivery Techniques (D...
 
DevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software DeliveryDevOps on AWS - Accelerating Software Delivery
DevOps on AWS - Accelerating Software Delivery
 
Effective Collaboration & Delivery with GitHub and AWS Code Deploy – GitHub
Effective Collaboration & Delivery with GitHub and AWS Code Deploy – GitHubEffective Collaboration & Delivery with GitHub and AWS Code Deploy – GitHub
Effective Collaboration & Delivery with GitHub and AWS Code Deploy – GitHub
 
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar SeriesContinuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
 
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech TalksDeep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
Deep Dive on AWS Lambda - January 2017 AWS Online Tech Talks
 
Deep Dive: AWS CloudHSM (Classic)
Deep Dive: AWS CloudHSM (Classic)Deep Dive: AWS CloudHSM (Classic)
Deep Dive: AWS CloudHSM (Classic)
 
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
 
Leveraging elastic web scale computing with AWS
 Leveraging elastic web scale computing with AWS Leveraging elastic web scale computing with AWS
Leveraging elastic web scale computing with AWS
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
 
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
 
AWS re:Invent 2016: Leverage the Power of the Crowd To Work with Amazon Mecha...
AWS re:Invent 2016: Leverage the Power of the Crowd To Work with Amazon Mecha...AWS re:Invent 2016: Leverage the Power of the Crowd To Work with Amazon Mecha...
AWS re:Invent 2016: Leverage the Power of the Crowd To Work with Amazon Mecha...
 
State of Union - Containerz
State of Union - ContainerzState of Union - Containerz
State of Union - Containerz
 
Cloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSSCloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSS
 
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar SeriesDeep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
Deep Dive on Serverless Web Applications - AWS May 2016 Webinar Series
 
The Psychology of Security Automation
The Psychology of Security AutomationThe Psychology of Security Automation
The Psychology of Security Automation
 

Semelhante a Meetup callback

Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
QAware GmbH
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
Amazon Web Services
 

Semelhante a Meetup callback (20)

Secure Configuration and Automation Overview
Secure Configuration and Automation OverviewSecure Configuration and Automation Overview
Secure Configuration and Automation Overview
 
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ... The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
 
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
AWS18 Startup Day Toronto- The Best Practices and Hard Lessons Learned of Ser...
 
Ruby on Rails Penetration Testing
Ruby on Rails Penetration TestingRuby on Rails Penetration Testing
Ruby on Rails Penetration Testing
 
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
The Best Practices and Hard Lessons Learned of Serverless Applications - AWS ...
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
 
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
Gluecon 2018 - The Best Practices and Hard Lessons Learned of Serverless Appl...
 
REST APIs
REST APIsREST APIs
REST APIs
 
Securing Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web DaySecuring Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web Day
 
Securing Serverless Architectures
Securing Serverless ArchitecturesSecuring Serverless Architectures
Securing Serverless Architectures
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Securing Serverless Architecture
Securing Serverless ArchitectureSecuring Serverless Architecture
Securing Serverless Architecture
 
How Serverless Changes DevOps
How Serverless Changes DevOpsHow Serverless Changes DevOps
How Serverless Changes DevOps
 
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
 
CI/CD with AWS Code Services
CI/CD with AWS Code ServicesCI/CD with AWS Code Services
CI/CD with AWS Code Services
 
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013
 
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Meetup callback

  • 1. It’s More Ops Than You Think June 2018 Bob Balaban, CA/Veracode
  • 2. Copyright © 2018 CA. All rights reserved. Agenda • The “promise” of serverless • Veracode Dynamic Analysis • Replacing a “server” with a “service” – Advantages – Dev and DevOps processes – Demos – Dev effort summary – Ops effort summary • Lessons Learned (including…security!) • Q & A
  • 3. Copyright © 2018 CA. All rights reserved. Advantages of Serverless (from Wayne)  Automated Scalability  Built-in Fault Tolerance  LessOps – No infrastructure to manage  Lower Cost - Pay only for what you use  Faster development - Small functions easier to code and business logic focused  Lower Risk – responsibility transferred to provider  Integrated security – No patching, remote into O/S (SSH/RDP)  Automatic logging We will come back to this later
  • 4. Copyright © 2018 CA. All rights reserved. Veracode Dynamic Analysis • Scans a “target app” (website) looking for security vulnerabilities – Cross-site scripting (XSS) – SQL Injection (SQLi) – XML External Entity (XXE) – Remote File Inclusion (RFI) – OS Command Injection – Server-side Request Forgery (SSRF) – Directory Traversal – …and many more • See OWASP: http://www.owasp.org
  • 5. Copyright © 2018 CA. All rights reserved. How Do We Find Vulnerabilities? • “Ethical hacking” • We “attack” the target (in ways that don’t damage data or functionality) • If an attack succeeds, we report a vulnerability – And help you fix it! • Example: SQL Injection – “Select (sleep(15)) where true” – We can tell if it works because the response is sloooowwww
  • 6. Copyright © 2018 CA. All rights reserved. What a “callback” server does 1. Scan engine attacks a target app with (ethically) malicious XML, Javascript, etc. 2. If successful, the attack causes the app to make a call to the Veracode “callback server” 3. The server records the successful attack 4. The scan engine polls the server later to fetch data on successful attacks, and reports vulnerabilities
  • 7. Copyright © 2018 CA. All rights reserved. Callback Server (“Before”) Callback Server Target App Scan Engine 1. Inject attack, e.g., “include remote PHP file from callback service” 3. Get results 2. “I was hacked!”
  • 8. Copyright © 2018 CA. All rights reserved. Existing Callback Server • AWS EC2, golang • Simple “GET” response to target apps – Serves static file – Records successful attacks • Simple REST API for scanner engine – Register/unregister scanners – Fetch successful attack data – Clean up attack data • Postgres RDB for attack data – Auto-purges after 7 days
  • 9. Copyright © 2018 CA. All rights reserved. New Callback SERVICE Objectives Re-architect as “serverless”: 1. Lambda functions only run when invoked 2. AWS API Gateway offloads authorization, firewall and load balancing 3. DynamoDB nosql database easy to use from lambdas 4. Both Lambda and DynamoDB usage can auto-scale 5. Simplify REST API, otherwise maintain the same interfaces 6. Add some metrics tracking (count of invocations)
  • 10. Copyright © 2018 CA. All rights reserved. New Callback Service (“After”) Callback Service Target App Scan Engine 1. Inject attack 3. Get results 2. “I was hacked!”
  • 11. Copyright © 2018 CA. All rights reserved. Callback Service Components (AWS) DynamoDb Query attack info Capture attacks, Serve text A P I G a t e w a y From target app From scanner λ λ
  • 12. Copyright © 2018 CA. All rights reserved. Tour of new Callback Service
  • 13. Copyright © 2018 CA. All rights reserved. Advantages of New Architecture • DynamoDB TTL feature means we can simplify the service’s REST API – No need for cleanup calls – No need for Postgres • Lambdas do not get billed for idle time • API Gateway will auto-scale lambda invocations when needed (no need for auto-scaling groups) • Logging calls go automatically to CloudWatch
  • 14. Copyright © 2018 CA. All rights reserved. Development Process Changes • Smaller, independent functions (good!) • No runtime debugging (bad!) – didn’t try Cloud9 – Fallback to “Printf debugging” – Also required to see what your function is being called with (e.g., http event data structure not documented) • Create AWS resources manually, the first time – API Gateway (can start with a Swagger definition) – Lambdas – IAM – DynamoDB tables – S3 (backup Terraform db file)
  • 15. Copyright © 2018 CA. All rights reserved. Development Process Changes - 2 • Dev/test cycle – Make code changes – Manually (or semi-manually) deploy to AWS • Need to figure out how to get code from IDE to AWS • We use gitlab and Terraform • Terraform can be used locally to push changes to AWS • (Have to zip .js files first!) – Test (Postman/curl) – Commit changes to repo – Repeat
  • 16. Copyright © 2018 CA. All rights reserved. Devops! • Manual deployment is not sustainable long-term • Must automate! • Chose Terraform to script AWS resource creation/configuration – Injectable “variables” for AWS keys, config parameters, environment variables – Resource dependencies (e.g., create lambdas before api gateway) – Incremental changes! (if you keep a copy of the tf db) • Chose Gitlab for CI/CD scripting – Triggered on merge to Master branch – Build zip files, manage Terraform invocation
  • 17. Copyright © 2018 CA. All rights reserved. Devops - 2 • Ongoing re-factoring of the project – When and how to supply production account AWS keys – Coordinate Gitlab deploys and “legacy” (Bitbucket) builds – Who decides on gateway “stages”? • Who monitors the logs? – Some teams ship their logs to Sumo (more lambdas) • Who watches scalability of the gateway and lambdas? • Oh, and who watches cost?
  • 18. Copyright © 2018 CA. All rights reserved. Time Commitment – Dev and DevOps • Dev was about 20% of “time to beta” • DevOps (pipeline automation, config automation…) was 80% • Why? – The pipeline automation tools were new to us, we had to learn them – Some AWS features were new
  • 19. Copyright © 2018 CA. All rights reserved. Stuff We Had to Learn From Scratch • API Gateway setup/config • Lambda deployment/config – Permissions, environment variables • Querying DynamoDB efficiently • Terraform – create/update entire AWS infrastructure • Gitlab CI tools
  • 20. Copyright © 2018 CA. All rights reserved. Skills We Had to Improve • Node.js – Coding – Debugging (via console.log() output, ew) • Cloudwatch • IAM for inter-component authorization – E.g., API Gateway calling Lambda – Lambda calling Cloudwatch and DynamoDB • PostMan/curl – Create http POST and GET tests
  • 21. Copyright © 2018 CA. All rights reserved. Recap: Advantages of Serverless  Automated Scalability √  Built-in Fault Tolerance √  LessOps – No infrastructure to manage meh  Lower Cost - Pay only for what you use √  Faster development - Small functions easier to code and business logic focused √  Lower Risk – responsibility transferred to provider meh  Integrated security – No patching, remote into O/S (SSH/RDP) √  Automatic logging meh
  • 22. Copyright © 2018 CA. All rights reserved. Lessons Learned • Serverless is great, where appropriate – Keep it simple • Figure out the DevOps as you go – Assume you will automate everything: • Build • Unit test • Deploy • Integration test • You will re-factor the project at least as often as you refactor your code
  • 23. Copyright © 2018 CA. All rights reserved. And Oh Yeah, Security! “Security is like performance, you bolt it on at the end of the project”
  • 24. Copyright © 2018 CA. All rights reserved. “Security is like performance, you bolt it on at the end of the project” (Said no one we want to listen to)
  • 25. Copyright © 2018 CA. All rights reserved. Severless Security: Application Dependencies Application dependencies are going to become one of the main vectors for attackers to compromise your FaaS infrastructure. It is crucial that you scan third party libraries for vulnerabilities.  To drive home that point - a researcher recently found a way to get push rights to over 14% of NPM Packages and mainstream ones at that, e.g. : debug, request, react, gulp... How? It was a combination of brute force and credential leaks from GitHub.  In an evaluation of 1,000 open-source serverless projects, a threat research team revealed that 21% of them contained one or more critical vulnerabilities or misconfigurations, allowing attackers to manipulate applications and perform various malicious actions. Mitigations  Maintaining an inventory list of software packages and other dependencies and their versions  Scanning libraries for known vulnerable dependencies. Vulnerability scanning should be done as part of your ongoing CI/CD process
  • 26. Copyright © 2018 CA. All rights reserved. Serverless Security: At-Rest and In-Transit equally vulnerable! Serverless exudes a false sense of security due to secure API calls and encrypted databases. 1. OWASP top 10 is still as relevant as ever! 2. SQL injection and other forms of injection attacks are still possible in the serverless world, as are cross-site scripting attacks. 3. Keep your secrets in an Key Management System, not code. 4. Ensure your services have the least amount of privilege to read/write to your databases. 5. Use direct/private connections between your VPCs and Databases wherever possible. Mitigations  Always use safe APIs that either sanitize or validate user input, or APIs which provide a mechanism for binding variables or parameterizing them for underlying infrastructure (e.g. stored procedures or prepared statements in the case of SQL queries)  Always use safe APIs that either sanitize or validate user input, or APIs which provide a mechanism for binding variables or parameterizing them for underlying infrastructure.
  • 27. Copyright © 2018 CA. All rights reserved. Severless Security: Monitoring becomes extremely important The one thing that the advent of serverless has made more difficult is monitoring and the lack of understanding of security implications for various serverless assets.  Logging is key. Ensure you have CloudTrail enabled on all accounts for all regions. Don’t assume a developer or malicious actor won’t create an asset outside of us-east-1.  The days of agents are gone! You now have to use platform-specific tools to monitor…  …using Cloudwatch Metrics (with alarms) to monitor resources and set limits on either calls or spend. When alerted, investigate when/why those limits are being exceeded.  If you have a SIEM Tool or a 3rd-party monitoring service, send CloudWatch/Cloudtrail logs to their services to be monitored. You’ll be amazed at what is already actively scanning your public assets.  RYOM – (rolling your own monitoring) – Lambda’s written in Python using the Boto SDK are extremely powerful to monitor/modify your assets and alert based on customized parameters. e.g. - A developer adds their home ip address to connect to an asset for debugging from home, but a metric was defined to only allow connections of a specific CIDR range and kicked off the Lambda written with Boto to remove that home ip entry automatically from accessing that asset.
  • 28. Copyright © 2018 CA. All rights reserved. Thank you! We’re hiring! Q & A

Notas do Editor

  1. So what are some of the advantages? This is not a complete list. Less operations because AWS is taking over IaaS. Lower cost in many cases. We will review. Small functions are easier to code, test, and maintain. No more need to ssh or rdp into servers.
  2. So what are some of the advantages? This is not a complete list. Less operations because AWS is taking over IaaS. Lower cost in many cases. We will review. Small functions are easier to code, test, and maintain. No more need to ssh or rdp into servers.