관리 메뉴

진취적 삶

섹션 14 아마존 S3 보안 본문

AWS SAA

섹션 14 아마존 S3 보안

hp0724 2023. 7. 15. 20:33

S3 버킷 내 객체를 암호화 하는 방법 4 가지

  • Server-side Encryption(SSE)
    • Server-side Encryption with amazon s3-managed keys
    • Server-side Encryption with KMS keys stored in AWS KMS
    • Server-side Encryption with Customer-provided keys (SSE-C)
  • Client-side Encryption

Amazon S3 Encryption - SSE - S3

  • Encryption using keys handled managed ,and owned by AWS
  • object is encrypted server-side
  • encryption type is AES-256
  • Must set header “x-amz-server-side-encryption”:”AES-256”

Amazon S3 Encryption - SSE - KMS

  • Encryption using keys handled and managed by AWS KMS
  • KMS advantages : user control + audit key usage using CloudTrail
  • must set header “x-amz-server-side-encryption”:”aws:kms”
  • 암호화가 AWS 서버 측에서 진행되고 암호화 키 관리도 AWS에서 하지만 암호화 키 순환 정책에 관한 제어권은 모두 이용자에게 있다,

SSE - KMS 한계

you can request a quota increase using the service using the Service Quotas Console

처리량이 매우 높은 S3 버켓이 있고 모든 파일이 kms키로 암호화 되었다면

스로틀링 오류 등의 사례가 발생 가능

Amazon S3 Encryption -SSE -C

  • Server-side Encryption using keys fully managed by the customer outside of AWS
  • 제공된 암호화 키는 Amazon S3에 저장되지 않고 사용후 폐기
  • 암호화는 서버측에서 수행되고, 암호화 키에 대한 모든 제어권은 이용자가 갖는다.

Amazon s3 Encrpytion -Client -Side Encryption

  • use clietn libraries such as Amazon S3 client-side Encryption Library
  • Clients must encrypt data themselves before sending to Amazon S3
  • clients must decrypt data themselves when retrieving from amazon S3
  • customer fully manages the keys and encryption cycle
  • 직접 암호화를 수행해야 하며 이용자가 암호화 키에 대한 모든 제어권을갖는다.

Amazon s3 Encrpytion in transit (SSL /TLS)

전송 중 암호화 SSL

  • Amazon S3 exposes two endpoints :
    • HTTP Endpoint -non encrypted
    • HTTPS Endpoint - encryption in flight

Default Encryption vs Bucket Policies

  • force encryption is to use a bucket policy and refuse any API call to PUT an S3 object
  • 암호화되지 않은 객체 자동 암호화 하도록 default Encrpytion

CORS

Cross origin Resource Sharing (CORS)

orgin = scheme (protocol) + host(domain) +port

same origin : http://example.com/app1 &http://example.com/app2 체계 호스트 포트가 동일할때

different origins : http://www.example.com & http://other.example.com

if a client makes a cross-origin request on our S3 bucket, we need to enable the correct CORS headers

you can allow for a specific origin or for * (all origins)

Edit cross-origin resource sharing

[
    {
        "AllowedHeaders": [
            "Authorization"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "<url of first bucket with http://...without slash at the end>"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

MFA Delete

MFA 멀티 팩터 인증 핸드포 추가 인증

MFA 가 필요한 경우

  • 객체 영구적 삭제
  • bucekt의 versioning 중단

MFA delete 를 사용하기 위해서는 Versioning must be enabled

only the bucket owner can enable / disable MFA delete

# generate root access keys
aws configure --profile root-mfa-delete-demo

# enable mfa delete
aws s3api put-bucket-versioning --bucket mfa-demo-stephane --versioning-configuration Status=Enabled,MFADelete=Enabled --mfa "arn-of-mfa-device mfa-code" --profile root-mfa-delete-demo

# disable mfa delete
aws s3api put-bucket-versioning --bucket mfa-demo-stephane --versioning-configuration Status=Enabled,MFADelete=Disabled --mfa "arn-of-mfa-device mfa-code" --profile root-mfa-delete-demo

# delete the root credentials in the IAM console!!!

S3 Access Logs

감사 목적으로 S3 버킷에 대한 모든 액세스를 기록

S3 Access Logs :Warning

  • 로깅 버킷을 모니터링하는 버킷과 동일하게 설정하지 말기
  • 동일하게 설정하면 로깅 루프가 생성 무한 반복되어 버킷의 크기가 기하급수적 증가

s3 - pre signed URLs

Users given a pre-signed URL inherit the permissions of the user that generated the

URL for GET/ PUT

  • Allow only logged- in users to download a premium video from your S3 bucket
  • Allow an ever-changing list of users to download files by generating URLs dynamically
  • Allow temporarily a user to upload a file to a precise location in your S3 bucket
  • 임시 url을 제공해 해당 사용자들이 S3 버킷의 특정위치로 파일을 업로드 가능하게 함

S3 Glacier Vault Lock

  • Adopt a WORM ( Write Once Read Many)
  • create a Vault Lock Policy
  • lock the policy for future edits

S3 obejct Lock

  • Retention mode - Compliance :
    • object versions can’t be overwritten or deleted by any user, including the root use
    • object retention modes can’t be changed, and retention periods can’t be shortened
  • Retention mode- Governance :
    • most users can’t overwrite or delete an object version or alter its lock settings
    • some users have special permissions to change the retention or delete the object

S3 - Access points

그룹에 따라 액세스할 액세스 포인트를 정의하는 특정 정책을 액세스 포인트만다 연결 할수 있다.

각 엑세스 포인트마다 고유의 DNS 와 정책이 있다.

One policy per Access Point ⇒ easier to manage than complex bucket policies

S3 - Object Lambda

호출한 애플리케이션이 회수하기 전에 수정하기 위함

분석이나 비프로덕션 환경을 위해 개인 식별 정보와 같은 PII 데이터를 삭제한는 경우

XML 에서 JSON으로 데이터를 변환 하거나 원하는 변화를 실행하는경우

'AWS SAA' 카테고리의 다른 글

섹션 12 Amazon S3 소개  (0) 2023.07.15
섹션 13 고급 amazon S3  (0) 2023.07.15
섹션 15 AWS CloudFront  (0) 2023.07.15
섹션 16 AWS 스토리지 추가기능  (0) 2023.07.15
섹션7 EC2 인스턴스 스토리지  (0) 2023.07.15