
Istio์ ์ฌ์ฉ์, ์๋น์ค ๋ณด์ ๊ตฌ์กฐ. ์ฌ์ฉ์ ๊ด์ ๋ณด์ via OIDC, RequestAuthentication, ์๋น์ค ๊ด์ ๋ณด์ via mTLS, SPIFFE ์์ ์์ธํ ๋ ผํ๋ค.
Introduction
๋ํ์ Service Mesh ์ ํ์ธ Istio์ ๋ํ overview๋ก Kubernetes๋ฅผ ๋ฐฐ๊ฒฝ์ผ๋ก ์ค๋ช ํ๋ค.
Istio overview: Architecture, Traffic Management, Istio overview: Observability ์ ์ด์ด Security feature์ ๋ํด ๋ค๋ฃฌ๋ค(์ดํ Istio overview: Extensibility, Etc. ๋ก ์ด์ด ์ง๋ค).
์ฐธ์กฐํ ๋ฌธ์๋ ๊ธ ๋ด๋ถ ๋ฐ References ์ ๋ฌ์๋ค.
Summary
- ๋ณด์ ๊ด์ ์์ Istio๋ ZTA(Zero Trust Architecture)๋ฅผ ์ถ๊ตฌํ๋ ๊ฒ์ผ๋ก ๋ณด์ธ๋ค.
- Istio๋ ์ฌ์ฉ์ ๊ด์ ๋ณด์์ผ๋ก JWT/JWK ๊ธฐ๋ฐ์ OIDC(OpenID Connect)๋ฅผ ์ง์ํ๋ค.
- Istio๋ ์๋น์ค ๊ด์ ๋ณด์์ผ๋ก mTLS ๋ฐ SPIFFE(Secure Production Identity Framework for Everyone)๋ฅผ ์ง์ํ๋ค.
AuthorizationPolicy๋ฅผ ํตํด L7 ์์ค์์ access control์ด ๊ฐ๋ฅํ๋ค.
Zero Trust Architecture
Istio๋ ZTA(Zero Trust Architecture)๋ฅผ ์ถ๊ตฌํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ, ์ค์ ์ ๊ณต์ ๋ฌธ์๋ Zero Trust network๋ฅผ ์ธ๊ธํ๋ค. ์ด๋ Istio๊ฐ multi clusters ๋ฐ ์ธ๋ถ host๊ฐ ํฌํจ๋ ํ๊ฒฝ๋ ์ง์ํจ์ ๊ณ ๋ คํ๋ฉด ์ถฉ๋ถํ ์ดํด๋๋ ๋ถ๋ถ์ด๋ค(์ด๋ค ํ๊ฒฝ์์๋ traffic์ด ๋ณดํธ๋์ง ์๊ฑฐ๋ ๋ณด์ ์ ์ฑ ์ด ์์ดํ ๊ตฌ๊ฐ์ ์ง๋๊ธฐ ๋ง๋ จ์ด๋ค).
ZTA; Zero Trust Architecture๋ (ํ๊ธฐ ๋งํฌ ์์ฝ)
Zero trust security modelThe zero trust security model, also known as zero trust architecture (ZTA), and sometimes known as perimeterless security, describes an approach to the strategy, design and implementation of IT systems. The main concept behind the zero trust security model is "never trust, always verify", which means that users and devices should not be trusted by default, even if they are connected to a permissioned network such as a corporate LAN and even if they were previously verified.https://en.wikipedia.org/wiki/Zero_trust_security_model#cite_note-:3-10
๊ฒฝ๊ณ ์๋ ๋ณด์(perimeterless security)๋ก๋ ๋ถ๋ฆฌ๋ ZTA์ ์ฃผ์ ๊ฐ๋ ์ "์ ๋ขฐํ์ง ์๊ณ ํญ์ ํ์ธ"์ด๋ค. ์ด๋ ์์น์ ๊ด๊ณ ์์ด resource์ ์ ๊ทผํ๋ user์ device๊ฐ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๋ขฐ ๋ถ๊ฐํ๋ค๋ ๋ป์ผ๋ก, LAN, VPN ๋ฑ ์ ํต์ ๋ณด์ ์์๊ฐ ํด๋ผ์ฐ๋ ์๋น์ค, ์ธํ๋ผ, IoT ์๋น์ค ๋ฑ์ ํ๋ network ํ๊ฒฝ์์๋ ๋ถ์กฑํ๋ค๋ ์ธ์์ ๊ทผ๊ฐํ๋ค.
ZTA๋ ๊ธฐ๋ณธ์ ์ผ๋ก user์ device ๋ชจ๋์ ๋ํ ์ธ์ฆ๊ณผ ์ต์ ๊ถํ ๋ถ์ฌ๋ฅผ ์๊ตฌํ์ฌ, ์ ์ฒด ๊ตฌํ์๋ ํฅ์๋ ID ๊ฑฐ๋ฒ๋์ค ๋ฐ ์ ์ฑ ๊ธฐ๋ฐ ์ก์ธ์ค ์ ์ด, ๋ง์ดํฌ๋ก ์ธ๋ถํ, ์ค๋ฒ๋ ์ด ๋คํธ์ํฌ(overlay network) ๊ฐ ํฌํจ๋๋ค.
์์ ZTA ์ค๋ช ์ค ์ค๋ฒ๋ ์ด ๋คํธ์ํฌ๊ฐ ํนํ ๋์ ๋๋๋ฐ, Service Mesh, ์ฆ Istio ์์ฒด๊ฐ ์ผ์ข ์ ์ค๋ฒ๋ ์ด ๋คํธ์ํฌ์ด๊ธฐ ๋๋ฌธ์ด๋ค.
๋งจ ์์ ๊ทธ๋ฆผ์ ์ด๋ฌํ ๊ด์ ์์์ Istio์ ๋ณด์ features ์ ์ฒด์ ์์ฝ์ผ๋ก, Istio์ ๋ณด์ ์๋น์ค๋ ์ฌ์ฉ์์ ์๋น์ค ๊ด์ ๋ณด์์ผ๋ก ๋๋ ๋ณผ ์ ์์ด, ๊ฐ๊ฐ ์ข์ธก๊ณผ ์ฐ์ธก์ ํด๋นํ๋ค. ์์ ๊ณตํต์ผ๋ก ์ธ์ฆ(AuthN; AutheNtication), ์ธ๊ฐ(AuthZ; AuthoriZation)๋ฅผ ์ ๊ณตํ๋๋ฐ, ์๋น์ค ๊ด์ ๋ณด์์์๋ mTLS์ ํตํด, ๊ธฐ๋ฐ์ฑ, ๋ฌด๊ฒฐ์ฑ, ๋ถ์ธ๋ฐฉ์ง๊ฐ ์ถ๊ฐ๋๋ค. ์ฌ์ฉ์ ๊ด์ ์์ ์ด๋ ๋ถํ์ํ๋ฐ, ์ผ๋ฐ์ ์ผ๋ก public CA(Certificate Authority) ๊ด๋ฆฌ ํ์ TLS๊ฐ ๋์ํ๊ธฐ ๋๋ฌธ์ด๋ค.
์ฐธ๊ณ ๋ก, AAA(Authentication, Authorization, Audit) ์ค Audit์ ์๋ ์ค๋ช
ํ AuthorizationPolicy ์ action ์์ AUDIT (logging)์ผ๋ก ๋์ํ๋ค. ์ด์ธ์๋ Istio overview: Observability์์ ๋
ผํ (Access) Logs๋ Audit์ ์ํ ์ฅ์น๋ก ๋ณผ ์ ์๋ค.
ZTA ๋ฐ Istio์์ ๊ตฌ์ฒด์ ๊ด๊ณ์ ๋ํด์๋ Zero Trust Architecture via Istio ๋ฅผ ์ฐธ๊ณ ํ๋ค.
์ฌ์ฉ์ ๊ด์ ๋ณด์ via OIDC, RequestAuthentication

