KMS ENCRYPTION Flashcards

1
Q

CMK Type: Symmetric

A
AES-256
Single Key to Encrypt and Decrypt : Symmetric
Services that are using KMS use this
Never get access to key in plaintext
Necessary for envelope encryption
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

CMK Type: Asymmetric

A
RSA and ECC
Two Keys, assymetric
Public Key (Encrypt) Private Key (Decrypt)
used for encrypt/decrypt Sign/Verify
Public key is downloadable

USED FOR ENCRYPTION OUTSIDE OF AWS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

KMS overview

A

Fully Manage Key/ Policy
Create
Rotate
Disable/Enable

Audit Key usage via Cloudtrail

Three types of CMK: Customer Master Key
AWS managed: FREE Service Default
User Keys made in KMS: 1$ monthly
User keys imported (256 symmetric only) 1$Monthly

API CALL FEE .03$ per 10,000 calls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

KMS overview 101 practices

A

Never store secrets plaintext
Encrypted secrets can be stored in CODE or ENVIROMENT VARIABLES!

KMS can only Encrypt 4KB MAX!!!!
Beyond 4KB needs Envelope Encryption

ACCESS:
Key Policy Allows User
IAM Policy Allows API CALLS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

KMS REGIONS

A

KMS keys cannot be shared between regions, snapshots that are encrypted need to undergo:

KMS ReEncrypt with Alternative KMS key native to new region!.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

KMS Key Policies

A

Control Access Much like S3 Bucket Policy
Iam policy vs Key policy
Key Policy: Need to specify Key policy to allow key access.

Default:

  1. Created if you don’t provide a policy
  2. Complete access to the Root user which encompasses the entire AWS account.
  3. gives access to IAM policies to KMS key

Custom:
Can define user/role access to key
Who can administer access to key
Needed for Cross account access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

KMS Key Cross Account Access

A
  1. Create Encrypted Snapshot
  2. Attach KMS key policy to allow cross account access

Principal : has target account ID
Actions created to use key (DECRYPT /CREATE GRANT)
conditions: KMS caller account will have Target account ID

  1. Share Encrypted Snapshot
  2. In Target create a copy of snapshot and encrypt it with your own accounts KMS KEY!
  3. Create a volume from a snapshot

THIS ALLOWS ANOTHER ACCOUNT TO REENCRYPT DATA.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

ENCRYPT AND DECRYPT

UNDER 4KB

A

ENCRYPT:
1. Secret Unencrypted (<4KB)
Encrypt API calls to KMS, specified CMK to use

  1. KMS checks IAM permissions
  2. If Successful, KMS will send back Encrypted Secret

DECRYPT:
1. Encrypted Data
Decrypt API call

  1. KMS automatically will know which CMK was used
    It will check with IAM for permisions
  2. Decrypted information is sent back if KMS has approval from IAM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Envelope Encryption:

A

ENCRYPTION:
GenerateDataKey API: Anything over 4KB of data needs to use this command

  1. Big file needs to be encryped: SDK is used
    GenerateDataKey API is called to KMS. KMS will now see if IAM policy allows this
  2. KMS will send a plaintext Data Key: DEK . Back to client.
    KMS will also send an Encrypted version of the DEK
  3. Client will receive Plaintext and Cypher DEK and use Plaintext DEK to Encrypt file and create Envelope.
    Inside Envelope the Cyphertext DEK is placed with the Encrypted File.

FILE HAS WRAPPER WITH ENCRYPTED DEK

DECRYPT:

  1. Encrypted DEK and File: Use Decrypt API
  2. DEK cyphertext is passed to KMS, IAM checks occur and the decrypted DEK is sent back to client.
  3. This Plaintext DEK is used to Decrypt the file locally.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

KMS SYMMETRIC API

A

Encrypt: Encrypt 4KB data
GenerateDataKey: Unique Symmetrical Data KEY DEK
Returns Plaintext copy of key
Also returns a Cyphertext DEK under CMK specified

GenerateDataKeyWithoutPlaintext:
Generate DEK to be used later
DEK encrypted under chosen CMK

Decrypt: Decrypt up to 4KB of Data, DEK can be done also

GenerateRandom: Returns Random Byte String: Returns a random byte string that is cryptographically secure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

KMS limits: Request Quota

A

ThrottlinException:
When you exceed request quota for KMS

Resolution:
Exponential backoff
For GenerateDataKey, DEK. Use DEK caching from encryption SDK
-------------
Cryptographic operations shared quota
includes SSE-KMS


