87
Masterclass Advanced Security Best Practices Ian Massingham Technology Evangelist AWS LIVE @IanMmmm

Advanced Security Masterclass - Tel Aviv Loft

Embed Size (px)

Citation preview

Page 1: Advanced Security Masterclass - Tel Aviv Loft

MasterclassAdvancedSecurityBestPracticesIan Massingham Technology Evangelist AWS

LIVE

@IanMmmm

Page 2: Advanced Security Masterclass - Tel Aviv Loft

Masterclass

Intended to educate you on how to get the best from AWS services

Show you how things work and how to get things done

A technical deep dive that goes beyond the basics123

Page 3: Advanced Security Masterclass - Tel Aviv Loft

Advanced Security Best Practices

Security is job zero at AWS Built to satisfy the most security-sensitive organisations

Provides visibility, auditability, controllability & agility Lower operational overhead that traditional IT

Page 4: Advanced Security Masterclass - Tel Aviv Loft

AWS security approach

Size of AWSsecurity team

Visibility intousage & resources

Increasing your Security Posture in the Cloud

Page 5: Advanced Security Masterclass - Tel Aviv Loft

Broad Accreditations & Certifications

ISO 27001 ISO 9001

MPAA

Page 6: Advanced Security Masterclass - Tel Aviv Loft

Partner ecosystem Customer ecosystem Everyone benefits

Security Benefits from Community Network Effect

Page 7: Advanced Security Masterclass - Tel Aviv Loft

Agenda

Sharing the Security Responsibility Identity and Access Management with IAM Defining virtual networks with Amazon VPC

Networking & Security for Amazon EC2 Instances Working with Container and Abstracted Services

Encryption and Key Management in AWS

Page 8: Advanced Security Masterclass - Tel Aviv Loft

SHARING THE SECURITY RESPONSIBILITY

Page 9: Advanced Security Masterclass - Tel Aviv Loft

Shared Security Model

• Shared Responsibility – Let AWS do the heavy lifting – Focus on what’s most valuable to your business

• Customer • Choice of Guest OS • Application Configuration Options • Account Management flexibility • Security Groups • ACLs • Identity Management

• AWS • Facility operations • Physical Security • Physical Infrastructure • Network Infrastructure • Virtualisation Infrastructure • Hardware lifecycle

management

Page 10: Advanced Security Masterclass - Tel Aviv Loft

Such as Amazon EC2, Amazon EBS, and Amazon VPC

Shared Security Model: Infrastructure Services

Page 11: Advanced Security Masterclass - Tel Aviv Loft

Such as Amazon RDS and Amazon EMR

Shared Security Model: Container Services

Page 12: Advanced Security Masterclass - Tel Aviv Loft

Such as Amazon S3 and Amazon DynamoDB

Shared Security Model: Abstracted Services

Page 13: Advanced Security Masterclass - Tel Aviv Loft

IDENTITY AND ACCESS MANAGEMENT WITH IAM

Page 14: Advanced Security Masterclass - Tel Aviv Loft

UsersCreate individual users

Page 15: Advanced Security Masterclass - Tel Aviv Loft

Create individual usersBenefits • Unique credentials • Individual credential rotation • Individual permissions

How to get started • Identify which IAM users you want

to create • Use the console, CLI or API to:

- Create user - Assign credentials - Assign permissions

Page 16: Advanced Security Masterclass - Tel Aviv Loft

PermissionsGrant least privilege

Page 17: Advanced Security Masterclass - Tel Aviv Loft

Grant least privilegeBenefits • Less chance of people

making mistakes • Easier to relax than tighten up • More granular control

– API and resource

How to get started • Identify what permissions

are required • Password or access keys? • Avoid assigning *:* policy • Default Deny • Use policy templates

IMPORTANT NOTE: Permissions do not apply to root!

Page 18: Advanced Security Masterclass - Tel Aviv Loft

GroupsManage permissions with groups

Page 19: Advanced Security Masterclass - Tel Aviv Loft

Manage permissions with groupsBenefits • Easier to assign the same

permissions to multiple users • Simpler to re-assign

permissions based on change in responsibilities

• Only one change to update permissions for multiple users

How to get started • Map permissions to a specific

