SlideShare a Scribd company logo
1 of 95
Download to read offline
DevSecOps : IAM
조이정 | AWS 솔루션즈 아키텍트
Security Modernization – DevSecOps on AWS
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Agenda
• Why IAM ?
• AWS IAM (Authentication & Authorization)
• IAM policy
• IAM policy 사용 예시
Break Time
• STS / Identity federation
• 운영자를 위한 IAM
• IAM Management
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why IAM ?
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS를 즐기는 방법
SDK
AWS console Command Line Interface
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
자연스러운 흐름 …
Console 기반 작업
High level
Low level
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Script 기반
Low lev
el
Console 기반 작업
High level
Low level
자연스러운 흐름 …
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
프로비저닝 엔진 사용
AWS CloudFormation
template
(JSON/YAML)
HashiCorp Configuration
Language (HCL)
원하는 형상에 대한 정의
자연스러운 흐름 …
Script 기반
Low lev
el
Console 기반 작업
High level
Low level
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CDK application
Stack(s)
Construct Construct
DOM 기반
AWS CloudFormati
on template
리소스 생성
CDK CLI
자연스러운 흐름 …
프로비저닝 엔진 사용
Script 기반
Low lev
el
Console 기반 작업
High level
Low level
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud
CloudWatch Cloud Formation CloudTrail Event
ELB
API
API
API
결국, API
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 매 API호출 마다, AWS CLI 및 SDK 등에서 처리됨
POST https://dynamodb.us-east-2.amazonaws.com/ HTTP/1.1
Host: dynamodb.us-east-2.amazonaws.com
X-Amz-Date: 20180918T150746Z
X-Amz-Target: DynamoDB_20120810.ListTables
X-Amz-Security-Token: FQoGZXIvYXdzEKH////////// …
Content-Type: application/x-amz-json-1.0
Authorization: AWS4-HMAC-SHA256 Credential=ASIAXXXXXXXXXX
XXXXXX/20180918/us-east-1/dynamodb/aws4_request, SignedHead
ers=content-type;host;x-amz-date;x-amz-security-token;x-amz-targe
t, Signature=c1b4bc2df0c47c86cbcfa54d932e8aaa455b6b7c38e65d
840f722254add1ea9e
비밀키로 생성한 HMAC 서명값(Sig v4) 검증
Amazon
DynamoDB
AWS에서의 API 인증
Access Key ID로 요청주체 (IAM Principal)를 인증
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AWS에 HTTP 요청을 보낼 경우, 요청자를 확인하기 위해 요청에 서명(sign)을 한 후 보내야
함 – HTTP 요청 헤더 또는 URL query string
• AWS CLI 또는 SDK를 사용할 경우, 별도의 작업 없이 자동 서명하여 요청함
• 모든 요청은 Timestamp가 포함된 서명이 있어 Replay 공격이 제한됨 (보통 5분 이내)
• 모든 리전과 서비스*는 SIG v4를 지원하므로 SIG v4 사용 권고
Sig v4(Signature Version 4)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS IAM(Identity and Access Management)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
인증과 인가
Who you are What you can do
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
인증과 인가 on AWS
적법한 서명값을 가지고 있는가? (인증) 어떤 API 권한을 수행할 수 있는가 ? (인가)
IAM 은 AWS 전체의 권한 통제 시스템.
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
인증과 인가 on AWS
적법한 서명값을 가지고 있는가? (인증) 어떤 API 권한을 수행할 수 있는가 ? (인가)
보안주체 정책 정의
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Quick Skim
• 모든 서비스에 대한 접근 (권한 조정 불가)
• 콘솔과 API에 대한 접근
• 빌링 및 고객 지원 (Customer Support)에 대한 접근
Root
(Super User)
• 특정 서비스에 대한 접근
• 콘솔, API에 대한 선택적 접근
• 고객 지원 (Customer support) 에 대한 접근
• password / Long term credential 사용
IAM Users
• IAM 사용자 관리 편리성을 제공
• 권한을 한꺼번에 주기 위한 용도
• IAM사용자는 복수개의 그룹에 속할 수 있음
IAM Group
• 특정 서비스에 대한 접근
• 콘솔, API에 대한 선택적 접근
• 고객 지원 (Customer support) 에 대한 접근
• temp credential 사용
IAM Role
Policy
• 권한은 요청이 허용되거나 거부되는지 여부를 결정
• JSON 문서로 작성
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Quick Skim
Long term credential temp credential
"AccessKeyId": "AKIASNTFJL2Q6RGAPHF5”,
"SecretAccessKey": "gJo+deDQbBOzFOHzErVQu7IJI/27u6osTyEIi7tv”
"AccessKeyId": "ASIA6O4DS6EKQQETCFMV",
"SecretAccessKey": "UeEBQbQESgxbTUmuKY2e9fRKRHO7nFIJV4Qgo
CSk",
"SessionToken": "IQoJb3JpZ2luX2VjEPX//////////wEaCXVzLXdlc3Qt
MiJHMEUCIQDoNoFb7HVSeTb31luaYKgKL0AMbbAxoaumo8CrzzxIqQ
IgA6gsaM4DCuoEmH8mcNXVfRkUZ9hH2szm7LbfgN777ZEqkQIILhA
BGgw5OTQwMjQwMjYzODkiDK1EbNlFN51ku8eGwSruAQKxRMFlV4h
H+V95zVnN798S2gH8KABBbj9P+X3rD8Nqp1rtfVjVAD0t5Mn71aeN3j
OmCJP47VUMmOHn3loKtU8i6Lav1hXYiXm/0V0E31leYNbbzjYL2L84
rSqwYsmtxC0zCkZwuVyRJ+XB/gj4ZWJN8ITr3y2IfcuBJeRBSj9sW6Wjb
WNghzuONoqmkVHzKs7FKbP/eylaKmWfR9dYnXwOxtGf+6GShBoEC
sPujzMufk6+qyJlMC+JfiBSMsIwdE/xW1zoYQ+Ayks1Z5bsJcGvXnN7hf
rqMq5SruVCBdXL/URO1fQGRDunxIAkOmowsuvHggY6nQFbkFYM4jf
GVCjM4H3bfGnDvRV6M9mjeKxji4juVE2tu5dpk3c0x9pHfqh+u6AxVGJ
aNiGW0gM8aG6czuMG8ji7T1AvVNmFBiC3VkIvM7C4OdZQeK6Hsvyd
51aVUZTXF10iHAppJxHyx0pIUVuI43nuxj6l2ZCbtz1wSpr1MgAotPe5A
1aUbuEw9eD0VSxp9WFGxJzKUwx/gz+6mmjp",
"Expiration": "2021-03-17T13:27:30+00:00”
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM 역할(Role)
AWS services
AWS account / IAM User
Identity provider
Assume
AWS API
AWS Cloud
IAM role
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM 역할(Role)
• 권한의 위임 체계를 지원하기 위한 용도
• 동일 또는 타 어카운트, AWS 서비스(EC2, 람다 등), 외부인증연계(Federated) 사용자에 부여될 수 있음
• IAM 역할을 수임한 IAM 사용자에게는 본래 권한 대신 IAM역할에서 규정된 권한으로 대체됨.
• 신뢰정책(해당 역할을 할 수 있는 보안주체 규정)과 권한정책(해당 역할에 부여될 권한을 규정)이 할당됨.
• 보안주체를 규정할 때는 * 을 사용할 수 없으며, 수임(AssumeRole) 조건으로 MFA를 지원함.
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM policy
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS IAM 정책 (policy)
• 모든 AWS 서비스는 접근제어 정책을 기반으로 인가
• 매 API호출 시, 적용된 정책을 통해 인가 수행
• IAM 역할/사용자/그룹, AWS 리소스, 임시 자격증명 세션, OU 등
에 적용 가능
• AWS Root 어카운트는 기본적으로 AWS 리소스에 대한 모든 권한
을 소유
• 기본 디폴트 Deny
• 정책 우선 순위 : 묵시적 deny < 명시적 Allow < 명시적 Deny
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS IAM 정책 (policy)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:BatchGetItem",
"dynamodb:GetItem",
"dynamodb:Query",
],
"Resource": [
"arn:aws:dynamodb:us-east-2:<account-id>:table/MyTableName",
"arn:aws:dynamodb:us-east-2:<account-id>:table/MyTableName/index/*"
],
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"us-east-2"
]
}
}
}
]
}
Actions, resources, and condition keys for AWS services :
https://docs.aws.amazon.com/service-authorization/lat
est/reference/reference_policies_actions-resources-cont
extkeys.html
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
“Condition” : {
"DateGreaterThan" : {"aws:CurrentTime" : "2017-01-01T11:00:00Z"},
"DateLessThan": {"aws:CurrentTime" : "2017-12-31T15:00:00Z"},
"IpAddress" : {"aws:SourceIp" : ["192.0.2.0/24", "203.0.113.0/24"]}
}
AND
OR
특정 시간대에 특정 IP 주소의 요청만 허용하거나 거부하고자 싶으면?
조건 연산자
해석: 다음 조건을 만족할 경우, 사용자가 자원에 접근하는 것을 허용,
{“01/01/2017 오전 11시 이후” AND “12/31/2017 오후 3시까지” AND
“[ IP주소 192.0.2.0 /24 OR 203.0.113.0 /24 대역 ]” 에서’
조건 키
정책 : Condition
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
정책 변수(Policy Variable)
{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["s3:ListBucket"],
"Effect": "Allow",
"Resource": ["arn:aws:s3:::mybucket"],
"Condition": {"StringLike": {"s3:prefix": ["David/*"]}}
},
{
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Effect": "Allow",
"Resource": ["arn:aws:s3:::mybucket/David/*"]
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["s3:ListBucket"],
"Effect": "Allow",
"Resource": ["arn:aws:s3:::mybucket"],
"Condition": {"StringLike": {"s3:prefix": ["${aws:username}/*"]}}
},
{
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Effect": "Allow",
"Resource": ["arn:aws:s3:::mybucket/${aws:username}/*"]
}
]
}
• $(Condition Key) 형식으로 변수화
• 사용자마다 고유한 정책 사본을 만들 필요 없이 여러 사용자에게 작용하도록 정책을 일반화
• 정책 변수는 Resource 요소 / Condition 요소의 문자열 비교에 사용 가능
• 이 정책을 평가할 때는 IAM이 정책 변수를 실제 요청의 string으로 대체
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM 정책 종류
정책 설명 포맷 정의 및 관리
Identity-based 정책
IAM 보안 주체(IAM 사용자, IAM 그룹의 사용자 집합, IAM 역할)에 할당되어 해
당 주체의 권한을 규정
JSON IAM
Resource-based 정책 정책이 할당될 리소스를 기준으로 어떤 보안 주체가 할 수 있(없)는 작업을 규정. JSON 개별 서비스들
IAM Permission
Boundary 정책
IAM 보안 주체 별로 획득할 수 있는 권한의 최대치를 규정 JSON IAM
Organization SCP
Organization의 OU 또는 개별 어카운트 별로 권한의 최대치를 규정
주로 Root 어카운트의 권한을 제한 시킬 때 사용.
JSON Organization
Session 정책
임시 자격증명의 기존 퍼미션을 해당 세션에 대해서만 제한할 때 사용
AssumeRole*, GetFederationToken API의 파라미터로 전달
JSON STS
ACL 정책
리소스 기준으로 정의,
주로 Cross-Account 간의 리소스 공유시, 보안 주체에 대한 접근을 규정
XML 개별 서비스들
Endpoint 정책
VPC G/W Endpoint에 적용되는 접근제어 정책.
일종의 Resource-based 정책
JSON VPC
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"Statement":[{
"Effect":"effect",
"Principal":"principal",
"Action":"action",
"Resource":"arn",
"Condition":{
"condition":{
"key":"value" }
}
}
]
}
Principal
Action
Resource
Condition
{
"Statement":[{
"Effect":"effect",
"Action":"action",
"Resource":"arn",
"Condition":{
"condition":{
"key":"value" }
}
}
]
}
Action
Resource
Condition
Identity-based 정책 Resource-based 정책
Identity-based vs. Resource-based
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS 정책 분류
Guardrails
: 권한의 제한 용도
Organization SCPs
IAM permission
boundaries
Session 정책
Grants
: 권한의 부여 용도
Identity-based 정책
Resource-based 정책
Access controls lists (ACLs)
주의) 허용의 경우라
도 실제로 권한이 부
여되지는 않음.
AWS 정책(Policy)의 분류
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
합집합 교집합 교집합
정책 간의 상호작용
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM policy 사용 예시
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
다중 정책의 예시
“이 어플리케이션은
이 객체들과 키에만
접근이 가능하다”
AWS Cloud
AWS KMS key
EC2 instance with
IAM role attached
Application
S3 bucket with
encrypted objec
ts
Role
policy
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::awsexamplebucket1/*"
},
{
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "arn:aws:kms:us-west-2:434590054278:key/0de22ef4EXAMPLE"
}
]
}
identity-based 정책 : IAM 역할
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud
VPC
AWS KMS key
EC2 instance with
IAM role attached
Application
VPC endpoint S3 bucket with
encrypted objec
ts
Resource
policy
“이 객체들은 이 VPC에서
호출이될 때만 어플리케이션에서
접근이 가능하다”
호출 오리진 제한
“이 어플리케이션은
이 객체들과 키에만
접근이 가능하다” Role
policy
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"DenyNotFromMyVPC",
"Effect":"Deny",
"Principal": "*",
"Action":["s3:*"],
"Resource":[
"arn:aws:s3:::awsexamplebucket1",
"arn:aws:s3:::awsexamplebucket1/*"
],
"Condition": {
"StringNotLike": {
"aws:sourceVpce": [ "vpce-05c27cEXAMPLE" ]
}
}
}
]
}
Resource-based 정책 : 버킷 정책
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud
VPC
AWS KMS key
EC2 instance with
IAM role attached
Application
VPC endpoint S3 bucket with
encrypted objec
ts
Resource
policy
Endpoint
policy
Role
policy
"오직 이 객체들만 이 VPC에서 접근
이 가능하고, 그떄는
내 ID를 이용해야한다. ”
“이 어플리케이션은
이 객체들과 키에만
접근이 가능하다”
“이 객체들은 이 VPC에서
호출이될 때만 어플리케이션에서
접근이 가능하다”
네트워크 경계 제한
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"Version": "2012-10-17",
"Statement": [
{
"Principal": "*",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::awsexamplebucket1/*",
"Condition": {
"ForAnyValue:StringLike":{
"aws:PrincipalOrgPaths":[ "o-xmayEXAMPLE/r-EXMP/ou-m3EXAMPLE/*" ]
}
}
]
}
Attached to S3 gateway
VPC endpoint
VPC endpoint 정책
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::awsexamplebucket1/*“,
"Condition": { "StringLike": { "aws:sourceVpce": [ "vpce-05c27cEXAMPLE" ] } }
},
{
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "arn:aws:kms:us-west-2:434590054278:key/0de22ef4EXAMPLE"
}
]
}
identity-based 정책 강화
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Cloud
VPC
AWS KMS key
EC2 instance with
IAM role attached
Application
VPC endpoint S3 bucket with
encrypted objec
ts
Resource
policy
Key
policy
Endpoint
policy
Role
policy
“이 키는 S3데이터를 위해서만 어플
리케이션에 의해서 쓰여야하고, 이
VPC로부터 요청이 와야한다.”
KMS 키 정책
"오직 이 객체들만 이 VPC에서
접근이 가능하고, 그떄는
내 ID를 이용해야한다. ”
“이 어플리케이션은
이 객체들과 키에만
접근이 가능하다”
“이 객체들은 이 VPC에서
호출이될 때만 어플리케이션에서
접근이 가능하다”
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• ECS task-level IAM roles
컨테이너 접근제어 예시 : ECS
S3 bucket
SQS queue
ECS service
{
... snip ...
"taskRoleArn": "",
"executionRoleArn": "",
"containerDefinitions":[{
... snip ...
}],
... snip ...
}
ECS task definition
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• EC2 Level IAM roles
컨테이너 접근제어 예시 : ECS
S3 bucket
SQS queue
ECS service
{
"AttachedPolicies": [{
"PolicyName": "AmazonS3FullAccess",
"PolicyArn":
"arn:aws:iam::aws:policy/AmazonS3FullAccess"
},
{
"PolicyName": "AmazonSQSFullAccess",
"PolicyArn":
"arn:aws:iam::aws:policy/AmazonSQSFullAccess"
},
{
"PolicyName": "AmazonEC2ContainerServiceforEC2Role",
"PolicyArn": "arn:aws:iam::aws:policy/service-
role/AmazonEC2ContainerServiceforEC2Role"
}]
}
EC2 instance IAM role’s policies
IAM role
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• EC2-level IAM role
• All ECS tasks on the same EC2 instance can use the EC2 instance role
컨테이너 접근제어 예시 : ECS
IAM role
EC2 instance
ECS task
Another ECS task Really want to allow?
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• EC2-level IAM role
컨테이너 접근제어 예시 : ECS
{
... snip ...
"taskRoleArn": ”TaskRole-ARN-here",
"executionRoleArn": "",
"containerDefinitions":[{
... snip ...
}],
... snip ...
}
ECS task definition
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:ListBucket"],
"Resource": ["arn:aws:s3:::your-bucket"]
},{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": ["arn:aws:s3:::your-bucket/*"]
}]
}
S3 write-only policy
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:...:your-queue-name"
}]
}
SQS write-only policy
{
"AttachedPolicies": [{
"PolicyName": "S3WriteOnlyPolicy",
"PolicyArn": "S3WriteOnlyPolicy-ARN-here"
},{
"PolicyName": "SQSWriteOnlyPolicy",
"PolicyArn": "SQSWriteOnlyPolicy-ARN-here"
}]
}
ECS task role
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• EC2-level IAM role
컨테이너 접근제어 예시 : ECS
!
EC2 instance
ECS task
Another ECS task
Denied
IAM role
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• IAM 크리덴셜을 사용하여 Kubernetes 클러스터에 인증
IAM 과 Kubernetes
인증
kubectl
Kubernetes용 AWS
IAM Authenticator
Kubernetes API
1 2
3
4
5
역할 기반 액세스
제어 (RBAC)
권한 부여
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• IAM 크리덴셜을 사용하여 Kubernetes 클러스터에 인증
IAM 과 Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: arn:aws:iam::111222333:role/node_instance_role
username: system:node:{{EC2PrivateDNSName}}
groups:
- system:bootstrappers
- system:nodes
RBAC 그룹
system:bootstrappers
system:nodes
IAM 역할
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• EKS Pod Identity Webhook with IAM OIDC
• EKS v1.14+ 이상 부터 IAM OIDC를 통해 Service Account와 연동 지원
• $> eksctl utils associate-iam-oidc-provider --cluster {clustername} --a
pprove
POD를 위한 IRSA OIDC for EKS
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
POD를 위한 IRSA OIDC for EKS
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Break Time (10 mins)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Simple Token Service (STS)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AWS 리소스에 대한 액세스를 제어할 수 있는 임시 보안 자격증명을 생성하여 보안 주체에 전달해주는 서비스
• 보안 주체(ex. 사용자 혹은 역할) 는 STS를 호출할 수 있는 명시적인 권한이 있어야함.
• STS API요청에 대한 응답에는 temp credential이 포함되어 있음
• access key
• secret key
• session token : temp credential을 사용하기 위해 API 요청에 제출해야하는 토큰. 세션 토큰을 사용해 임시 보안 자격
증명의 유효성을 검증
• 15초 ~ 최대 12시간까지 지속가능
• https://sts.amazonaws.com 라는 글로벌 단일 엔드포인트를 default로 사용
• 리전별 AWS STS 엔드포인트를 사용하여 지연 시간을 줄이고, 중복으로 구축하고, 세션 토큰 유효성을 높일 수 있음
• 쿼리 API / SDK / CLI를 통해 STS 호출 가능
AWS STS (Simple Token Service)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS STS API 호출할 수 있는 사용자 사용 사례
AssumeRole
- IAM 사용자
- 기존 임시 보안 자격 증명이 있는 IAM 역할
기존 IAM 사용자가 아직 액세스 권한이 없는 AWS 리소스에 접근
AssumeRoleWithSAML
- 유효한 ID provider에서 받은 인증이 포함된 SAML
응답을 전달할 수 있는 (외부) 사용자
SAML 2.0과 호환되는 엔터프라이즈 자격 증명 공급자 (ex. Window AD ,
OpenLDAP) 를 통한 연동
AssumeRoleWithWebIdentity
- 유효한 ID provider에서 받은 인증이 포함된 Web
Identity token 을 전달할 수 있는 (외부) 사용자
웹 기반 자격 증명 공급자를 통한 연동
(ex. Login with Amazon, Facebook, Google 또는 OpenID Connect(OIDC)
호환 자격 증명 공급자)
GetFederationToken
- IAM 사용자
- AWS 계정 루트 사용자
- ** IAM 사용자는 “사람” 보다는 장기 크리덴셜을
가지고 있는 사용자 혹은 어플리케이션으로
이해하는 것이 좋음
연동 사용자에게 임시 자격증명을 반환
(Assumerole 계열과 비슷하지만, role을 assume하지 않고 calller의 권한
을 사용하는 것이 차이점)
GetSessionToken
- IAM 사용자
- AWS 계정 루트 사용자
- ** IAM 사용자는 “사람” 보다는 장기 크리덴셜을
가지고 있는 사용자 혹은 어플리케이션으로
이해하는 것이 좋음
모바일 디바이스 혹은 웹 브라우저와 같이 덜 안전한 환경을 통해 접근하
는 IAM사용자가 있을 때 MFA 를 활성화하여 엑세스 보안을 강화
참고 : https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison
API reference : https://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html
AWS STS API
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AssumeRole - Request
AssumeRole
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AssumeRole - Response
AssumeRole
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
import boto3
sts = boto3.client('sts')
response = sts.assume_role(
RoleArn='arn:aws:iam::123456789012:role/EC2Adm',
RoleSessionName='Test')
• AssumeRole – Boto3
{
"Credentials":{
"AccessKeyId":"ASIAVVQ7FXHK625WN2VT",
"SecretAccessKey":"Q06oNEEk3xlZ9i2zWZ0EsPK+kLbqX9XoOTzl4nT1",
"SessionToken":"FwoGZXIvYXdzEKX(…생략…)ip7R",
"Expiration":datetime.datetime(2021, 3, 24, 4, 46, 54, "tzinfo=tzutc())"
},"AssumedRoleUser":{
"AssumedRoleId":"AROAIODZ4FZ4CBBRL5VSU:Test",
"Arn":"arn:aws:sts::123456789012:assumed-role/EC2Adm/Test"
},"ResponseMetadata":{
"RequestId":"97c4fec6-038e-4dd0-a2bd-2f289c7f78c8",
"HTTPStatusCode":200,
"HTTPHeaders":{
"x-amzn-requestid":"97c4fec6-038e-4dd0-a2bd-2f289c7f78c8",
"content-type":"text/xml",
"content-length":"1025",
"date":"Wed, 24 Mar 2021 03:46:53 GMT"
},"RetryAttempts":0
}
}
AssumeRole
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AssumeRoleWithWebIdentity를 호출하려면 지원되는 ID 공급자의 ID 토큰이 있어야하며
애플리케이션이 맡을 수 있는 역할(Role)을 만들어야 함
• AssumeRoleWithWebIdentity는 AWS 보안 자격 증명을 사용할 필요가 없음 따라서 애플리
케이션에 장기 AWS 자격 증명을 포함하지 않고도 임시 보안 자격 증명을 요청하는 애플리
케이션 (예 : 모바일 디바이스)을 배포 할 수 있음
• 모바일 애플리케이션을 위한 경우 다양한 접근 권한 및 사용자 관리가 가능한 Amazon
Cognito를 권장함
AssumeRoleWithWebIdentity
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AssumeRoleWithWebIdentity
• 워크플로우
id_token
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 역할을 수임 (AssumeRole)할 수 있는 권한을 부여하는 정책
• 연동 사용자에 대해 임시 보안 자격 증명을 생성할 수 있는 사용자 제한 권한을 부여하는 정책
STS 를 호출할 수 있는 권한
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MFA
GetSessionToken 작업의
목적은 MFA를 사용하는
사용자를 인증하는 것 !
STS 호출로 얻게 되는 권한 제어
IAM User
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
운영자를 위한 IAM
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLI Credential 구성 방법
[default]
aws_access_key_id = ACCESS_KEY_ID
aws_secret_access_key = SECRET_ACCESS_KEY_ID
[prod]
aws_access_key_id = ACCESS_KEY_ID
aws_secret_access_key = SECRET_ACCESS_KEY_ID
.aws/credentials
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Multi Profile
• --profile은 사용할 CLI 프로필의 이름을 지정할 때 유용합
니다.
• 프로필은 리소스에 대한 액세스를 관리하는 데 사용 가능한 액
세스 키 정보를 저장합니다.
CLI Credential 구성 방법
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Multi Profile
• 추가 프로필 사용 구성:
aws configure --profile <profile name>
• list, get 및 set 하위 명령과 조합하여 사용할 수 있습니다.
• 다음과 같이 “dev2” 프로필에 대한 기본 리전을 eu-west-1으로 설정합니다.
aws configure set region eu-west-1 --profile dev2
• 혹은, 해당 명령을 다음과 같이 구성할 수도 있습니다.
aws configure set profile.dev2.region eu-west-1
• 프로필을 사용하려면 다음과 같이 명령에 --profile 옵션을 추가합니다.
aws ec2 run-instances --image-id ami-12345 --profile dev2
CLI Credential 구성 방법
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLI 환경에 MFA 적용하기
• MFA 사용
• 사용자가 AWS 웹 사이트 또는 서비스에 액세스할 때 고유 인증 코드를 입력하도록 합
니다.
• CLI 기반, API 기반 및 콘솔 기반 액세스에 사용할 수 있습니다.
• 추가적인 보안 계층의 역할을 합니다.
• 주요 사용자라면 이를 사용하는 것이 좋습니다.
• 각 IAM 사용자에게 고유한 MFA 디바이스(하드웨어 또는 가상)를 할당합니다.
예제: AWS MFA 디바이스로 인증을 받은 경우에만
TerminateInstances와 같은 작업을 허용합니다.
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLI 환경에 MFA 적용하기
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CLI 환경에 MFA 적용하기
• $> aws configure 명령어를 이용해 credential 설정 (default 프로파일, IAM User)
• devops 유저와 신뢰 관계에 있는 role을 profile로 추가 설정 (./aws/config)
• 만약 default 프로파일에 role_arn, source_profile, mfa_serial 속성을 정의 하시면 --
profile 지정없이 mfa 적용된 role을 사용하실 수 있습니다.
[profile devops]
region = ap-northeast-2
role_arn = arn:aws:iam::123456789012:role/devops_role
source_profile = default
output = json
mfa_serial = arn:aws:iam::123456789012:mfa/devops
$> aws s3 ls --profile devops
Enter MFA code for
arn:aws:iam::123456789012:mfa/devops:
$❯ aws configure list --profile devops
Name Value Type Location
---- ----- ---- --------
profile s3adm manual --profile
access_key ****************QY6F assume-role
secret_key ****************j14M assume-role
region ap-northeast-2 config-file ~/.aws/config
STS에 의해
생성된 임시
자격증명
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• MFA 토큰을 사용하여 AWS CLI(AWS 명령줄 인터페이스)로 AWS 리소스에
대한 액세스를 인증하려면 어떻게 해야 합니까?
• MFA 보호는 임시 보안 자격 증명을 사용하는 경우에만 제공되며, 임시
보안 자격 증명은 AssumeRole 또는 GetSessionToken을 사용해 얻어야
합니다.
MFA 조건이 포함된 IAM 정책 사용자
$ aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code CODE_FROM_TOKEN
{
"Credentials": {
"SecretAccessKey": "secret-access-key",
"SessionToken": "temporary-session-token",
"Expiration": "expiration-date-time",
"AccessKeyId": "access-key-id"
}
}
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 환경 변수를 통한 임시 자격 증명 사용
• 자격 증명 우선 순위 이해가 중요함
• `aws configure list` 명령을 통해 적용된 credential 확인 가능
MFA 조건이 포함된 IAM 정책 사용자
export AWS_ACCESS_KEY_ID=example-access-key-as-in-previous-output
export AWS_SECRET_ACCESS_KEY=example-secret-access-key-as-in-previous-output
export AWS_SESSION_TOKEN=example-session-token-as-in-previous-output
❯ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************F4GG env
secret_key ****************OkXy env
region us-west-2 config-file ~/.aws/config
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Management
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ü IAM Policy Generator :
• https://awspolicygen.s3.amazona
ws.com/policygen.html
ü IAM Policy Sentry :
• https://github.com/salesforce/po
licy_sentry/
• pip 로 설치 가능한 라이브러리
로, CRUD 관점에서 ARN 만 나열하
면 최소 권한만 갖는 IAM Policy를
생성
ü IAM Policy Simulator
• https://policysim.aws.amazon.co
m/home/index.jsp?#
• 작성한 IAM 정책 테스트
IAM policy 작성 툴
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS
• 지정 날짜 범위 동안의 액세스 허용 (이 정책 보기)
• 지정 날짜 범위 동안 MFA를 사용하는 경우 특정 액세스를 허용(이 정책 보기)
• 소스 IP 주소를 바탕으로 AWS에 대한 액세스 거부(이 정책 보기)
정책 예제: AWS CodeCommit
• 프로그램 방식으로 콘솔에서 AWS CodeCommit 리포지토리에 대한 Read 액세스 허용(이 정책 보기)
정책 예제: AWS Data Pipeline
• 사용자가 생성하지 않은 파이프라인에 대한 액세스 거부(이 정책 보기)
정책 예제: Amazon DynamoDB
• 특정 Amazon DynamoDB 테이블에 대한 액세스 허용(이 정책 보기)
• 특정 Amazon DynamoDB 열에 대한 액세스 허용(이 정책 보기)
• Amazon Cognito ID를 기준으로 Amazon DynamoDB에 대한 행 수준 액세스를 허용(이 정책 보기)
정책 예제: Amazon EC2
• Amazon EC2 인스턴스가 볼륨을 연결 또는 분리하도록 허용 (이 정책 보기)
• 태그를 기준으로 Amazon EBS 볼륨을 Amazon EC2 인스턴스에 연결 또는 분리하도록 허용(이 정책 보기)
• 특정 서브넷에 있는 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작할 수 있도록 허용(이 정책 보기)
• 특정 VPC와 관련된 Amazon EC2 보안 그룹을 프로그래밍 방식으로 콘솔에서 관리할 수 있도록 허용(이 정책 보기)
• 사용자가 태그를 지정한 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작 또는 중지할 수 있도록 허용(이 정책 보기)
• 리소스 및 보안 주체 태그 기반의 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작 또는 중지할 수 있도록 허용(이 정책 보기)
• 리소스 및 주요 태그가 일치할 때 Amazon EC2 인스턴스를 시작 또는 중지할 수 있도록 허용(이 정책 보기)
• 특정 리전 내에서의 모든 Amazon EC2 액세스를 프로그래밍 방식으로 콘솔에서 허용(이 정책 보기)
• 프로그래밍 방식으로 콘솔에서 특정 Amazon EC2 인스턴스를 시작 또는 중지하고 특정 보안 그룹을 수정할 수 있도록 허용(이 정책 보기)
• Amazon EC2 인스턴스 종료를 특정 IP 주소 범위로 제한(이 정책 보기)
IAM 샘플 정책 활용 - 1
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Identity and Access Management(IAM)
• 정책 시뮬레이터 API에 대한 액세스 허용(이 정책 보기)
• 정책 시뮬레이터 콘솔에 대한 액세스 허용(이 정책 보기)
• 프로그래밍 방식 및 콘솔에서 특정 태그가 있는 IAM 사용자에게 또 다른 특정 태그를 추가할 수 있도록 허용(이 정책 보기)
• 프로그래밍 방식 및 콘솔에서 IAM 사용자 또는 역할에게 특정 태그를 추가할 수 있도록 허용(이 정책 보기)
• 특정 태그가 있는 새 사용자만 만들 수 있도록 허용(이 정책 보기)
• 특정 태그를 관리하도록 허용(이 정책 보기)
• 특정 경로를 지닌 사용자에 대해 정책 시뮬레이터 API의 사용을 허용(이 정책 보기)
• 특정 경로를 지닌 사용자에 대해 정책 시뮬레이터 콘솔의 사용을 허용(이 정책 보기)
• IAM 사용자가 MFA 디바이스를 스스로 관리하도록 허용(이 정책 보기)
• IAM 사용자가 프로그램 방식으로 콘솔에서 자신의 자격 증명을 교체하도록 허용(이 정책 보기)
• 신규 IAM 사용자, 그룹 또는 역할에 적용 가능한 관리형 정책을 제한(이 정책 보기)
Amazon RDS
• 특정 리전에 있는 Amazon RDS에 대한 완전한 액세스 허용(이 정책 보기)
• Amazon RDS 데이터베이스를 프로그램 방식으로 콘솔에서 복원하도록 허용(이 정책 보기)
• 태그 소유자가 자신이 태그를 지정한 Amazon RDS 리소스에 대한 모든 액세스 권한을 가지도록 허용(이 정책 보기)
Amazon S3
• Amazon Cognito 사용자가 자신의 Amazon S3 버킷에 있는 객체에 액세스하도록 허용(이 정책 보기)
• IAM 사용자가 프로그램 방식으로 콘솔에서 Amazon S3에 있는 자신의 홈 디렉터리에 액세스하도록 허용(이 정책 보기)
• 사용자가 하나의 Amazon S3 버킷을 관리하고 다른 모든 AWS 작업 및 리소스를 거부하도록 허용(이 정책 보기)
• 특정 Amazon S3 버킷에 대한 Read 및 Write 액세스 허용(이 정책 보기)
• 특정 Amazon S3 버킷에 대해 프로그래밍 방식으로 콘솔에서 Read 및 Write 액세스 허용(이 정책 보기)
IAM 샘플 정책 활용 - 2
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• IAM에 대해 서비스에서 마지막으로 액세스한 데이터를 조회
• 불필요한 권한을 제거하고 least privileged 를 유지할 수 있음
"ServicesLastAccessed": [
{
"LastAuthenticated": "2018-11-21T17:41:15Z",
"LastAuthenticatedEntity": "arn:aws:iam::123456789012:role
"ServiceName": "Amazon EC2",
"ServiceNamespace": "ec2", "TotalAuthenticatedEntities": 1
},
IAM Access Advisor
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• S3, EC2, IAM, Lambda management action 에 대해서는 action단위로 조회 가능.
• Fine-grained S3 버킷 정책을 위해 활용
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
마지막으로 password를 바꾼 날짜
MFA 활성화 여부
IAM Credential Report
• 계정의 모든 사용자와 암호, 액세스 키, MFA 디바이스 등 자격 증명 상태를 나열하는 보고서
• 감사 및 규정 준수에 도움
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Access Analyzer
• 리소스에 대한 public 혹은 crosss-account access를 검사하여 과도하게 권한이 주어진 자원을 판별
• analyzer결과로 내 계정 내, 외부에서 액세스 가능한 리소스 리스트를 보여주고, Next step을 제안
• 상시 모니터링 / 탐색으로 정책이 변경되는 순간 탐지 è Security hub로 전달
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Access Analyzer
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Access Analyzer 확장
preview & validate
public & cross account access
policy validation
policy generation
Fine-Grained!!!
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
개발 팀 테스트 계정 Sandbox
Product 계정 보안 계정
1. 업로드된 IAM
Policy 유효성 검증
2. 필수 ”명시적 Deny”
추가
3. 사용자 계정 내 최종
Policy 생성
IAM 정책 생성 자동화
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
오픈 소스를 활용한 IAM 권한 관리
• policy_sentry : IAM Least Privilege Policy Generator 도구
• parliament : IAM linting library로, 작성한 정책 리뷰 (예: 잘못된 json, 필수 요소 누락 등)
• Netflix aardvark / repokid : access advisor 기반으로 정보를 조회하고 불필요한 권한을 제거
• iamctl : 두개의 계정에서 IAM 역할 및 정책을 추출하고 비교하고 차이점과 통계를보고
• Cloudsplaininng : 최소 권한 위반을 식별하고 위험 우선 순위가 지정된 HTML 보고서를 생성
• cloudtracker : CloudTrail 로그를 현재 IAM 정책과 비교하여 과도한 권한이있는 IAM 사용자 및 역할 색출
• TrailScraper : AWS CloudTrail에서 정보를 가져 오는 명령 줄 도구 / IAM 정책 작업
• Aaia : IAM에 대한 시각화 및 이상탐지
• aws-key-disabler : 일정시간 이후 IAM User Access key 비활성화
• git-secrets : AWS 자격증명이 GIT 환경에 노출되었는지 Scanning
• gitleaks : 주요 자격증명 패턴 검색
• gitgadian : 자격 증명에 대한 자동화된 비밀 검색 및 조치
• spacesiren : 허니 토큰 관리/경고 시스템
• aws-vault : 개발 환경에서 AWS 자격증명 안전하게 보관 및 접근
• etc…
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
예 : IAM 최소 권한 유지 및 관리
Aardvark Repokid
미사용 서비스 삭제
Policy 사용 체크
90일 이상?
미사용 서비스?
커스텀 정책
Yes
Yes
Yes
No
No
No
반복 체크
IAM 의 Access Advisor 정보를 조회 불필요한 권한 삭제
• Netflix aardvark / repokid : https://netflixtechblog.com/introducing-aardvark-and-repokid-53b081bf3a7e
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GIT Hub – IAM AccessKey Disabler
• 주기적으로 기한이 지난 엑세스 키페어 비활성화 조치(삭제는 안됨)
• https://github.com/te-papa/aws-key-disabler
예 : GIT샘플 - IAM 자격증명 라이프 싸이클 관리
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GIT Hub – git-secrets
• AWS 자격증명이 GIT 환경에 노출되었는지 Scanning
• 오탐률을 줄이기 위해 정규식 패턴 지원
• https://github.com/awslabs/git-secrets
GIT Hub – Gitleaks
• 중요 자격증명 패턴 검색
(벌크스캔 / CI 도구를 통한 Pull 방식 스캔)
• Private repository scanning 지원
• https://github.com/zricethezav/gitleaks
예 : GIT샘플 - 유출된 중요 자격증명 탐색
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
예 : IAM 시각화 및 이상 탐지
GIT Hub – Aaia (Analysis of Identity and Access)
• IAM 시각화 및 이상 탐지
• https://github.com/rams3sh/Aaia
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
예 : 자격증명 보관
AWS-VAULT
• CLI를 사용을 위해 MFA와 STS를 적용 시키더라도 default 프로파일에서 사용되는 credential을 .aws/credential 파일에 존재
• 해당 credential에는 STS 호출 권한만 가지고 있지만 추가적인 보안을 하고자 할 경우 credential을 암호화
(MacOs의 경우 KeyChain에 암호화 하여 저장)
• https://github.com/99designs/aws-vault
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
컴플라이언스 체크 : AWS Config Rules
• Config : AWS리소스의 변경사항을 추적하고 감사하는 서비스
• Config Rules : 해당 변경 사항이 기준 정책에 위반될 때, 대응 규칙 실행(경보, 차단 등 AWS Lambda활용).
변경된 리소스들 Config Rules
이력, 스냅샷
SNS Topic
API 접근
정규화
AWS Config
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
보안 위협 탐지 : Amazon GuardDuty
VPC flow logs
DNS Logs
CloudTrail
Events
위험도
데이터 소스
Threat intelligence
Anomaly Detection
(ML)
AWS Security Hub
• 경감조치
• 파트너 제품 연계
• SIEM으로 전달
CloudWatch Event
탐지 케이스
Examples:
• 비트코인 마이닝
• C&C 관련 행동
• 악성 IP / Tor 접근
• Brute Force
• …
비정상적인 사용자 행동
Example:
• 인스턴스 시작
• 네트웍 권한/구성 변경
Amazon GuardDuty
위협탐지 유형
HIGH
MEDIUM
LOW
비정상적인 트래픽 패턴
Example:
• 비정상적인 트래픽 볼륨
• 사용한 적이 없는 포트
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
보안 위협 탐지 : Amazon GuardDuty
• UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration
Default severity: High
VPC
Ooops!!
EC2
APIs
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
API 활동 기록 및 감사 : AWS CloudTail
• AWS API 요청의 처리내역을 로깅하는 서비스.
CloudTrail
콘솔 AWS SDK CLI
S3
AWS 파트너
네트워크
ElasticSearch EMR/Redshift
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Who? When? What?
Where to
?
Where from?
Bill 3:27pm Launch Instance us-west-2 72.21.198.64
Alice 8:19am Added Bob to admin grou
p
us-east-1 127.0.0.1
Steve 2:22pm Deleted security group eu-west-1 205.251.233.176
AWS CloudTail 로그
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• IAM principal - AWS 어카운트 내에 정의된 요청 주체(Identity)
• CloudTrail ‘userIdentity’ 요소 기준, 다음 사용자 유형을 구별 :
1. Root– API 요청이 AWS Account 자격 증명을 사용
2. IAM User – API 요청이 IAM User의 자격 증명을 사용
3. Assumed Role – API 요청이 AWS STS AssumeRole API 호출을 통해 역할로 획득된 임시 보안 자격 증명을 사용
4. Federated User – API 요청이 AWS STS GetFederationToken API 호출을 통해 획득한 임시 보안 자격 증명을 사용
5. AWS Account – 다른 AWS Account에서 요청
6. AWS Service – AWS 서비스에 속한 AWS 계정을 통해 요청
• SAML이나 WebIdentity Federation을 하는 경우 :
1. SAMLUser – SAML 어설션이 이루어지는 요청
2. WebIdentityUser – 웹 자격 증명 연동 제공업체로 이루어지는 요청.
CloudTrail 기록에서의 IAM 보안 주체
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
STS 를 이용한 보안 강화 및 감사 예시
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CloudTrail을 통한 STS API 감사
AWS Cloud AWS Cloud
{
"eventVersion": "1.05",
"userIdentity": {
"type": "AssumedRole",
"principalId": "AROA6O4DS6EKUUTZB565I:i-03c304b61867e7052",
"arn": "arn:aws:sts::994024026389:assumed-role/test-role-ec2-cross/i-03c304b61867e7052",
"accountId": "994024026389",
"accessKeyId": "ASIA6O4DS6EKVDRF6IE2",
"sessionContext": {
"sessionIssuer": {
"type": "Role",
"principalId": "AROA6O4DS6EKUUTZB565I",
"arn": "arn:aws:iam::994024026389:role/test-role-ec2-cross",
"accountId": "994024026389",
"userName": "test-role-ec2-cross"
},
...
}
},
"eventTime": "2020-08-07T02:30:51Z",
"eventSource": "sts.amazonaws.com",
"eventName": "AssumeRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "15.164.93.199",
"userAgent": ”…": {
"roleArn": "arn:aws:iam::166642409121:role/test-role-cross-s3",
"roleSessionName": ”myname"
},
}
역순으로 확인
{
"eventVersion": "1.07",
"userIdentity": {
"type": "AssumedRole",
"principalId": "AROASNTFJL2QSHCHTDVN3:hoseok-nim",
"arn": "arn:aws:sts::166642409121:assumed-role/test-role-cross-s3/myname",
"accountId": "166642409121",
"accessKeyId": "ASIASNTFJL2QTERQGOUF",
"sessionContext": {
"sessionIssuer": {
"type": "Role",
"principalId": "AROASNTFJL2QSHCHTDVN3",
"arn": "arn:aws:iam::166642409121:role/test-role-cross-s3",
"accountId": "166642409121",
"userName": "test-role-cross-s3"
},
"attributes": {
"creationDate": "2020-08-07T02:30:51Z",
"mfaAuthenticated": "false"
}
}
},
"eventTime": "2020-08-07T02:42:40Z",
"eventSource": "s3.amazonaws.com",
"eventName": "ListObjects",
"awsRegion": "ap-northeast-2",
"sourceIPAddress": "15.164.93.199",
…
},
{
"eventVersion": "1.05",
"userIdentity": {
"type": "AWSAccount",
"principalId": "AROA6O4DS6EKUUTZB565I:i-03c304b61867e7052",
"accountId": "994024026389"
},
"eventTime": "2020-08-07T02:30:51Z",
"eventSource": "sts.amazonaws.com",
"eventName": "AssumeRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "15.164.93.199",
"userAgent": ”…",
"requestParameters": {
"roleArn": "arn:aws:iam::166642409121:role/test-role-cross-s3",
"roleSessionName": ”myname"
},
},
"sharedEventID": "ec312aa3-1bec-4137-b5aa-b36aa855360b"
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
assumerole할때 aws sts assume-role --role-arn "arn:aws:iam::079681958650:role/<role_name>" --role-session-n
ame “<my_name>”에서 --role-session-name가 역할 수임하는 어카운트에 기록이 되는데 해당 값이 임으로
입력할 수 있는 값이다 보니 로깅을 속일 수 있지 않나?
• STS에서 role-session-name을 사용자명만 사용할 수 있게 강제
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-sts
STS 를 이용한 보안 강화 및 감사 예시
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Wrap-up
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key Takeaway
• Everything API
• IAM은 인증과 인가를 모두 제어하는 통합 서비스
• IAM 의 다양한 policy 종류와 활용
• STS Best Practice !!
• IAM 최소권한 유지와 로깅&감사
감사합니다.

More Related Content

What's hot

Using AWS Control Tower to govern multi-account AWS environments at scale - G...
Using AWS Control Tower to govern multi-account AWS environments at scale - G...Using AWS Control Tower to govern multi-account AWS environments at scale - G...
Using AWS Control Tower to govern multi-account AWS environments at scale - G...
Amazon Web Services
 
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
Amazon Web Services Korea
 

What's hot (20)

AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
 
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
 
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
 
Amazon OpenSearch Deep dive - 내부구조, 성능최적화 그리고 스케일링
Amazon OpenSearch Deep dive - 내부구조, 성능최적화 그리고 스케일링Amazon OpenSearch Deep dive - 내부구조, 성능최적화 그리고 스케일링
Amazon OpenSearch Deep dive - 내부구조, 성능최적화 그리고 스케일링
 
AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
AWS 네트워크 보안을 위한 계층별 보안 구성 모범 사례 – 조이정, AWS 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
 
더욱 진화하는 AWS 네트워크 보안 - 신은수 AWS 시큐리티 스페셜리스트 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
더욱 진화하는 AWS 네트워크 보안 - 신은수 AWS 시큐리티 스페셜리스트 솔루션즈 아키텍트 :: AWS Summit Seoul 2021더욱 진화하는 AWS 네트워크 보안 - 신은수 AWS 시큐리티 스페셜리스트 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
더욱 진화하는 AWS 네트워크 보안 - 신은수 AWS 시큐리티 스페셜리스트 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
 
Using AWS Control Tower to govern multi-account AWS environments at scale - G...
Using AWS Control Tower to govern multi-account AWS environments at scale - G...Using AWS Control Tower to govern multi-account AWS environments at scale - G...
Using AWS Control Tower to govern multi-account AWS environments at scale - G...
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
 
AWS Summit Seoul 2023 | AWS에서 OpenTelemetry 기반의 애플리케이션 Observability 구축/활용하기
AWS Summit Seoul 2023 | AWS에서 OpenTelemetry 기반의 애플리케이션 Observability 구축/활용하기AWS Summit Seoul 2023 | AWS에서 OpenTelemetry 기반의 애플리케이션 Observability 구축/활용하기
AWS Summit Seoul 2023 | AWS에서 OpenTelemetry 기반의 애플리케이션 Observability 구축/활용하기
 
AWS Monitoring & Logging
AWS Monitoring & LoggingAWS Monitoring & Logging
AWS Monitoring & Logging
 
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
 
Amazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for KubernetesAmazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for Kubernetes
 
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
AWS 고객이 주로 겪는 운영 이슈에 대한 해법-AWS Summit Seoul 2017
 
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS에서 분산 서비스 거부 공격(DDoS)을 고민하지 않는 ...
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS에서 분산 서비스 거부 공격(DDoS)을 고민하지 않는 ...[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS에서 분산 서비스 거부 공격(DDoS)을 고민하지 않는 ...
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | AWS에서 분산 서비스 거부 공격(DDoS)을 고민하지 않는 ...
 
20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive
20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive
20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive
 
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
 
AWS Summit Seoul 2023 | 당신만 모르고 있는 AWS 컨트롤 타워 트렌드
AWS Summit Seoul 2023 | 당신만 모르고 있는 AWS 컨트롤 타워 트렌드AWS Summit Seoul 2023 | 당신만 모르고 있는 AWS 컨트롤 타워 트렌드
AWS Summit Seoul 2023 | 당신만 모르고 있는 AWS 컨트롤 타워 트렌드
 
20190130 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...
20190130 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...20190130 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...
20190130 AWS Black Belt Online Seminar AWS Identity and Access Management (AW...
 
Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나
Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나
Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나
 
Deploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control TowerDeploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control Tower
 

Similar to AWS Builders - Industry Edition: DevSecOps on AWS - 시작은 IAM 부터

클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018 클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
Amazon Web Services Korea
 
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
Amazon Web Services Korea
 
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
Amazon Web Services Korea
 

Similar to AWS Builders - Industry Edition: DevSecOps on AWS - 시작은 IAM 부터 (20)

클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018 클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
클라우드 여정을 성공적으로 수행하기 위한 AWS IAM 활용 전략::최원근:: AWS Summit Seoul 2018
 
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 보안 - 최원근 AWS 솔루션즈 ...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 보안 - 최원근 AWS 솔루션즈 ...[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 보안 - 최원근 AWS 솔루션즈 ...
[Games on AWS 2019] AWS 입문자를 위한 초단기 레벨업 트랙 | AWS 레벨업 하기! : 보안 - 최원근 AWS 솔루션즈 ...
 
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
 
20150109 - AWS BlackBelt - IAM (Korean)
20150109 - AWS BlackBelt - IAM (Korean)20150109 - AWS BlackBelt - IAM (Korean)
20150109 - AWS BlackBelt - IAM (Korean)
 
[AWS Builders] AWS IAM 을 통한 클라우드에서의 권한 관리 - 신은수, AWS Security Specialist SA
[AWS Builders] AWS IAM 을 통한 클라우드에서의 권한 관리 - 신은수, AWS Security Specialist SA[AWS Builders] AWS IAM 을 통한 클라우드에서의 권한 관리 - 신은수, AWS Security Specialist SA
[AWS Builders] AWS IAM 을 통한 클라우드에서의 권한 관리 - 신은수, AWS Security Specialist SA
 
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
 
AWS Builders - Industry Edition: DevSecOps, Application Security Enforcement
AWS Builders - Industry Edition: DevSecOps, Application Security EnforcementAWS Builders - Industry Edition: DevSecOps, Application Security Enforcement
AWS Builders - Industry Edition: DevSecOps, Application Security Enforcement
 
202003 AWS ISV/DNB IAM_webinar
202003 AWS ISV/DNB IAM_webinar202003 AWS ISV/DNB IAM_webinar
202003 AWS ISV/DNB IAM_webinar
 
회사 계정/패스워드 그대로 AWS 관리 콘솔 및 EC2 인스턴스 사용하기 - 이정훈, AWS 솔루션즈 아키텍트:: AWS Summit O...
회사 계정/패스워드 그대로 AWS 관리 콘솔 및 EC2 인스턴스 사용하기 - 이정훈, AWS 솔루션즈 아키텍트::  AWS Summit O...회사 계정/패스워드 그대로 AWS 관리 콘솔 및 EC2 인스턴스 사용하기 - 이정훈, AWS 솔루션즈 아키텍트::  AWS Summit O...
회사 계정/패스워드 그대로 AWS 관리 콘솔 및 EC2 인스턴스 사용하기 - 이정훈, AWS 솔루션즈 아키텍트:: AWS Summit O...
 
2017 AWSome Day Online Conference - 강의 3. AWS 보안 및 AWS Identity and Access Ma...
2017 AWSome Day Online Conference - 강의 3. AWS 보안 및 AWS Identity and Access Ma...2017 AWSome Day Online Conference - 강의 3. AWS 보안 및 AWS Identity and Access Ma...
2017 AWSome Day Online Conference - 강의 3. AWS 보안 및 AWS Identity and Access Ma...
 
보안 사고 예방을 위한 주요 AWS 모범 사례 – 신은수, AWS 보안 담당 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
보안 사고 예방을 위한 주요 AWS 모범 사례 – 신은수, AWS 보안 담당 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집보안 사고 예방을 위한 주요 AWS 모범 사례 – 신은수, AWS 보안 담당 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
보안 사고 예방을 위한 주요 AWS 모범 사례 – 신은수, AWS 보안 담당 솔루션즈 아키텍트:: AWS 온라인 이벤트 – 클라우드 보안 특집
 
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
강의 3. AWS 보안 및 AWS Identity and Access Managment (IAM)::AWSome Day Online Con...
 
AWS risk_detection_webinar
AWS risk_detection_webinarAWS risk_detection_webinar
AWS risk_detection_webinar
 
클라우드 핀테크 규제 준수를 위한 AWS 서비스 – 김지민 AWS 스타트업 솔루션즈 아키텍트, 박범준 AWS 스타트업 어카운트 매니저:: ...
클라우드 핀테크 규제 준수를 위한 AWS 서비스 – 김지민 AWS 스타트업 솔루션즈 아키텍트, 박범준 AWS 스타트업 어카운트 매니저:: ...클라우드 핀테크 규제 준수를 위한 AWS 서비스 – 김지민 AWS 스타트업 솔루션즈 아키텍트, 박범준 AWS 스타트업 어카운트 매니저:: ...
클라우드 핀테크 규제 준수를 위한 AWS 서비스 – 김지민 AWS 스타트업 솔루션즈 아키텍트, 박범준 AWS 스타트업 어카운트 매니저:: ...
 
AWS Builders - Industry Edition : Welcome to Security Modernization
AWS Builders - Industry Edition : Welcome to Security ModernizationAWS Builders - Industry Edition : Welcome to Security Modernization
AWS Builders - Industry Edition : Welcome to Security Modernization
 
클라우드 애플리케이션 보안 - 장기웅, AWS 테크니컬 트레이너 :: AWSome Day 온라인 컨퍼런스
클라우드 애플리케이션 보안 - 장기웅, AWS 테크니컬 트레이너 :: AWSome Day 온라인 컨퍼런스클라우드 애플리케이션 보안 - 장기웅, AWS 테크니컬 트레이너 :: AWSome Day 온라인 컨퍼런스
클라우드 애플리케이션 보안 - 장기웅, AWS 테크니컬 트레이너 :: AWSome Day 온라인 컨퍼런스
 
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
천만 사용자를 위한 AWS 클라우드 아키텍처 진화하기::이창수::AWS Summit Seoul 2018
 
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
 
[AWS & 베스핀글로벌, 바이오∙헬스케어∙제약사를 위한 세미나] AWS 클라우드 보안
[AWS & 베스핀글로벌, 바이오∙헬스케어∙제약사를 위한 세미나] AWS 클라우드 보안[AWS & 베스핀글로벌, 바이오∙헬스케어∙제약사를 위한 세미나] AWS 클라우드 보안
[AWS & 베스핀글로벌, 바이오∙헬스케어∙제약사를 위한 세미나] AWS 클라우드 보안
 
AWS와 함께하는 클라우드 컴퓨팅 - 강철, AWS 어카운트 매니저 :: AWS Builders 100
AWS와 함께하는 클라우드 컴퓨팅 - 강철, AWS 어카운트 매니저 :: AWS Builders 100AWS와 함께하는 클라우드 컴퓨팅 - 강철, AWS 어카운트 매니저 :: AWS Builders 100
AWS와 함께하는 클라우드 컴퓨팅 - 강철, AWS 어카운트 매니저 :: AWS Builders 100
 

More from Amazon Web Services Korea

More from Amazon Web Services Korea (20)

AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 2AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 2
 
AWS Modern Infra with Storage Roadshow 2023 - Day 1
AWS Modern Infra with Storage Roadshow 2023 - Day 1AWS Modern Infra with Storage Roadshow 2023 - Day 1
AWS Modern Infra with Storage Roadshow 2023 - Day 1
 
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
 
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
 
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
 
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
 
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
 
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
 
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
 
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
 
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...
 
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
 
From Insights to Action, How to build and maintain a Data Driven Organization...
From Insights to Action, How to build and maintain a Data Driven Organization...From Insights to Action, How to build and maintain a Data Driven Organization...
From Insights to Action, How to build and maintain a Data Driven Organization...
 
[Keynote] Accelerating Business Outcomes with AWS Data - 발표자: Saeed Gharadagh...
[Keynote] Accelerating Business Outcomes with AWS Data - 발표자: Saeed Gharadagh...[Keynote] Accelerating Business Outcomes with AWS Data - 발표자: Saeed Gharadagh...
[Keynote] Accelerating Business Outcomes with AWS Data - 발표자: Saeed Gharadagh...
 
Amazon DynamoDB - Use Cases and Cost Optimization - 발표자: 이혁, DynamoDB Special...
Amazon DynamoDB - Use Cases and Cost Optimization - 발표자: 이혁, DynamoDB Special...Amazon DynamoDB - Use Cases and Cost Optimization - 발표자: 이혁, DynamoDB Special...
Amazon DynamoDB - Use Cases and Cost Optimization - 발표자: 이혁, DynamoDB Special...
 
LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...
LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...
LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...
 
KB국민카드 - 클라우드 기반 분석 플랫폼 혁신 여정 - 발표자: 박창용 과장, 데이터전략본부, AI혁신부, KB카드│강병억, Soluti...
KB국민카드 - 클라우드 기반 분석 플랫폼 혁신 여정 - 발표자: 박창용 과장, 데이터전략본부, AI혁신부, KB카드│강병억, Soluti...KB국민카드 - 클라우드 기반 분석 플랫폼 혁신 여정 - 발표자: 박창용 과장, 데이터전략본부, AI혁신부, KB카드│강병억, Soluti...
KB국민카드 - 클라우드 기반 분석 플랫폼 혁신 여정 - 발표자: 박창용 과장, 데이터전략본부, AI혁신부, KB카드│강병억, Soluti...
 
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
 
코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...
코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...
코리안리 - 데이터 분석 플랫폼 구축 여정, 그 시작과 과제 - 발표자: 김석기 그룹장, 데이터비즈니스센터, 메가존클라우드 ::: AWS ...
 
LG 이노텍 - Amazon Redshift Serverless를 활용한 데이터 분석 플랫폼 혁신 과정 - 발표자: 유재상 선임, LG이노...
LG 이노텍 - Amazon Redshift Serverless를 활용한 데이터 분석 플랫폼 혁신 과정 - 발표자: 유재상 선임, LG이노...LG 이노텍 - Amazon Redshift Serverless를 활용한 데이터 분석 플랫폼 혁신 과정 - 발표자: 유재상 선임, LG이노...
LG 이노텍 - Amazon Redshift Serverless를 활용한 데이터 분석 플랫폼 혁신 과정 - 발표자: 유재상 선임, LG이노...
 

AWS Builders - Industry Edition: DevSecOps on AWS - 시작은 IAM 부터

  • 1. DevSecOps : IAM 조이정 | AWS 솔루션즈 아키텍트 Security Modernization – DevSecOps on AWS
  • 2. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Agenda • Why IAM ? • AWS IAM (Authentication & Authorization) • IAM policy • IAM policy 사용 예시 Break Time • STS / Identity federation • 운영자를 위한 IAM • IAM Management
  • 3. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Why IAM ?
  • 4. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS를 즐기는 방법 SDK AWS console Command Line Interface
  • 5. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 자연스러운 흐름 … Console 기반 작업 High level Low level
  • 6. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Script 기반 Low lev el Console 기반 작업 High level Low level 자연스러운 흐름 …
  • 7. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 프로비저닝 엔진 사용 AWS CloudFormation template (JSON/YAML) HashiCorp Configuration Language (HCL) 원하는 형상에 대한 정의 자연스러운 흐름 … Script 기반 Low lev el Console 기반 작업 High level Low level
  • 8. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CDK application Stack(s) Construct Construct DOM 기반 AWS CloudFormati on template 리소스 생성 CDK CLI 자연스러운 흐름 … 프로비저닝 엔진 사용 Script 기반 Low lev el Console 기반 작업 High level Low level
  • 9. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Cloud CloudWatch Cloud Formation CloudTrail Event ELB API API API 결국, API
  • 10. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • 매 API호출 마다, AWS CLI 및 SDK 등에서 처리됨 POST https://dynamodb.us-east-2.amazonaws.com/ HTTP/1.1 Host: dynamodb.us-east-2.amazonaws.com X-Amz-Date: 20180918T150746Z X-Amz-Target: DynamoDB_20120810.ListTables X-Amz-Security-Token: FQoGZXIvYXdzEKH////////// … Content-Type: application/x-amz-json-1.0 Authorization: AWS4-HMAC-SHA256 Credential=ASIAXXXXXXXXXX XXXXXX/20180918/us-east-1/dynamodb/aws4_request, SignedHead ers=content-type;host;x-amz-date;x-amz-security-token;x-amz-targe t, Signature=c1b4bc2df0c47c86cbcfa54d932e8aaa455b6b7c38e65d 840f722254add1ea9e 비밀키로 생성한 HMAC 서명값(Sig v4) 검증 Amazon DynamoDB AWS에서의 API 인증 Access Key ID로 요청주체 (IAM Principal)를 인증
  • 11. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • AWS에 HTTP 요청을 보낼 경우, 요청자를 확인하기 위해 요청에 서명(sign)을 한 후 보내야 함 – HTTP 요청 헤더 또는 URL query string • AWS CLI 또는 SDK를 사용할 경우, 별도의 작업 없이 자동 서명하여 요청함 • 모든 요청은 Timestamp가 포함된 서명이 있어 Replay 공격이 제한됨 (보통 5분 이내) • 모든 리전과 서비스*는 SIG v4를 지원하므로 SIG v4 사용 권고 Sig v4(Signature Version 4)
  • 12. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS IAM(Identity and Access Management)
  • 13. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 인증과 인가 Who you are What you can do
  • 14. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 인증과 인가 on AWS 적법한 서명값을 가지고 있는가? (인증) 어떤 API 권한을 수행할 수 있는가 ? (인가) IAM 은 AWS 전체의 권한 통제 시스템.
  • 15. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 인증과 인가 on AWS 적법한 서명값을 가지고 있는가? (인증) 어떤 API 권한을 수행할 수 있는가 ? (인가) 보안주체 정책 정의
  • 16. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Quick Skim • 모든 서비스에 대한 접근 (권한 조정 불가) • 콘솔과 API에 대한 접근 • 빌링 및 고객 지원 (Customer Support)에 대한 접근 Root (Super User) • 특정 서비스에 대한 접근 • 콘솔, API에 대한 선택적 접근 • 고객 지원 (Customer support) 에 대한 접근 • password / Long term credential 사용 IAM Users • IAM 사용자 관리 편리성을 제공 • 권한을 한꺼번에 주기 위한 용도 • IAM사용자는 복수개의 그룹에 속할 수 있음 IAM Group • 특정 서비스에 대한 접근 • 콘솔, API에 대한 선택적 접근 • 고객 지원 (Customer support) 에 대한 접근 • temp credential 사용 IAM Role Policy • 권한은 요청이 허용되거나 거부되는지 여부를 결정 • JSON 문서로 작성
  • 17. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Quick Skim Long term credential temp credential "AccessKeyId": "AKIASNTFJL2Q6RGAPHF5”, "SecretAccessKey": "gJo+deDQbBOzFOHzErVQu7IJI/27u6osTyEIi7tv” "AccessKeyId": "ASIA6O4DS6EKQQETCFMV", "SecretAccessKey": "UeEBQbQESgxbTUmuKY2e9fRKRHO7nFIJV4Qgo CSk", "SessionToken": "IQoJb3JpZ2luX2VjEPX//////////wEaCXVzLXdlc3Qt MiJHMEUCIQDoNoFb7HVSeTb31luaYKgKL0AMbbAxoaumo8CrzzxIqQ IgA6gsaM4DCuoEmH8mcNXVfRkUZ9hH2szm7LbfgN777ZEqkQIILhA BGgw5OTQwMjQwMjYzODkiDK1EbNlFN51ku8eGwSruAQKxRMFlV4h H+V95zVnN798S2gH8KABBbj9P+X3rD8Nqp1rtfVjVAD0t5Mn71aeN3j OmCJP47VUMmOHn3loKtU8i6Lav1hXYiXm/0V0E31leYNbbzjYL2L84 rSqwYsmtxC0zCkZwuVyRJ+XB/gj4ZWJN8ITr3y2IfcuBJeRBSj9sW6Wjb WNghzuONoqmkVHzKs7FKbP/eylaKmWfR9dYnXwOxtGf+6GShBoEC sPujzMufk6+qyJlMC+JfiBSMsIwdE/xW1zoYQ+Ayks1Z5bsJcGvXnN7hf rqMq5SruVCBdXL/URO1fQGRDunxIAkOmowsuvHggY6nQFbkFYM4jf GVCjM4H3bfGnDvRV6M9mjeKxji4juVE2tu5dpk3c0x9pHfqh+u6AxVGJ aNiGW0gM8aG6czuMG8ji7T1AvVNmFBiC3VkIvM7C4OdZQeK6Hsvyd 51aVUZTXF10iHAppJxHyx0pIUVuI43nuxj6l2ZCbtz1wSpr1MgAotPe5A 1aUbuEw9eD0VSxp9WFGxJzKUwx/gz+6mmjp", "Expiration": "2021-03-17T13:27:30+00:00”
  • 18. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM 역할(Role) AWS services AWS account / IAM User Identity provider Assume AWS API AWS Cloud IAM role
  • 19. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM 역할(Role) • 권한의 위임 체계를 지원하기 위한 용도 • 동일 또는 타 어카운트, AWS 서비스(EC2, 람다 등), 외부인증연계(Federated) 사용자에 부여될 수 있음 • IAM 역할을 수임한 IAM 사용자에게는 본래 권한 대신 IAM역할에서 규정된 권한으로 대체됨. • 신뢰정책(해당 역할을 할 수 있는 보안주체 규정)과 권한정책(해당 역할에 부여될 권한을 규정)이 할당됨. • 보안주체를 규정할 때는 * 을 사용할 수 없으며, 수임(AssumeRole) 조건으로 MFA를 지원함.
  • 20. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM policy
  • 21. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS IAM 정책 (policy) • 모든 AWS 서비스는 접근제어 정책을 기반으로 인가 • 매 API호출 시, 적용된 정책을 통해 인가 수행 • IAM 역할/사용자/그룹, AWS 리소스, 임시 자격증명 세션, OU 등 에 적용 가능 • AWS Root 어카운트는 기본적으로 AWS 리소스에 대한 모든 권한 을 소유 • 기본 디폴트 Deny • 정책 우선 순위 : 묵시적 deny < 명시적 Allow < 명시적 Deny
  • 22. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS IAM 정책 (policy) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "dynamodb:BatchGetItem", "dynamodb:GetItem", "dynamodb:Query", ], "Resource": [ "arn:aws:dynamodb:us-east-2:<account-id>:table/MyTableName", "arn:aws:dynamodb:us-east-2:<account-id>:table/MyTableName/index/*" ], "Condition": { "StringEquals": { "aws:RequestedRegion": [ "us-east-2" ] } } } ] } Actions, resources, and condition keys for AWS services : https://docs.aws.amazon.com/service-authorization/lat est/reference/reference_policies_actions-resources-cont extkeys.html
  • 23. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. “Condition” : { "DateGreaterThan" : {"aws:CurrentTime" : "2017-01-01T11:00:00Z"}, "DateLessThan": {"aws:CurrentTime" : "2017-12-31T15:00:00Z"}, "IpAddress" : {"aws:SourceIp" : ["192.0.2.0/24", "203.0.113.0/24"]} } AND OR 특정 시간대에 특정 IP 주소의 요청만 허용하거나 거부하고자 싶으면? 조건 연산자 해석: 다음 조건을 만족할 경우, 사용자가 자원에 접근하는 것을 허용, {“01/01/2017 오전 11시 이후” AND “12/31/2017 오후 3시까지” AND “[ IP주소 192.0.2.0 /24 OR 203.0.113.0 /24 대역 ]” 에서’ 조건 키 정책 : Condition
  • 24. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 정책 변수(Policy Variable) { "Version": "2012-10-17", "Statement": [ { "Action": ["s3:ListBucket"], "Effect": "Allow", "Resource": ["arn:aws:s3:::mybucket"], "Condition": {"StringLike": {"s3:prefix": ["David/*"]}} }, { "Action": [ "s3:GetObject", "s3:PutObject" ], "Effect": "Allow", "Resource": ["arn:aws:s3:::mybucket/David/*"] } ] } { "Version": "2012-10-17", "Statement": [ { "Action": ["s3:ListBucket"], "Effect": "Allow", "Resource": ["arn:aws:s3:::mybucket"], "Condition": {"StringLike": {"s3:prefix": ["${aws:username}/*"]}} }, { "Action": [ "s3:GetObject", "s3:PutObject" ], "Effect": "Allow", "Resource": ["arn:aws:s3:::mybucket/${aws:username}/*"] } ] } • $(Condition Key) 형식으로 변수화 • 사용자마다 고유한 정책 사본을 만들 필요 없이 여러 사용자에게 작용하도록 정책을 일반화 • 정책 변수는 Resource 요소 / Condition 요소의 문자열 비교에 사용 가능 • 이 정책을 평가할 때는 IAM이 정책 변수를 실제 요청의 string으로 대체
  • 25. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM 정책 종류 정책 설명 포맷 정의 및 관리 Identity-based 정책 IAM 보안 주체(IAM 사용자, IAM 그룹의 사용자 집합, IAM 역할)에 할당되어 해 당 주체의 권한을 규정 JSON IAM Resource-based 정책 정책이 할당될 리소스를 기준으로 어떤 보안 주체가 할 수 있(없)는 작업을 규정. JSON 개별 서비스들 IAM Permission Boundary 정책 IAM 보안 주체 별로 획득할 수 있는 권한의 최대치를 규정 JSON IAM Organization SCP Organization의 OU 또는 개별 어카운트 별로 권한의 최대치를 규정 주로 Root 어카운트의 권한을 제한 시킬 때 사용. JSON Organization Session 정책 임시 자격증명의 기존 퍼미션을 해당 세션에 대해서만 제한할 때 사용 AssumeRole*, GetFederationToken API의 파라미터로 전달 JSON STS ACL 정책 리소스 기준으로 정의, 주로 Cross-Account 간의 리소스 공유시, 보안 주체에 대한 접근을 규정 XML 개별 서비스들 Endpoint 정책 VPC G/W Endpoint에 적용되는 접근제어 정책. 일종의 Resource-based 정책 JSON VPC
  • 26. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "Statement":[{ "Effect":"effect", "Principal":"principal", "Action":"action", "Resource":"arn", "Condition":{ "condition":{ "key":"value" } } } ] } Principal Action Resource Condition { "Statement":[{ "Effect":"effect", "Action":"action", "Resource":"arn", "Condition":{ "condition":{ "key":"value" } } } ] } Action Resource Condition Identity-based 정책 Resource-based 정책 Identity-based vs. Resource-based
  • 27. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS 정책 분류 Guardrails : 권한의 제한 용도 Organization SCPs IAM permission boundaries Session 정책 Grants : 권한의 부여 용도 Identity-based 정책 Resource-based 정책 Access controls lists (ACLs) 주의) 허용의 경우라 도 실제로 권한이 부 여되지는 않음. AWS 정책(Policy)의 분류
  • 28. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 합집합 교집합 교집합 정책 간의 상호작용
  • 29. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM policy 사용 예시
  • 30. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 다중 정책의 예시 “이 어플리케이션은 이 객체들과 키에만 접근이 가능하다” AWS Cloud AWS KMS key EC2 instance with IAM role attached Application S3 bucket with encrypted objec ts Role policy
  • 31. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject" ], "Resource": "arn:aws:s3:::awsexamplebucket1/*" }, { "Effect": "Allow", "Action": "kms:Decrypt", "Resource": "arn:aws:kms:us-west-2:434590054278:key/0de22ef4EXAMPLE" } ] } identity-based 정책 : IAM 역할
  • 32. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Cloud VPC AWS KMS key EC2 instance with IAM role attached Application VPC endpoint S3 bucket with encrypted objec ts Resource policy “이 객체들은 이 VPC에서 호출이될 때만 어플리케이션에서 접근이 가능하다” 호출 오리진 제한 “이 어플리케이션은 이 객체들과 키에만 접근이 가능하다” Role policy
  • 33. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "Version":"2012-10-17", "Statement":[ { "Sid":"DenyNotFromMyVPC", "Effect":"Deny", "Principal": "*", "Action":["s3:*"], "Resource":[ "arn:aws:s3:::awsexamplebucket1", "arn:aws:s3:::awsexamplebucket1/*" ], "Condition": { "StringNotLike": { "aws:sourceVpce": [ "vpce-05c27cEXAMPLE" ] } } } ] } Resource-based 정책 : 버킷 정책
  • 34. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Cloud VPC AWS KMS key EC2 instance with IAM role attached Application VPC endpoint S3 bucket with encrypted objec ts Resource policy Endpoint policy Role policy "오직 이 객체들만 이 VPC에서 접근 이 가능하고, 그떄는 내 ID를 이용해야한다. ” “이 어플리케이션은 이 객체들과 키에만 접근이 가능하다” “이 객체들은 이 VPC에서 호출이될 때만 어플리케이션에서 접근이 가능하다” 네트워크 경계 제한
  • 35. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "Version": "2012-10-17", "Statement": [ { "Principal": "*", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject" ], "Resource": "arn:aws:s3:::awsexamplebucket1/*", "Condition": { "ForAnyValue:StringLike":{ "aws:PrincipalOrgPaths":[ "o-xmayEXAMPLE/r-EXMP/ou-m3EXAMPLE/*" ] } } ] } Attached to S3 gateway VPC endpoint VPC endpoint 정책
  • 36. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject" ], "Resource": "arn:aws:s3:::awsexamplebucket1/*“, "Condition": { "StringLike": { "aws:sourceVpce": [ "vpce-05c27cEXAMPLE" ] } } }, { "Effect": "Allow", "Action": "kms:Decrypt", "Resource": "arn:aws:kms:us-west-2:434590054278:key/0de22ef4EXAMPLE" } ] } identity-based 정책 강화
  • 37. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Cloud VPC AWS KMS key EC2 instance with IAM role attached Application VPC endpoint S3 bucket with encrypted objec ts Resource policy Key policy Endpoint policy Role policy “이 키는 S3데이터를 위해서만 어플 리케이션에 의해서 쓰여야하고, 이 VPC로부터 요청이 와야한다.” KMS 키 정책 "오직 이 객체들만 이 VPC에서 접근이 가능하고, 그떄는 내 ID를 이용해야한다. ” “이 어플리케이션은 이 객체들과 키에만 접근이 가능하다” “이 객체들은 이 VPC에서 호출이될 때만 어플리케이션에서 접근이 가능하다”
  • 38. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • ECS task-level IAM roles 컨테이너 접근제어 예시 : ECS S3 bucket SQS queue ECS service { ... snip ... "taskRoleArn": "", "executionRoleArn": "", "containerDefinitions":[{ ... snip ... }], ... snip ... } ECS task definition
  • 39. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • EC2 Level IAM roles 컨테이너 접근제어 예시 : ECS S3 bucket SQS queue ECS service { "AttachedPolicies": [{ "PolicyName": "AmazonS3FullAccess", "PolicyArn": "arn:aws:iam::aws:policy/AmazonS3FullAccess" }, { "PolicyName": "AmazonSQSFullAccess", "PolicyArn": "arn:aws:iam::aws:policy/AmazonSQSFullAccess" }, { "PolicyName": "AmazonEC2ContainerServiceforEC2Role", "PolicyArn": "arn:aws:iam::aws:policy/service- role/AmazonEC2ContainerServiceforEC2Role" }] } EC2 instance IAM role’s policies IAM role
  • 40. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • EC2-level IAM role • All ECS tasks on the same EC2 instance can use the EC2 instance role 컨테이너 접근제어 예시 : ECS IAM role EC2 instance ECS task Another ECS task Really want to allow?
  • 41. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • EC2-level IAM role 컨테이너 접근제어 예시 : ECS { ... snip ... "taskRoleArn": ”TaskRole-ARN-here", "executionRoleArn": "", "containerDefinitions":[{ ... snip ... }], ... snip ... } ECS task definition { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": ["arn:aws:s3:::your-bucket"] },{ "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": ["arn:aws:s3:::your-bucket/*"] }] } S3 write-only policy { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "sqs:SendMessage", "Resource": "arn:aws:sqs:...:your-queue-name" }] } SQS write-only policy { "AttachedPolicies": [{ "PolicyName": "S3WriteOnlyPolicy", "PolicyArn": "S3WriteOnlyPolicy-ARN-here" },{ "PolicyName": "SQSWriteOnlyPolicy", "PolicyArn": "SQSWriteOnlyPolicy-ARN-here" }] } ECS task role
  • 42. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • EC2-level IAM role 컨테이너 접근제어 예시 : ECS ! EC2 instance ECS task Another ECS task Denied IAM role
  • 43. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • IAM 크리덴셜을 사용하여 Kubernetes 클러스터에 인증 IAM 과 Kubernetes 인증 kubectl Kubernetes용 AWS IAM Authenticator Kubernetes API 1 2 3 4 5 역할 기반 액세스 제어 (RBAC) 권한 부여
  • 44. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • IAM 크리덴셜을 사용하여 Kubernetes 클러스터에 인증 IAM 과 Kubernetes apiVersion: v1 kind: ConfigMap metadata: name: aws-auth namespace: kube-system data: mapRoles: | - rolearn: arn:aws:iam::111222333:role/node_instance_role username: system:node:{{EC2PrivateDNSName}} groups: - system:bootstrappers - system:nodes RBAC 그룹 system:bootstrappers system:nodes IAM 역할
  • 45. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • EKS Pod Identity Webhook with IAM OIDC • EKS v1.14+ 이상 부터 IAM OIDC를 통해 Service Account와 연동 지원 • $> eksctl utils associate-iam-oidc-provider --cluster {clustername} --a pprove POD를 위한 IRSA OIDC for EKS
  • 46. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. POD를 위한 IRSA OIDC for EKS
  • 47. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Break Time (10 mins)
  • 48. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Simple Token Service (STS)
  • 49. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • AWS 리소스에 대한 액세스를 제어할 수 있는 임시 보안 자격증명을 생성하여 보안 주체에 전달해주는 서비스 • 보안 주체(ex. 사용자 혹은 역할) 는 STS를 호출할 수 있는 명시적인 권한이 있어야함. • STS API요청에 대한 응답에는 temp credential이 포함되어 있음 • access key • secret key • session token : temp credential을 사용하기 위해 API 요청에 제출해야하는 토큰. 세션 토큰을 사용해 임시 보안 자격 증명의 유효성을 검증 • 15초 ~ 최대 12시간까지 지속가능 • https://sts.amazonaws.com 라는 글로벌 단일 엔드포인트를 default로 사용 • 리전별 AWS STS 엔드포인트를 사용하여 지연 시간을 줄이고, 중복으로 구축하고, 세션 토큰 유효성을 높일 수 있음 • 쿼리 API / SDK / CLI를 통해 STS 호출 가능 AWS STS (Simple Token Service)
  • 50. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS STS API 호출할 수 있는 사용자 사용 사례 AssumeRole - IAM 사용자 - 기존 임시 보안 자격 증명이 있는 IAM 역할 기존 IAM 사용자가 아직 액세스 권한이 없는 AWS 리소스에 접근 AssumeRoleWithSAML - 유효한 ID provider에서 받은 인증이 포함된 SAML 응답을 전달할 수 있는 (외부) 사용자 SAML 2.0과 호환되는 엔터프라이즈 자격 증명 공급자 (ex. Window AD , OpenLDAP) 를 통한 연동 AssumeRoleWithWebIdentity - 유효한 ID provider에서 받은 인증이 포함된 Web Identity token 을 전달할 수 있는 (외부) 사용자 웹 기반 자격 증명 공급자를 통한 연동 (ex. Login with Amazon, Facebook, Google 또는 OpenID Connect(OIDC) 호환 자격 증명 공급자) GetFederationToken - IAM 사용자 - AWS 계정 루트 사용자 - ** IAM 사용자는 “사람” 보다는 장기 크리덴셜을 가지고 있는 사용자 혹은 어플리케이션으로 이해하는 것이 좋음 연동 사용자에게 임시 자격증명을 반환 (Assumerole 계열과 비슷하지만, role을 assume하지 않고 calller의 권한 을 사용하는 것이 차이점) GetSessionToken - IAM 사용자 - AWS 계정 루트 사용자 - ** IAM 사용자는 “사람” 보다는 장기 크리덴셜을 가지고 있는 사용자 혹은 어플리케이션으로 이해하는 것이 좋음 모바일 디바이스 혹은 웹 브라우저와 같이 덜 안전한 환경을 통해 접근하 는 IAM사용자가 있을 때 MFA 를 활성화하여 엑세스 보안을 강화 참고 : https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison API reference : https://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html AWS STS API
  • 51. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • AssumeRole - Request AssumeRole
  • 52. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • AssumeRole - Response AssumeRole
  • 53. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. import boto3 sts = boto3.client('sts') response = sts.assume_role( RoleArn='arn:aws:iam::123456789012:role/EC2Adm', RoleSessionName='Test') • AssumeRole – Boto3 { "Credentials":{ "AccessKeyId":"ASIAVVQ7FXHK625WN2VT", "SecretAccessKey":"Q06oNEEk3xlZ9i2zWZ0EsPK+kLbqX9XoOTzl4nT1", "SessionToken":"FwoGZXIvYXdzEKX(…생략…)ip7R", "Expiration":datetime.datetime(2021, 3, 24, 4, 46, 54, "tzinfo=tzutc())" },"AssumedRoleUser":{ "AssumedRoleId":"AROAIODZ4FZ4CBBRL5VSU:Test", "Arn":"arn:aws:sts::123456789012:assumed-role/EC2Adm/Test" },"ResponseMetadata":{ "RequestId":"97c4fec6-038e-4dd0-a2bd-2f289c7f78c8", "HTTPStatusCode":200, "HTTPHeaders":{ "x-amzn-requestid":"97c4fec6-038e-4dd0-a2bd-2f289c7f78c8", "content-type":"text/xml", "content-length":"1025", "date":"Wed, 24 Mar 2021 03:46:53 GMT" },"RetryAttempts":0 } } AssumeRole
  • 54. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • AssumeRoleWithWebIdentity를 호출하려면 지원되는 ID 공급자의 ID 토큰이 있어야하며 애플리케이션이 맡을 수 있는 역할(Role)을 만들어야 함 • AssumeRoleWithWebIdentity는 AWS 보안 자격 증명을 사용할 필요가 없음 따라서 애플리 케이션에 장기 AWS 자격 증명을 포함하지 않고도 임시 보안 자격 증명을 요청하는 애플리 케이션 (예 : 모바일 디바이스)을 배포 할 수 있음 • 모바일 애플리케이션을 위한 경우 다양한 접근 권한 및 사용자 관리가 가능한 Amazon Cognito를 권장함 AssumeRoleWithWebIdentity
  • 55. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AssumeRoleWithWebIdentity • 워크플로우 id_token
  • 56. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • 역할을 수임 (AssumeRole)할 수 있는 권한을 부여하는 정책 • 연동 사용자에 대해 임시 보안 자격 증명을 생성할 수 있는 사용자 제한 권한을 부여하는 정책 STS 를 호출할 수 있는 권한
  • 57. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MFA GetSessionToken 작업의 목적은 MFA를 사용하는 사용자를 인증하는 것 ! STS 호출로 얻게 되는 권한 제어 IAM User
  • 58. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 운영자를 위한 IAM
  • 59. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLI Credential 구성 방법 [default] aws_access_key_id = ACCESS_KEY_ID aws_secret_access_key = SECRET_ACCESS_KEY_ID [prod] aws_access_key_id = ACCESS_KEY_ID aws_secret_access_key = SECRET_ACCESS_KEY_ID .aws/credentials
  • 60. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • Multi Profile • --profile은 사용할 CLI 프로필의 이름을 지정할 때 유용합 니다. • 프로필은 리소스에 대한 액세스를 관리하는 데 사용 가능한 액 세스 키 정보를 저장합니다. CLI Credential 구성 방법
  • 61. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • Multi Profile • 추가 프로필 사용 구성: aws configure --profile <profile name> • list, get 및 set 하위 명령과 조합하여 사용할 수 있습니다. • 다음과 같이 “dev2” 프로필에 대한 기본 리전을 eu-west-1으로 설정합니다. aws configure set region eu-west-1 --profile dev2 • 혹은, 해당 명령을 다음과 같이 구성할 수도 있습니다. aws configure set profile.dev2.region eu-west-1 • 프로필을 사용하려면 다음과 같이 명령에 --profile 옵션을 추가합니다. aws ec2 run-instances --image-id ami-12345 --profile dev2 CLI Credential 구성 방법
  • 62. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLI 환경에 MFA 적용하기 • MFA 사용 • 사용자가 AWS 웹 사이트 또는 서비스에 액세스할 때 고유 인증 코드를 입력하도록 합 니다. • CLI 기반, API 기반 및 콘솔 기반 액세스에 사용할 수 있습니다. • 추가적인 보안 계층의 역할을 합니다. • 주요 사용자라면 이를 사용하는 것이 좋습니다. • 각 IAM 사용자에게 고유한 MFA 디바이스(하드웨어 또는 가상)를 할당합니다. 예제: AWS MFA 디바이스로 인증을 받은 경우에만 TerminateInstances와 같은 작업을 허용합니다.
  • 63. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLI 환경에 MFA 적용하기
  • 64. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CLI 환경에 MFA 적용하기 • $> aws configure 명령어를 이용해 credential 설정 (default 프로파일, IAM User) • devops 유저와 신뢰 관계에 있는 role을 profile로 추가 설정 (./aws/config) • 만약 default 프로파일에 role_arn, source_profile, mfa_serial 속성을 정의 하시면 -- profile 지정없이 mfa 적용된 role을 사용하실 수 있습니다. [profile devops] region = ap-northeast-2 role_arn = arn:aws:iam::123456789012:role/devops_role source_profile = default output = json mfa_serial = arn:aws:iam::123456789012:mfa/devops $> aws s3 ls --profile devops Enter MFA code for arn:aws:iam::123456789012:mfa/devops: $❯ aws configure list --profile devops Name Value Type Location ---- ----- ---- -------- profile s3adm manual --profile access_key ****************QY6F assume-role secret_key ****************j14M assume-role region ap-northeast-2 config-file ~/.aws/config STS에 의해 생성된 임시 자격증명
  • 65. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • MFA 토큰을 사용하여 AWS CLI(AWS 명령줄 인터페이스)로 AWS 리소스에 대한 액세스를 인증하려면 어떻게 해야 합니까? • MFA 보호는 임시 보안 자격 증명을 사용하는 경우에만 제공되며, 임시 보안 자격 증명은 AssumeRole 또는 GetSessionToken을 사용해 얻어야 합니다. MFA 조건이 포함된 IAM 정책 사용자 $ aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code CODE_FROM_TOKEN { "Credentials": { "SecretAccessKey": "secret-access-key", "SessionToken": "temporary-session-token", "Expiration": "expiration-date-time", "AccessKeyId": "access-key-id" } }
  • 66. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • 환경 변수를 통한 임시 자격 증명 사용 • 자격 증명 우선 순위 이해가 중요함 • `aws configure list` 명령을 통해 적용된 credential 확인 가능 MFA 조건이 포함된 IAM 정책 사용자 export AWS_ACCESS_KEY_ID=example-access-key-as-in-previous-output export AWS_SECRET_ACCESS_KEY=example-secret-access-key-as-in-previous-output export AWS_SESSION_TOKEN=example-session-token-as-in-previous-output ❯ aws configure list Name Value Type Location ---- ----- ---- -------- profile <not set> None None access_key ****************F4GG env secret_key ****************OkXy env region us-west-2 config-file ~/.aws/config
  • 67. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Management
  • 68. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ü IAM Policy Generator : • https://awspolicygen.s3.amazona ws.com/policygen.html ü IAM Policy Sentry : • https://github.com/salesforce/po licy_sentry/ • pip 로 설치 가능한 라이브러리 로, CRUD 관점에서 ARN 만 나열하 면 최소 권한만 갖는 IAM Policy를 생성 ü IAM Policy Simulator • https://policysim.aws.amazon.co m/home/index.jsp?# • 작성한 IAM 정책 테스트 IAM policy 작성 툴
  • 69. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS • 지정 날짜 범위 동안의 액세스 허용 (이 정책 보기) • 지정 날짜 범위 동안 MFA를 사용하는 경우 특정 액세스를 허용(이 정책 보기) • 소스 IP 주소를 바탕으로 AWS에 대한 액세스 거부(이 정책 보기) 정책 예제: AWS CodeCommit • 프로그램 방식으로 콘솔에서 AWS CodeCommit 리포지토리에 대한 Read 액세스 허용(이 정책 보기) 정책 예제: AWS Data Pipeline • 사용자가 생성하지 않은 파이프라인에 대한 액세스 거부(이 정책 보기) 정책 예제: Amazon DynamoDB • 특정 Amazon DynamoDB 테이블에 대한 액세스 허용(이 정책 보기) • 특정 Amazon DynamoDB 열에 대한 액세스 허용(이 정책 보기) • Amazon Cognito ID를 기준으로 Amazon DynamoDB에 대한 행 수준 액세스를 허용(이 정책 보기) 정책 예제: Amazon EC2 • Amazon EC2 인스턴스가 볼륨을 연결 또는 분리하도록 허용 (이 정책 보기) • 태그를 기준으로 Amazon EBS 볼륨을 Amazon EC2 인스턴스에 연결 또는 분리하도록 허용(이 정책 보기) • 특정 서브넷에 있는 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작할 수 있도록 허용(이 정책 보기) • 특정 VPC와 관련된 Amazon EC2 보안 그룹을 프로그래밍 방식으로 콘솔에서 관리할 수 있도록 허용(이 정책 보기) • 사용자가 태그를 지정한 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작 또는 중지할 수 있도록 허용(이 정책 보기) • 리소스 및 보안 주체 태그 기반의 Amazon EC2 인스턴스를 프로그래밍 방식으로 콘솔에서 시작 또는 중지할 수 있도록 허용(이 정책 보기) • 리소스 및 주요 태그가 일치할 때 Amazon EC2 인스턴스를 시작 또는 중지할 수 있도록 허용(이 정책 보기) • 특정 리전 내에서의 모든 Amazon EC2 액세스를 프로그래밍 방식으로 콘솔에서 허용(이 정책 보기) • 프로그래밍 방식으로 콘솔에서 특정 Amazon EC2 인스턴스를 시작 또는 중지하고 특정 보안 그룹을 수정할 수 있도록 허용(이 정책 보기) • Amazon EC2 인스턴스 종료를 특정 IP 주소 범위로 제한(이 정책 보기) IAM 샘플 정책 활용 - 1
  • 70. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Identity and Access Management(IAM) • 정책 시뮬레이터 API에 대한 액세스 허용(이 정책 보기) • 정책 시뮬레이터 콘솔에 대한 액세스 허용(이 정책 보기) • 프로그래밍 방식 및 콘솔에서 특정 태그가 있는 IAM 사용자에게 또 다른 특정 태그를 추가할 수 있도록 허용(이 정책 보기) • 프로그래밍 방식 및 콘솔에서 IAM 사용자 또는 역할에게 특정 태그를 추가할 수 있도록 허용(이 정책 보기) • 특정 태그가 있는 새 사용자만 만들 수 있도록 허용(이 정책 보기) • 특정 태그를 관리하도록 허용(이 정책 보기) • 특정 경로를 지닌 사용자에 대해 정책 시뮬레이터 API의 사용을 허용(이 정책 보기) • 특정 경로를 지닌 사용자에 대해 정책 시뮬레이터 콘솔의 사용을 허용(이 정책 보기) • IAM 사용자가 MFA 디바이스를 스스로 관리하도록 허용(이 정책 보기) • IAM 사용자가 프로그램 방식으로 콘솔에서 자신의 자격 증명을 교체하도록 허용(이 정책 보기) • 신규 IAM 사용자, 그룹 또는 역할에 적용 가능한 관리형 정책을 제한(이 정책 보기) Amazon RDS • 특정 리전에 있는 Amazon RDS에 대한 완전한 액세스 허용(이 정책 보기) • Amazon RDS 데이터베이스를 프로그램 방식으로 콘솔에서 복원하도록 허용(이 정책 보기) • 태그 소유자가 자신이 태그를 지정한 Amazon RDS 리소스에 대한 모든 액세스 권한을 가지도록 허용(이 정책 보기) Amazon S3 • Amazon Cognito 사용자가 자신의 Amazon S3 버킷에 있는 객체에 액세스하도록 허용(이 정책 보기) • IAM 사용자가 프로그램 방식으로 콘솔에서 Amazon S3에 있는 자신의 홈 디렉터리에 액세스하도록 허용(이 정책 보기) • 사용자가 하나의 Amazon S3 버킷을 관리하고 다른 모든 AWS 작업 및 리소스를 거부하도록 허용(이 정책 보기) • 특정 Amazon S3 버킷에 대한 Read 및 Write 액세스 허용(이 정책 보기) • 특정 Amazon S3 버킷에 대해 프로그래밍 방식으로 콘솔에서 Read 및 Write 액세스 허용(이 정책 보기) IAM 샘플 정책 활용 - 2
  • 71. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • IAM에 대해 서비스에서 마지막으로 액세스한 데이터를 조회 • 불필요한 권한을 제거하고 least privileged 를 유지할 수 있음 "ServicesLastAccessed": [ { "LastAuthenticated": "2018-11-21T17:41:15Z", "LastAuthenticatedEntity": "arn:aws:iam::123456789012:role "ServiceName": "Amazon EC2", "ServiceNamespace": "ec2", "TotalAuthenticatedEntities": 1 }, IAM Access Advisor
  • 72. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • S3, EC2, IAM, Lambda management action 에 대해서는 action단위로 조회 가능. • Fine-grained S3 버킷 정책을 위해 활용
  • 73. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 마지막으로 password를 바꾼 날짜 MFA 활성화 여부 IAM Credential Report • 계정의 모든 사용자와 암호, 액세스 키, MFA 디바이스 등 자격 증명 상태를 나열하는 보고서 • 감사 및 규정 준수에 도움
  • 74. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Access Analyzer • 리소스에 대한 public 혹은 crosss-account access를 검사하여 과도하게 권한이 주어진 자원을 판별 • analyzer결과로 내 계정 내, 외부에서 액세스 가능한 리소스 리스트를 보여주고, Next step을 제안 • 상시 모니터링 / 탐색으로 정책이 변경되는 순간 탐지 è Security hub로 전달
  • 75. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Access Analyzer
  • 76. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM Access Analyzer 확장 preview & validate public & cross account access policy validation policy generation Fine-Grained!!!
  • 77. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 개발 팀 테스트 계정 Sandbox Product 계정 보안 계정 1. 업로드된 IAM Policy 유효성 검증 2. 필수 ”명시적 Deny” 추가 3. 사용자 계정 내 최종 Policy 생성 IAM 정책 생성 자동화
  • 78. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 오픈 소스를 활용한 IAM 권한 관리 • policy_sentry : IAM Least Privilege Policy Generator 도구 • parliament : IAM linting library로, 작성한 정책 리뷰 (예: 잘못된 json, 필수 요소 누락 등) • Netflix aardvark / repokid : access advisor 기반으로 정보를 조회하고 불필요한 권한을 제거 • iamctl : 두개의 계정에서 IAM 역할 및 정책을 추출하고 비교하고 차이점과 통계를보고 • Cloudsplaininng : 최소 권한 위반을 식별하고 위험 우선 순위가 지정된 HTML 보고서를 생성 • cloudtracker : CloudTrail 로그를 현재 IAM 정책과 비교하여 과도한 권한이있는 IAM 사용자 및 역할 색출 • TrailScraper : AWS CloudTrail에서 정보를 가져 오는 명령 줄 도구 / IAM 정책 작업 • Aaia : IAM에 대한 시각화 및 이상탐지 • aws-key-disabler : 일정시간 이후 IAM User Access key 비활성화 • git-secrets : AWS 자격증명이 GIT 환경에 노출되었는지 Scanning • gitleaks : 주요 자격증명 패턴 검색 • gitgadian : 자격 증명에 대한 자동화된 비밀 검색 및 조치 • spacesiren : 허니 토큰 관리/경고 시스템 • aws-vault : 개발 환경에서 AWS 자격증명 안전하게 보관 및 접근 • etc…
  • 79. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 예 : IAM 최소 권한 유지 및 관리 Aardvark Repokid 미사용 서비스 삭제 Policy 사용 체크 90일 이상? 미사용 서비스? 커스텀 정책 Yes Yes Yes No No No 반복 체크 IAM 의 Access Advisor 정보를 조회 불필요한 권한 삭제 • Netflix aardvark / repokid : https://netflixtechblog.com/introducing-aardvark-and-repokid-53b081bf3a7e
  • 80. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. GIT Hub – IAM AccessKey Disabler • 주기적으로 기한이 지난 엑세스 키페어 비활성화 조치(삭제는 안됨) • https://github.com/te-papa/aws-key-disabler 예 : GIT샘플 - IAM 자격증명 라이프 싸이클 관리
  • 81. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. GIT Hub – git-secrets • AWS 자격증명이 GIT 환경에 노출되었는지 Scanning • 오탐률을 줄이기 위해 정규식 패턴 지원 • https://github.com/awslabs/git-secrets GIT Hub – Gitleaks • 중요 자격증명 패턴 검색 (벌크스캔 / CI 도구를 통한 Pull 방식 스캔) • Private repository scanning 지원 • https://github.com/zricethezav/gitleaks 예 : GIT샘플 - 유출된 중요 자격증명 탐색
  • 82. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 예 : IAM 시각화 및 이상 탐지 GIT Hub – Aaia (Analysis of Identity and Access) • IAM 시각화 및 이상 탐지 • https://github.com/rams3sh/Aaia
  • 83. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 예 : 자격증명 보관 AWS-VAULT • CLI를 사용을 위해 MFA와 STS를 적용 시키더라도 default 프로파일에서 사용되는 credential을 .aws/credential 파일에 존재 • 해당 credential에는 STS 호출 권한만 가지고 있지만 추가적인 보안을 하고자 할 경우 credential을 암호화 (MacOs의 경우 KeyChain에 암호화 하여 저장) • https://github.com/99designs/aws-vault
  • 84. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 컴플라이언스 체크 : AWS Config Rules • Config : AWS리소스의 변경사항을 추적하고 감사하는 서비스 • Config Rules : 해당 변경 사항이 기준 정책에 위반될 때, 대응 규칙 실행(경보, 차단 등 AWS Lambda활용). 변경된 리소스들 Config Rules 이력, 스냅샷 SNS Topic API 접근 정규화 AWS Config
  • 85. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 보안 위협 탐지 : Amazon GuardDuty VPC flow logs DNS Logs CloudTrail Events 위험도 데이터 소스 Threat intelligence Anomaly Detection (ML) AWS Security Hub • 경감조치 • 파트너 제품 연계 • SIEM으로 전달 CloudWatch Event 탐지 케이스 Examples: • 비트코인 마이닝 • C&C 관련 행동 • 악성 IP / Tor 접근 • Brute Force • … 비정상적인 사용자 행동 Example: • 인스턴스 시작 • 네트웍 권한/구성 변경 Amazon GuardDuty 위협탐지 유형 HIGH MEDIUM LOW 비정상적인 트래픽 패턴 Example: • 비정상적인 트래픽 볼륨 • 사용한 적이 없는 포트
  • 86. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 보안 위협 탐지 : Amazon GuardDuty • UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration Default severity: High VPC Ooops!! EC2 APIs
  • 87. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. API 활동 기록 및 감사 : AWS CloudTail • AWS API 요청의 처리내역을 로깅하는 서비스. CloudTrail 콘솔 AWS SDK CLI S3 AWS 파트너 네트워크 ElasticSearch EMR/Redshift
  • 88. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Who? When? What? Where to ? Where from? Bill 3:27pm Launch Instance us-west-2 72.21.198.64 Alice 8:19am Added Bob to admin grou p us-east-1 127.0.0.1 Steve 2:22pm Deleted security group eu-west-1 205.251.233.176 AWS CloudTail 로그
  • 89. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • IAM principal - AWS 어카운트 내에 정의된 요청 주체(Identity) • CloudTrail ‘userIdentity’ 요소 기준, 다음 사용자 유형을 구별 : 1. Root– API 요청이 AWS Account 자격 증명을 사용 2. IAM User – API 요청이 IAM User의 자격 증명을 사용 3. Assumed Role – API 요청이 AWS STS AssumeRole API 호출을 통해 역할로 획득된 임시 보안 자격 증명을 사용 4. Federated User – API 요청이 AWS STS GetFederationToken API 호출을 통해 획득한 임시 보안 자격 증명을 사용 5. AWS Account – 다른 AWS Account에서 요청 6. AWS Service – AWS 서비스에 속한 AWS 계정을 통해 요청 • SAML이나 WebIdentity Federation을 하는 경우 : 1. SAMLUser – SAML 어설션이 이루어지는 요청 2. WebIdentityUser – 웹 자격 증명 연동 제공업체로 이루어지는 요청. CloudTrail 기록에서의 IAM 보안 주체
  • 90. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. STS 를 이용한 보안 강화 및 감사 예시
  • 91. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CloudTrail을 통한 STS API 감사 AWS Cloud AWS Cloud { "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AROA6O4DS6EKUUTZB565I:i-03c304b61867e7052", "arn": "arn:aws:sts::994024026389:assumed-role/test-role-ec2-cross/i-03c304b61867e7052", "accountId": "994024026389", "accessKeyId": "ASIA6O4DS6EKVDRF6IE2", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROA6O4DS6EKUUTZB565I", "arn": "arn:aws:iam::994024026389:role/test-role-ec2-cross", "accountId": "994024026389", "userName": "test-role-ec2-cross" }, ... } }, "eventTime": "2020-08-07T02:30:51Z", "eventSource": "sts.amazonaws.com", "eventName": "AssumeRole", "awsRegion": "us-east-1", "sourceIPAddress": "15.164.93.199", "userAgent": ”…": { "roleArn": "arn:aws:iam::166642409121:role/test-role-cross-s3", "roleSessionName": ”myname" }, } 역순으로 확인 { "eventVersion": "1.07", "userIdentity": { "type": "AssumedRole", "principalId": "AROASNTFJL2QSHCHTDVN3:hoseok-nim", "arn": "arn:aws:sts::166642409121:assumed-role/test-role-cross-s3/myname", "accountId": "166642409121", "accessKeyId": "ASIASNTFJL2QTERQGOUF", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROASNTFJL2QSHCHTDVN3", "arn": "arn:aws:iam::166642409121:role/test-role-cross-s3", "accountId": "166642409121", "userName": "test-role-cross-s3" }, "attributes": { "creationDate": "2020-08-07T02:30:51Z", "mfaAuthenticated": "false" } } }, "eventTime": "2020-08-07T02:42:40Z", "eventSource": "s3.amazonaws.com", "eventName": "ListObjects", "awsRegion": "ap-northeast-2", "sourceIPAddress": "15.164.93.199", … }, { "eventVersion": "1.05", "userIdentity": { "type": "AWSAccount", "principalId": "AROA6O4DS6EKUUTZB565I:i-03c304b61867e7052", "accountId": "994024026389" }, "eventTime": "2020-08-07T02:30:51Z", "eventSource": "sts.amazonaws.com", "eventName": "AssumeRole", "awsRegion": "us-east-1", "sourceIPAddress": "15.164.93.199", "userAgent": ”…", "requestParameters": { "roleArn": "arn:aws:iam::166642409121:role/test-role-cross-s3", "roleSessionName": ”myname" }, }, "sharedEventID": "ec312aa3-1bec-4137-b5aa-b36aa855360b"
  • 92. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. assumerole할때 aws sts assume-role --role-arn "arn:aws:iam::079681958650:role/<role_name>" --role-session-n ame “<my_name>”에서 --role-session-name가 역할 수임하는 어카운트에 기록이 되는데 해당 값이 임으로 입력할 수 있는 값이다 보니 로깅을 속일 수 있지 않나? • STS에서 role-session-name을 사용자명만 사용할 수 있게 강제 https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#condition-keys-sts STS 를 이용한 보안 강화 및 감사 예시
  • 93. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Wrap-up
  • 94. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Key Takeaway • Everything API • IAM은 인증과 인가를 모두 제어하는 통합 서비스 • IAM 의 다양한 policy 종류와 활용 • STS Best Practice !! • IAM 최소권한 유지와 로깅&감사