Can be increased, this is soft limit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

KMS limits: Request Quota operations

A
API operations
Decrypt
Encrypt
GenerateDataKey DEK (Symmetric)
GenerateDataKeyWithoutPlaintext (Symmetric)
GenerateRandom

ReEncrypt
Sign (Assymetric)
Verify (Assymetric)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

KMS limits: Request Quota amounts

A

Shared Vary with Region and type of CMK

Symmetric: Regional
Asymmetric: Type of CMK share.

Symmetric
5,500 Shared
10,000 (shared) in certain regions
30,000 Shared in US east 1, west 2 , west 1

Assymetric
500 Shared RSA CMK
300 Shared ECC CMK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SSE KMS: overview and how it encrypts items

A

Handled and managed by AWS
User control + Audit trail
Object Encrypted Server Side

Must have Header:
X-AMZ-Server-side-Encryption: aws:KMS

METHOD
Object : Sent via HTTPS with Header (aws:kms)

Inside S3: Object is on S3, CMK is referenced and used to encrypt the object and it is placed under the bucket.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SSE KMS Deep Dive
Operations

Cloudtrail tracking

Requirements for SSE-KMS authorization

Kms limits, what service causes issues, what are solutions.

A

SSE-KMS Operations: KSM API calls
GenerateDataKey
Decrypt
** These show up in cloudtrail for logging

Requirements for SSE-KMS
Both needed
1 KMS key policy authorizing user/role
2 IAM policy Authorizes Access to KMS
**otherwise acces denied. 
S3 Calls to KMS for SSE-KMS counts against KMS LIMTS!!
Resolution
Exponential Backoff
Request KMS limit increase
Service throttle is KMS issue, not S3!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

SSE KMS S3 Bucket Protect

FORCE SSL

A

AWS Secure Transport
Force SSL

Create bucket policy that denys if the below is matched
AWS:Securetransport: False

AWS:Securetransport: true, is bad practice, it would allow anonymous Getobject using SSL

17
Q

SSE KMS S3 Bucket Protect

Force Encryption of SSE KMS

A
  1. Deny Incorrect encryption header; makes sure only header used is AWS:KMS,
    Stringnotequals: AWS:KMS is denied
  2. Deny No Encryption Header to ensure non-encryption items are not uploaded to this bucket
    * *Or have default encryption of all objects as SSE -KMS
18
Q

Parameter store Hierarchy

A

Parameter store holds values to be used in cloudformation. these items can be stored via Hiearchy
* Parameter Store support for hierarchies lets you organize parameters based on your deployment. *

Can have different parameters to be used in DEV/Prod and have separation by hierarchy.

GetParameters
GetParametersbypath API

19
Q
Parameter store STANDARD VS ADVANCED
Total number
Max size
Parameter policy
Cost
Storage Price
A
Size: 10,000 vs 100,000
Max size of value: 4KB vs 8KB
Policy: No, Yes
Cost: Free vs Charges
Storage pricing: Free, .05 per advanced
20
Q

Parameter Policy

A

For Advanced Parameters.

** Allows TTL to be assigned to parameter for expiration, force update or delete sensitive information

Can assign multiple policies at once
Policy types
Expiration: Delete

Expirationnotification : Send notification at x time through Cloudwatch events before expire

Nochangenotification: If nothing changed in X time then sign Cloudwatch event.

21
Q

Secrets Manager

A

Storing secret
Force Rotation of secrets

AUTOMATION GENERATION OF SECRETS FOR ROTATION AUTO BY LAMBDA

Integrate with RDS; synchronize secrets between db and secrets manager

Encrypt with KMS

MEANT FOR RDS INTEGRATION**

22
Q

Parameter Store vs Secrets Manager

A
Secrets manager- DB
Costs more
Automation of rotation of secrets by lambda
Integration with RDS/Redshift/DocumentDB
KMS encryption needed***
Can integrate with cloudformation
SSM Parameter store -CLOUDFORMATION
Costs less
no rotation
KMS encryption optional***
integration with cloudformation
Can pull secret manager secret using ssm parameter store api
23
Q

Codebuild secrets

A

AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy. With CodeBuild, you don’t need to provision, manage, and scale your own build servers.

FOR PARAMETERS AND SECRETS

DONT STORE AS PLAINTEXT IN ENVIROMENT VARIABLES!

Enviroment variables can reference either

Parameter store parameters
Secrets manager secrets