Istio์ ์ฌ์ฉ์ ๋ณด์ ๊ตฌ์กฐ
์ฌ์ฉ์ ์ธ์ฆ์ผ๋ก๋ ๋ํ์ ์ธ ์ธ์ฆ ํ๋กํ ์ฝ์ธ JWT/JWK, OAuth 2.0 ๊ธฐ๋ฐ์ OpenID Connect(OIDC)๋ฅผ ์ง์ํ๋ค. RequestAuthentication Istio resource๋ IdP(ID Provider) ์ ๋ณด ๋ฐ ์ ์ฉํ workload๋ฅผ ์ง์ ํ๊ธฐ ์ํด ์ฌ์ฉํ๋ค.
์๋๋ ์ ๊ณต์ ๋ฌธ์์ ๋ด๊ธด RequestAuthentication ๋ฐ AuthorizationPolicy ์๋ฅผ ์๋ฏธ๋ฅผ ๋ช
ํํ ํ๊ธฐ ์ํด ์ผ๋ถ ์์ ํ ์ฝ๋๋ก, app:httpbin ์ธ workload์ ์ ๊ทผ์ ์ํด์๋ issuer-foo ๋ IdP(ID Provider)๊ฐ ๋ฐ๊ธํ JWT์, Host header๊ฐ httpbin.com ์ธ request ์ผ ๊ฒฝ์ฐ์๋ง ํ์ฉํจ์ ์๋ฏธํ๋ค.
AuthorizationPolicy ๋ access control๋ฅผ ์ํ ๊ฒ์ผ๋ก AuthorizationPolicy : Access Control in L7 ์์ ๋ณ๋๋ก ๋ค๋ฃฌ๋ค.
apiVersion: security.istio.io/v1
kind: RequestAuthentication
metadata:
name: httpbin
namespace: foo
spec:
selector:
matchLabels:
app: httpbin # app:httpbin label์ ๊ฐ์ง workload์ ์ ์ฉ. ์์ ๊ฒฝ์ฐ namespace(foo)์ ๋ชจ๋ workload์ ์ ์ฉ๋จ.
jwtRules:
- issuer: "issuer-foo" # IdP ์ง์ . JWT์ ISS์ ํด๋น: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
jwksUri: https://issuer-foo.com/.well-known/jwks.json # IdP์ JWKS endpoint (JWT validation ์ฉ๋)
---
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
name: httpbin
namespace: foo
spec:
selector:
matchLabels:
app: httpbin # app:httpbin label์ ๊ฐ์ง workload์ ์ ์ฉ. ์์ ๊ฒฝ์ฐ namespace(foo)์ ๋ชจ๋ workload์ ์ ์ฉ๋จ.
rules:
- from:
- source:
requestPrincipals: ["issuer-foo/*"] # JWT์ "<ISS>/<SUB>"์ ๋งค์นญ
to:
- operation:
hosts: ["httpbin.com"] # HTTP request์ Host header value์ ๋งค์นญ
YAML์๋น์ค ๊ด์ ๋ณด์ via mTLS, SPIFFE