business function • Assign users to that function • Manage groups in the Group

section of the IAM console

Page 20: Advanced Security Masterclass - Tel Aviv Loft

ConditionsRestrict privileged access further with conditions

Page 21: Advanced Security Masterclass - Tel Aviv Loft

Restrict privileged access further with conditions

Benefits • Additional granularity when

defining permissions • Can be enabled for any AWS

service API • Minimizes chances of

accidentally performing privileged actions

How to get started • Use conditions where

applicable • Two types of conditions

- AWS common - Service-specific

Page 22: Advanced Security Masterclass - Tel Aviv Loft

Restrict privileged access further with conditions{ "Statement":[{ "Effect":"Allow", "Action":["ec2:TerminateInstances"], "Resource":["*"], "Condition":{ "Null":{"aws:MultiFactorAuthAge":"false"} } } ] }

Enables a user to terminate EC2 instances only if the user has authenticated with their MFA device.

MFA

{ "Statement":[{ "Effect":"Allow", "Action":"iam:*AccessKey*", "Resource”:"arn:aws:iam::123456789012:user/*", "Condition":{ "Bool":{"aws:SecureTransport":"true"} } } ] }

Enables a user to manage access keys for all IAM users only if the user is coming over SSL.

SSL

{ "Statement":[{ "Effect":"Allow", "Action":["ec2:TerminateInstances“], "Resource":["*“], "Condition":{ "IpAddress":{"aws:SourceIP":"192.168.176.0/24"} } } ] }

Enables a user to terminate EC2 instances only if the user is accessing Amazon EC2 from 192.168.176.0/24.

Sour

ceIP

{ "Statement":[{ "Effect":"Allow", "Action":"ec2:TerminateInstances", "Resource":"*", "Condition":{ "StringEquals":{"ec2:ResourceTag/Environment":"Dev"} } } ] }

Enables a user to terminate EC2 instances only if the instance is tagged with “Environment=Dev”.

Tags

Page 23: Advanced Security Masterclass - Tel Aviv Loft

AuditingEnable AWS CloudTrail to get logs of API calls

aws.amazon.com/cloudtrail

Page 24: Advanced Security Masterclass - Tel Aviv Loft

Enable AWS CloudTrail to get logs of API calls

Benefits • Visibility into your user activity

by recording AWS API calls to an Amazon S3 bucket

How to get started • Set up an Amazon S3

bucket • Enable AWS CloudTrail

Ensure the services you want are integrated with AWS CloudTrail

aws.amazon.com/cloudtrail

Page 25: Advanced Security Masterclass - Tel Aviv Loft

PasswordsConfigure a strong password policy

Page 26: Advanced Security Masterclass - Tel Aviv Loft

Configure a strong password policy

Benefits • Ensures your users and your

data are protected

How to get started • What is your company’s

password policy? • You can configure

- Password expiration - Password strength

• Uppercase, lowercase, numbers, non-alphanumeric

- Password re-use

IMPORTANT NOTE: Password policy does not apply to root!

Page 27: Advanced Security Masterclass - Tel Aviv Loft

RotationRotate (or delete) security credentials regularly

Page 28: Advanced Security Masterclass - Tel Aviv Loft

Rotate/Delete security credentials regularlyBenefits • Normal best practice

How to get started • Use Credential Reports to identity

credentials that should be rotated or deleted

• IAM console displays when password last used

• Grant IAM user permission to rotate credentials

• IAM roles for Amazon EC2 rotate credentials automatically

Page 29: Advanced Security Masterclass - Tel Aviv Loft

MFAEnable multi-factor authentication for privileged users

Page 30: Advanced Security Masterclass - Tel Aviv Loft

Enable MFA for privileged users

Benefits • Supplements user name and

password to require a one-time code during authentication

How to get started • Choose type of MFA

- Virtual MFA - Hardware

• Use IAM console to assign MFA device

Page 31: Advanced Security Masterclass - Tel Aviv Loft

SharingUse IAM roles to share access

http://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html

Page 32: Advanced Security Masterclass - Tel Aviv Loft

Use IAM roles to share accessBenefits • No need to share security credentials • No need to store long term

credentials • Easy to break sharing relationship • Use cases

- Cross-account access - Intra-account delegation - Federation

How to get started • Create a role

- Specify who you trust - Describe what the role can

do • Share the name of the role • Use ExternalID when sharing

with a 3rd party

IMPORTANT NOTE: Never share credentials.

Page 33: Advanced Security Masterclass - Tel Aviv Loft

RolesUse IAM roles for Amazon EC2 instances

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

Page 34: Advanced Security Masterclass - Tel Aviv Loft

Use IAM roles for Amazon EC2 instances

Benefits • Easy to manage access keys

on EC2 instances • Automatic key rotation • Assign least privilege to the

application • AWS SDKs fully integrated • AWS CLI fully integrated

How to get started • Create an IAM role • Assign permissions to role • Launch instances w / role • If not using SDKs, sign all

requests to AWS services with the role’s temporary credentials

Page 35: Advanced Security Masterclass - Tel Aviv Loft

Root Reduce or remove use of root

Page 36: Advanced Security Masterclass - Tel Aviv Loft

Reduce or remove use of root

Benefits • Reduce potential for misuse of

credentials

How to get started • Security Credentials Page

- Delete access keys - Activate an MFA device

• Ensure you have set a “strong” password

Page 37: Advanced Security Masterclass - Tel Aviv Loft

aws.amazon.com/iam

Page 38: Advanced Security Masterclass - Tel Aviv Loft

DEFINING VIRTUAL NETWORKS WITH AMAZON VPC

Page 39: Advanced Security Masterclass - Tel Aviv Loft

A virtual network in your own logically isolated area within the AWS cloud populated by

infrastructure, platform, and application services that share common security and interconnection

Amazon VPC

aws.amazon.com/vpc/

Page 40: Advanced Security Masterclass - Tel Aviv Loft

▶︎ Elastic Network Interface (ENI) ▶︎ Subnet ▶︎ Network Access Control List (NACL) ▶︎ Route Table ▶︎ Internet Gateway ▶︎ Virtual Private Gateway ▶︎ Route 53 Private Hosted Zone

VPC Networking

Page 41: Advanced Security Masterclass - Tel Aviv Loft

VPC Network Topology

A VPC can span multiple AZs, but each subnet must reside entirely within one AZ

Use at least 2 subnets in different AZs for each layer of your network

Page 42: Advanced Security Masterclass - Tel Aviv Loft

Control of subnets and routing tables

Page 43: Advanced Security Masterclass - Tel Aviv Loft

VPC Creation with the VPC Wizard

Page 44: Advanced Security Masterclass - Tel Aviv Loft

VPC Creation with AWS CloudFormation

Page 45: Advanced Security Masterclass - Tel Aviv Loft

VPC PeeringA networking connection between two VPCs

docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-peering.html

Page 46: Advanced Security Masterclass - Tel Aviv Loft

Using Network Access Control Lists

An optional layer of security that acts as a firewall for controlling traffic in and out of a subnet

You might set up network ACLs with rules similar to your security groups in order to add an additional

layer of security to your VPC

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html

Page 47: Advanced Security Masterclass - Tel Aviv Loft

Default Network ACL

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html

Page 48: Advanced Security Masterclass - Tel Aviv Loft

Whitelisting with NACLs

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html

Page 49: Advanced Security Masterclass - Tel Aviv Loft

Blacklisting with NACLs

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html

Page 50: Advanced Security Masterclass - Tel Aviv Loft

VPC Flow Logs

https://aws.amazon.com/blogs/aws/vpc-flow-logs-log-and-view-network-traffic-flows/

Page 51: Advanced Security Masterclass - Tel Aviv Loft

DEMO: CREATING A VPC

Page 52: Advanced Security Masterclass - Tel Aviv Loft

NETWORKING AND SECURITY FOR AMAZON EC2 INSTANCES

Page 53: Advanced Security Masterclass - Tel Aviv Loft

Amazon EC2 Security Groups

aws.amazon.com/ec2/

A security group acts as a virtual firewall that controls the traffic for one or more instances.

You add rules to each security group that allow traffic to or from its associated

instances.

Page 54: Advanced Security Masterclass - Tel Aviv Loft

Amazon EC2 Security Groups

aws.amazon.com/ec2/

Availability Zone 1 Availability Zone 2

Security Group: GameServers

Security Group: APIServers

Page 55: Advanced Security Masterclass - Tel Aviv Loft

Amazon EC2 Security Groups

aws.amazon.com/ec2/

Availability Zone 1 Availability Zone 2

Security Group: GameServers

Security Group: APIServers

Page 56: Advanced Security Masterclass - Tel Aviv Loft

DEMO: WORKING WITH SECURITY GROUPS

Page 57: Advanced Security Masterclass - Tel Aviv Loft

AWS CLI

$awsec2create-security-group--group-nameGameServers--description“GameServerFleetSG“--vpc-idvpc-21b05a44

{ “GroupId”:“sg-fac9059e”}

http://docs.aws.amazon.com/cli/latest/reference/ec2/create-security-group.html

Creating Security Groups

Page 58: Advanced Security Masterclass - Tel Aviv Loft

AWS CLI

$awsec2authorize-security-group-ingress--group-idsg-fac9059e--protocoludp--port27016--cidr0.0.0.0/0

$awsec2describe-security-groups--filtersName=group-name,Values=GameServers

SECURITYGROUPS Samplesg-fac9059e GameServers 650160225048vpc-21b05a44IPPERMISSIONS 27015 udp 27015IPRANGES 0.0.0.0/0IPPERMISSIONS 27016 udp 27016IPRANGES 0.0.0.0/0IPPERMISSIONS 7777 udp 7778IPRANGES 0.0.0.0/0IPPERMISSIONSEGRESS -1IPRANGES 0.0.0.0/0

http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html

Authorising Security Group Ingress/Egress

Page 59: Advanced Security Masterclass - Tel Aviv Loft

AWS CLI

$awsec2describe-security-groups--filtersName=group-name,Values=GameServers--outputtext

SECURITYGROUPS Samplesg-fac9059e GameServers 650160225048vpc-21b05a44IPPERMISSIONS 27015 udp 27015IPRANGES 0.0.0.0/0IPPERMISSIONS 27016 udp 27016IPRANGES 0.0.0.0/0IPPERMISSIONS 7777 udp 7778IPRANGES 0.0.0.0/0IPPERMISSIONSEGRESS -1IPRANGES 0.0.0.0/0

http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-security-groups.html

Describing Security Groups

Page 60: Advanced Security Masterclass - Tel Aviv Loft

WORKING WITH CONTAINER & ABSTRACTED SERVICES

Page 61: Advanced Security Masterclass - Tel Aviv Loft

Amazon RDS Amazon EMR

Container Services

Page 62: Advanced Security Masterclass - Tel Aviv Loft

Availability Zone 1: Private Subnet Availability Zone 2: Private Subnet

Amazon RDS Security Groups

Availability Zone 1: Public Subnet Availability Zone 2: Public Subnet

Security Group: APIServers

Security Group: GameServers

RDS Security Group: APIServers

Page 63: Advanced Security Masterclass - Tel Aviv Loft

STORING SECRETS FOR ACCESS TO CONTAINER SERVICES

Page 64: Advanced Security Masterclass - Tel Aviv Loft

AWS SECURITY BLOG

How to Create a Policy That Whitelists Access to Sensitive Amazon S3 Buckets

Page 65: Advanced Security Masterclass - Tel Aviv Loft

AWS SECURITY BLOG

How to Create a Policy That Whitelists Access to Sensitive Amazon S3 Buckets

Page 66: Advanced Security Masterclass - Tel Aviv Loft

Amazon S3 Amazon DynamoDB

Abstracted Services

Page 67: Advanced Security Masterclass - Tel Aviv Loft

USE IAM ROLES TO PASS ACCESS CREDENTIALS TO AN INSTANCE

Page 68: Advanced Security Masterclass - Tel Aviv Loft

DEMO: WORKING WITH IAM ROLES

Page 69: Advanced Security Masterclass - Tel Aviv Loft

ENCRYPTION AND KEY MANAGEMENT IN AWS

Page 70: Advanced Security Masterclass - Tel Aviv Loft

PlaintextData

Hardware/Software

EncryptedData

EncryptedData in Storage

Encrypted Data Key

SymmetricData Key

Master KeySymmetricData Key

? Key Hierarchy

?

Encryption Primer

Page 71: Advanced Security Masterclass - Tel Aviv Loft

DIY Key Management in AWSEncrypt data client-side and send ciphertext to AWS storage services

Your encryptionclient application

Your key management infrastructure

Your applications in your data

center

Your application in Amazon EC2

Your key management

infrastructure in EC2

Your Encrypted Data in AWS Services

Page 72: Advanced Security Masterclass - Tel Aviv Loft

DIY Key Management in AWSAmazon S3 Encryption Client in AWS SDKs

Your key management infrastructure

Your applications in your data

center

Your key management

infrastructure in EC2

Your Encrypted Data in Amazon S3

Your application in Amazon EC2

AWS SDK with S3 Encryption Client

Page 73: Advanced Security Masterclass - Tel Aviv Loft

DIY Key Management in AWSAmazon S3 Server-Side Encryption with Customer-Provided Keys

PlaintextData

EncryptedData

Customer Provided Key Amazon S3 Web

Server

HTTPSCustomer

Data

Amazon S3 Storage Fleet

• Key is used at Amazon S3 webserver, then deleted • Customer must provide same key when downloading to allow

Amazon S3 to decrypt data

Customer Provided Key

Page 74: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management Service• A managed service that makes it easy for you to create,

control, rotate, and use your encryption keys

• Integrated with AWS SDKs and AWS services including Amazon EBS, Amazon S3, and Amazon Redshift

• Integrated with AWS CloudTrail to provide auditable logs to help your regulatory and compliance activities

Page 75: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management ServiceIntegrated with AWS IAM Console

Page 76: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management ServiceIntegrated with Amazon EBS

Page 77: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management ServiceIntegrated with Amazon S3

Page 78: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management ServiceIntegrated with Amazon Redshift

Page 79: Advanced Security Masterclass - Tel Aviv Loft

How AWS Services Integrate with AWS Key Management Service

• Two-tiered key hierarchy using envelope encryption

• Unique data key encrypt customer data

• AWS KMS master keys encrypt data keys

• Benefits of envelope encryption: • Limits risk of a compromised data key • Better performance for encrypting large data • Easier to manage a small number of master

keys than millions of data keys

Customer MasterKey(s)

Data Key 1

Amazon S3 Object

Amazon EBS Volume

Amazon Redshift Cluster

Data Key 2 Data Key 3 Data Key 4

CustomApplication

AWS KMS

Page 80: Advanced Security Masterclass - Tel Aviv Loft

AWS Key Management ServiceProviding security for your keys

• Plaintext keys are never stored in persistent memory on runtime systems • Automatically rotate your keys for you • Separation of duties between systems that use master keys and data

keys • Multi-party controls for all maintenance on systems that use your master

keys • See public white papers and Service Organization Control (SOC 1)

compliance package

Page 81: Advanced Security Masterclass - Tel Aviv Loft

RESOURCES YOU CAN USETO LEARN MORE

Page 82: Advanced Security Masterclass - Tel Aviv Loft

aws.amazon.com/security/

Page 83: Advanced Security Masterclass - Tel Aviv Loft

AWS Technical

Documentation

Page 84: Advanced Security Masterclass - Tel Aviv Loft

blogs.aws.amazon.com/security

Page 85: Advanced Security Masterclass - Tel Aviv Loft

Introduction to AWS Security

Security at Scale: Governance in AWS

Security at Scale: Logging in AWS

AWS Security Best Practices

Securing Data at Rest with Encryption

AWS Security Whitepaper

AWS Security White Papers

Page 86: Advanced Security Masterclass - Tel Aviv Loft

aws.amazon.com/iam

aws.amazon.com/vpc

aws.amazon.com/kms

aws.amazon.com/config

aws.amazon.com/cloudtrail

aws.amazon.com/cloudhsm

aws.amazon.com/cloudwatch

aws.amazon.com/trustedadvisor

Page 87: Advanced Security Masterclass - Tel Aviv Loft

Ian MassinghamTechnology Evangelist, [email protected]