Istio์ ์๋น์ค ๋ณด์ ๊ตฌ์กฐ
์๋น์ค ๊ด์ ๋ณด์์์ Istio์ ๊ฐ์ฅ ํฐ ํน์ง์ mTLS์ SPIFFE๋ก์, ์ด๋ค ์๋น์ค๋ ์๋์ผ๋ก ์ฌํ Istio ์๋น์ค์ ํตํฉ๋๋ค.
๋จผ์ , mTLS๋ mutual TLS์ ์ฝ์๋ก TLS์ ์๋ฐฉํฅ ์ธ์ฆ ์๋น์ค๋ฅผ ์ถ๊ฐํ๋ค๋ ์ ์ ์ ์ธํ๊ณ ๋ TLS์ ๋์ ๋ฐฉ์์ด ๋์ผํ๋ค. SPIFFE(Secure Production Identity Framework for Everyone)๋ ์๋น์ค๋ฅผ ์์ ํ๊ฒ ์๋ณํ๊ธฐ ์ํ open-source ํ์ค์ผ๋ก mTLS ๊ธฐ๋ฐ ์์ ๋์ํ๋ค. ์ฐธ๊ณ ๋ก, Istio ๋ฐ Kubernetes ๋ฟ ์๋๋ผ AWS, GCP, Azure ๋ฑ ์ฃผ์ CSP๊ฐ SPIFFE๋ฅผ ์ง์ ์ค ์ด๋ค(์ฐธ๊ณ ).
๋ค์์ Istio ๊ธฐ๋ฐ์ mTLS, SPIFFE ํน์ง์ด๋ค.
-
SPIFFE ID: workload ID based on k8sServiceAccount- SPIFFE ID๋ workload ์๋ณ์๋ก์ k8s
ServiceAccount์ ๊ธฐ๋ฐ - e.g.
spiffe://cluster.local/ns/cluster/sa/dockebi
- SPIFFE ID๋ workload ์๋ณ์๋ก์ k8s
-
SVID: SPIFFE ID in X.509 certificateSVID๋ SPIFFE Verifiable Identity Document์ ์ฝ์๋ก SPIFFE ID๊ฐ ๋ด๊ธด ๋ฌธ์๋ฅผ ์๋ฏธ.- ๋ฌธ์ format์ผ๋ก JWT๋ ์ฌ์ฉ๋๋, Istio๋ X.509 certificate์ ์ฌ์ฉํ์ฌ SAN(Subject Alternative Name)๋ด URI์ SPIFFE ID๊ฐ ์์น.
-
istiodas a CA(Certificate Authority) / SPIFFE Workload APIistiod๋ X.509SVID๋ฅผ ๊ฐ workload์ ๋ฐ๊ธํจ์ผ๋กSVID๋ฐ๊ธ ์ฃผ์ฒด๋ฅผ ์๋ฏธํ๋ SPIFFE Workload API ์ญํ ์ ์ํ
-
Istio proxy as SPIFFE Endpoint
- Istio Proxy ๊ฐ ํต์ ์
SVID๊ธฐ๋ฐ์ผ๋ก mTLS ์์ ์ด๋ฃจ์ด์ง์ผ๋ก SPIFFE Workload Endpoint ์ญํ ์ ์ํ
- Istio Proxy ๊ฐ ํต์ ์
-
์ธ๋ถ SPIRE ์๋ฒ ์ฐ๋ ์ง์
istiod๋์ ์ธ๋ถ SPIRE(SPIFFE Runtime Environment) ์๋ฒ๊ฐ ๋ฐ๊ธํSVID๊ธฐ๋ฐ์ผ๋ก ๋์ ๊ฐ๋ฅ. https://istio.io/latest/docs/ops/integrations/spire/ ์ฐธ๊ณ .
์ถ๊ฐ๋ก Istio/Envoy๋ ์๋์ ๊ฐ์ด SPIFFE-ID๊ฐ ๋ด๊ธด X-Forwarded-Client-Cert header๋ฅผ HTTP request๋ก ํจ๊ป ์ ๋ฌํ๋ค.
# URI(client): dockebi-tock
# By(current proxy): dockebi-storage
# Hash: SHA 256 digest of the client certificate
"X-Forwarded-Client-Cert": 'By=spiffe://cluster.local/ns/cluster/sa/dockebi-storage;Hash=252bad1a52c5523d594fbd1bb75a586b413ce501993946a27c8161b552062eaf;Subject="";URI=spiffe://cluster.local/ns/cluster/sa/dockebi-tock',
YAML์ฐธ๊ณ ๋ก ์ฌ์ฉ์ ์ธ์ฆ(RequestAuthentication)์ ๋๋น๋๋ PeerAuthentication ๋ Istio resource๋ ์๋๋ฐ, namespace, worload, port ๋จ์๋ก mTLS ์ ์ฉ ์์ค(DISABLE, STRICT, PERMISSIVE)์ ์ง์ ํ๋ ๊ธฐ๋ฅ ์ด์ธ์๋ ์์ผ๋ฉฐ Ambient mode์์๋ ์ฌ์ฉ๋์ง ์๋๋ค๊ณ ํ๋ค. ๋ณ๋ ์ง์ ์ด ์์ผ๋ฉด PERMISSIVE (mTLS ์ด์ธ์ ํต์ ๋ ๊ฐ๋ฅ)๋ก ๋์ํ๋๋ฐ, ๊ณต์ ๋ฌธ์๋ ๋ณด์ mTLS์๋ง ํ์ฉ๋ resource์ ๋ํ ์๋ชป๋ ์ ๊ทผ ๊ฐ๋ฅ์ฑ์ผ๋ก ์ธํด STRICT๋ฅผ ๊ถ์ฅํ๋ค.
์๋น์ค ๊ฐ ๋ณด์์ ์ฌ์ฉ๋๋ ์ธ๊ฐ(AuthorizationPolicy)์ ๋ํด์๋ ์๋์์ ์ค๋ช
ํ๋ค.
AuthorizationPolicy : Access Control in L7
์์ ๋
ผํ๋ฏ Istio๋ ์ฌ์ฉ์, ์๋น์ค ๋ชจ๋์ ๋ํ access control์ ์ํด AuthorizationPolicy ๋ฅผ ์ฌ์ฉํ๋ค. Kubernetes NetworkPolicy์ ๋น๊ตํ ์ ์๋๋ฐ, Kubernetes NetworkPolicy๊ฐ L4๊น์ง์ ๋์์ด๋ผ๋ฉด AuthorizationPolicy ๋ L7๊น์ง์ ๋์์ด๋ค.
์ฃผ์ ์์๋ ๋ค์๊ณผ ๊ฐ๋ค.
-
selectorย : ํด๋นAuthorizationPolicy๊ฐ ์ ์ฉ๋ target workload ์ง์ . ์๋ต๋ ๊ฒฝ์ฐ ํด๋น namespace์ ๋ชจ๋ workload์ ์ ์ฉ๋จ. -
actionย : request๋ฅผ ์์ฉ(ALLOW; default)ํ ์ง, ๊ฑฐ๋ถ(DENY)ํ ์ง ๋ฑ์ ์ ์ฑ ์ ์ง์ .AUDIT์ log์ ๊ธฐ๋ก๋ง ํ๊ณ ,CUSTOM์ ์ธ๋ถ์ policy, ์์ปจ๋ฐ OPA(Open Policy Agent)์ ํ๊ฐ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ๋ฅธ๋ค. -
rulesยaction์ด ์ํ๋ ์กฐ๊ฑด์ ์ง์ fromย : request์ source๋ฅผ ์ง์ toย : ํด๋น ์ ์ฑ ์ด ์ ์ฉ๋ ๊ตฌ์ฒด์ ๋์์ ์ง์ whenย : ๊ธฐํ ์์ธ ์กฐ๊ฑด์ ์ง์
์๋ ์ฝ๋๋ ์๋น์ค ๊ฐ ๋ณด์ ์์์์ AuthorizationPolicy ์๋ก, ์๋๋ ์ฝ๋์ ๋ํ ์ค๋ช
์ด๋ค.
- target workload:
app:httpbin-backendlabel์ ๊ฐ์ง workload ๋ฐ - target operations:
GET /info*,POST /dataendpoints์ ์ ์ฑ ์ด ์ ์ฉ๋์ด, - when:
https://issuer-foo.com์์ ๋ฐ๊ธํ JWT๊ฐ request์ ์๊ณ , - source: service account๊ฐ
foonamespace์ name์ดhttpbin์ธ workload ๋๋testnamespace์ธ workload๋ง target ์ ๊ทผ(ALLOW) ๊ฐ๋ฅ
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
name: httpbin-backend
namespace: foo
spec:
action: ALLOW # default. rules์ ์ง์ ๋ ๊ท์น์ ์ผ์นํ๋ request๋ง access ํ์ฉ. DENY์ ๊ฒฝ์ฐ access ๊ฑฐ๋ถ๋ฅผ ์๋ฏธ.
selector:
matchLabels:
app: httpbin-backend # app:httpbin-backend label์ ๊ฐ์ง workload์ ์ ์ฉ. ์์ ๊ฒฝ์ฐ namespace(foo)์ ๋ชจ๋ workload์ ์ ์ฉ๋จ.
rules:
- from:
- source:
principals: ["cluster.local/ns/foo/sa/httpbin"]
- source:
namespaces: ["test"]
to:
- operation:
methods: ["GET"]
paths: ["/info*"]
- operation:
methods: ["POST"]
paths: ["/data"]
when:
- key: request.auth.claims[iss]
values: ["https://issuer-foo.com"]
YAML์ฐธ๊ณ ๋ก, ๋์ผ worload์ ๋ํด ๋ค์์ AuthorizationPolicy ๊ฐ ์์ ๊ฒฝ์ฐ ํ๊ฐ ๊ท์น์ ๋ค์๊ณผ ๊ฐ๋ค.

์ถ์ฒ: https://istio.io/latest/docs/concepts/security/#implicit-enablement
Istio overview: Extensibility, Etc. ๋ก ์ด์ด์ง๋๋ค.
References
๋ณธ ๊ธ ์์ฑ์ ์ฃผ๋ก ์ฐธ์กฐํ ๋ฌธ์์ด๋ค.
https://www.manning.com/books/istio-in-action




Comments