๐ŸŒฑ Infra 46

[keycloak ๋ง›๋ณด๊ธฐ #5] Keycloak์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ†ตํ•ฉ

์ฐธ๊ณ ์ž๋ฃŒ์ฑ…: https://www.yes24.com/Product/Goods/122459785ํ…Œ์ŠคํŠธ ์†Œ์Šค์ฝ”๋“œ: https://github.com/PacktPublishing/Keycloak---Identity-and-Access-Management-for-Modern-Applications-2nd-Edition ํ†ตํ•ฉ ๋ฐฉ์‹ ์„ค๋ช… Keycloak๊ณผ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ํ†ตํ•ฉํ•  ๋•Œ,  Embedded์™€ Proxied ๋ฐฉ์‹์ด ์žˆ๋‹ค. ๊ฐ ๋ฐฉ๋ฒ•์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ตฌ์กฐ์™€ ๋ณด์•ˆ ์š”๊ตฌ ์‚ฌํ•ญ์— ๋”ฐ๋ผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค.๊ตฌ๋ถ„EmbeddedProxied์„ค๋ช…์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ฝ”๋“œ ๋‚ด์—์„œ Keycloak ์–ด๋Œ‘ํ„ฐ๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์ฆ ๋ฐ ๊ถŒํ•œ ๋ถ€์—ฌ๋ฅผ ์ฒ˜๋ฆฌํ•œ๋‹ค.์—ญ๋ฐฉํ–ฅ ํ”„๋ก์‹œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ  Keycloak๊ณผ์˜ ํ†ต์‹ ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์—ญ๋ฐฉํ–ฅ ํ”„๋ก์‹œ๋ฅผ ์„ค์ •ํ•˜์—ฌ ์• ..

[keycloak ๋ง›๋ณด๊ธฐ #4] Keycloak์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ณด์•ˆ

์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ณดํ˜ธ  1๏ธโƒฃ ๊ฐœ์š”์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ธ๊ฐ€์ฝ”๋“œํ๋ฆ„(Authorization Code Flow)๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•˜๋ฉฐ, PKCE(Proof key for Code Exchange)๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋Š”๊ฒƒ์ด ์ข‹๋‹ค.์ธ๊ฐ€์ฝ”๋“œ ํ๋ฆ„(Authorization Code Flow)๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ์ธ์ฆ ํ๋ฆ„์„ ๊ฐ€์ง„๋‹ค.# [์ดˆ๊ธฐ ๋กœ๊ทธ์ธ ํ๋ฆ„]Browser App Server Keycloak | | | |----(1) ์ ‘๊ทผ ์‹œ๋„------------>| | | ..

[Redis/Valkey ๊ธฐ์ดˆ #1] Object, Data Type ์ดํ•ดํ•˜๊ธฐ

๐Ÿ“Œ Redis Object ๊ฐœ์š” Redis ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์ €์žฅ๊ณต๊ฐ„์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” In-Memory Key-value ์Šคํ† ์–ด ์ด๋‹ค.๋ชจ๋“  ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅ๋˜๋ฏ€๋กœ ๋น ๋ฅธ ์ฝ๊ธฐ/์“ฐ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ๋ฉ”๋ชจ๋ฆฌ๋Š” ์œ ํ•œํ•œ ์ž์›์ด๋ฏ€๋กœ ํšจ์œจ์ ์ธ ๊ด€๋ฆฌ๊ฐ€ ํ•„์ˆ˜์ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก, Redis๋Š” ๋ฐ์ดํ„ฐ๋ฅผ Object๋กœ ์ •์˜ํ•˜๊ณ ์žˆ๋‹ค.Redis์˜ ๊ณ ์„ฑ๋Šฅ๊ณผ ํšจ์œจ์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ์„ ๊ฐ€๋Šฅํ•˜๊ธฐ ์œ„ํ•ด Object๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ์—ญํ• ์„ ํ•œ๋‹ค.๋ฐ์ดํ„ฐ ํ‘œํ˜„๋ชจ๋“  ํ‚ค-๊ฐ’ ์Œ์„ RedisObject๋กœ ํ†ต์ผํ•˜์—ฌ ํ‘œํ˜„๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ํƒ€์ž…(String, List, Hash ๋“ฑ)์„ ํ•˜๋‚˜์˜ ๊ตฌ์กฐ๋กœ ๊ด€๋ฆฌ๋ฉ”๋ชจ๋ฆฌ ์ตœ์ ํ™”๋ฐ์ดํ„ฐ ํŠน์„ฑ์— ๋”ฐ๋ผ ์ตœ์ ์˜ ์ธ์ฝ”๋”ฉ ๋ฐฉ์‹์„ ์ž๋™ ์„ ํƒ์ž‘์€ ๋ฐ์ดํ„ฐ๋Š” ์••์ถ•๋œ ํ˜•ํƒœ๋กœ ์ €์žฅ์ค‘๋ณต ๋ฐ์ดํ„ฐ๋Š” ์ฐธ์กฐ ๋ฐฉ์‹์œผ๋กœ ์ €์žฅ์„ฑ๋Šฅ ์ตœ์ ํ™”๋ฐ์ดํ„ฐ ์ ‘๊ทผ..

[keycloak ๋ง›๋ณด๊ธฐ #3] ์ ‘๊ทผ๊ถŒํ•œ์ธ๊ฐ€ ์ดํ•ดํ•˜๊ธฐ

์ฐธ๊ณ ์ž๋ฃŒ* ์ฑ…: https://www.yes24.com/Product/Goods/122459785* ํ…Œ์ŠคํŠธ ์†Œ์Šค์ฝ”๋“œ: https://github.com/PacktPublishing/Keycloak---Identity-and-Access-Management-for-Modern-Applications-2nd-Edition ์‹ค์Šต ์ค€๋น„) Keycloak & ํ…Œ์ŠคํŠธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ธํŒ… Keycloak ์ค€๋น„Keycloak์„ ๋กœ์ปฌ์—์„œ ๋จผ์ € ์‹คํ–‰ํ•œ๋‹ค.docker run -p 8080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak \ st..

[keycloak ๋ง›๋ณด๊ธฐ #2] OpenID Connection ์‚ฌ์šฉ์ž ์ธ์ฆ ์ดํ•ดํ•˜๊ธฐ

์ฐธ๊ณ ์ž๋ฃŒ* ์ฑ…: https://www.yes24.com/Product/Goods/122459785* ํ…Œ์ŠคํŠธ ์†Œ์Šค์ฝ”๋“œ: https://github.com/PacktPublishing/Keycloak---Identity-and-Access-Management-for-Modern-Applications-2nd-Edition์‹ค์Šต ์ค€๋น„) Keycloak & ํ…Œ์ŠคํŠธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ธํŒ…Keycloak์„ ๋กœ์ปฌ์—์„œ ๋จผ์ € ์‹คํ–‰ํ•œ๋‹ค.docker run -p 8080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak \ start-dev์ดํ›„ ํ…Œ์ŠคํŠธ..

[keycloak ๋ง›๋ณด๊ธฐ #1] Keycloak ๋กœ์ปฌ์—์„œ ๋„์šฐ๊ณ  Realm ๊ฐœ๋… ์ดํ•ดํ•˜๊ธฐ

๊ฐœ์š”Keycloak์€ ์˜คํ”ˆ์†Œ์Šค(Apache License2.0) ID ๋ฐ ์—‘์„ธ์Šค ๊ด€๋ฆฌ ์†”๋ฃจ์…˜์ด๋‹ค.์ด๊ฒƒ๋งŒ ์•Œ๊ณ  ์ผ๋‹จ ์‹œ์ž‘ํ•ด๋ณด์ž Keycloak ๋„์ปค๋กœ ๋„์›Œ๋ณด๊ธฐKeycloak์€ ์„ค์น˜ ๋งค๋‰ด์–ผ์ด ์ •๋ง ์ž˜๋˜์–ด์žˆ๋‹ค. ๊ณต์‹๋ฌธ์„œ์— ์ •๋ง ์ž์„ธํžˆ ์ž˜ ์ž‘์„ฑ๋˜์–ด์žˆ์–ด ๋ฌธ์„œ์— ๋”ฐ๋ผ ์ง„ํ–‰ํ•ด๋ณด์ž.docker run -p 8080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak:24.0.4 \ start-devdocker run ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์‰ฝ๊ฒŒ keycloak์„ ๋„์šธ ์ˆ˜ ์žˆ๋‹ค. http://localhost:8080 ์— ์ ‘์†ํ•˜๊ณ  ๋กœ๊ทธ์ธํ•ด๋ณด์ž. (id..

์ธ์ฆ ๋ฐ ๊ถŒํ•œ ํ”„๋กœํ† ์ฝœ OAuth 2.0, OpenID Connect, SAML ๊ทธ๋ฆฌ๊ณ  Zero Trust์— ๋Œ€ํ•˜์—ฌ

์ด ํฌ์ŠคํŒ…์—์„œ๋Š” ์ž์„ธํ•œ ๋‚ด์šฉ ๋ณด๋‹ค๋Š” ๊ฐœ๋…๋ง›๋ณด๊ธฐ๐Ÿ‘… ์ˆ˜์ค€์˜ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค.  ๐Ÿ“Œ OAuth 2.0, OpenID Connect, SAML ๊ฐ„๋‹จ ๊ฐœ๋… ์ •๋ฆฌ OAuth 2.0: ๊ถŒํ•œ ๋ถ€์—ฌ์— ์ค‘์ ์„ ๋‘” ํ”„๋กœํ† ์ฝœOpenID Connect: OAuth 2.0์„ ํ™•์žฅํ•˜์—ฌ ์ธ์ฆ ๋ ˆ์ด์–ด ์ถ”๊ฐ€SAML: ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ํ™˜๊ฒฝ์— ์ ํ•ฉํ•œ XML ๊ธฐ๋ฐ˜ ์ธ์ฆ ํ”„๋กœํ† ์ฝœ ๊ตฌ๋ถ„OAuth 2.0OpenID ConnectSAML๋ชฉ์ ๊ถŒํ•œ ๋ถ€์—ฌ(Authorization)์‚ฌ์šฉ์ž ์ธ์ฆ(Authentication)์‚ฌ์šฉ์ž ์ธ์ฆ(Authentication)๋ฐ์ดํ„ฐ ํ˜•์‹JSONJSONXML์‚ฌ์šฉ ์‚ฌ๋ก€API ์ธ์ฆ, ๋ชจ๋ฐ”์ผ ์•ฑ์†Œ์…œ ๋กœ๊ทธ์ธ, API ์ธ์ฆ๋ชจ๋ฐ”์ผ ์•ฑ, SPA, API ๊ธฐ๋ฐ˜ ์„œ๋น„์Šค์— ์ ํ•ฉ๊ธฐ์—… SSO, ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ธ์ฆ์ „ํ†ต์ ์ธ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ ํ•ฉ๋ณต์žก์„ฑ..

[ECS exec log ec2] ์Šคํฌ๋ฆฝํŠธ

ECS exec๋„ ๋ถˆํŽธํ•˜๊ณ , ๋กœ๊ทธ๋ฅผ ๋ณด๋Š”๊ฒƒ๋„ ๋ถˆํŽธํ•˜๊ณ  ec2 ๋งค๋ฒˆ ์ฐพ์•„๋“ค์–ด๊ฐ€๋Š”๊ฒƒ๋„ ๊ท€์ฐฎ๊ณ  ํž˜๋“ค์–ด์„œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค.. ๋ชจ๋‘์—๊ฒŒ ๋„์›€์ด ๋˜๊ธฐ๋ฅผ... ๐Ÿฅฒ Step 1 ) ECS ์„œ๋น„์Šค ์„ค์ • ๊ฐ€์žฅ ๋จผ์ €, enableExecuteCommand ๊ฐ€ ํ™œ์„ฑํ™” ๋˜์–ด์žˆ์–ด์•ผ ํ•œ๋‹ค. aws ecs update-service --cluster ${ํด๋Ÿฌ์Šคํ„ฐ์ด๋ฆ„} --services ${์„œ๋น„์Šค์ด๋ฆ„} --enable-execute-command true enableExecuteCommand ํ™œ์„ฑํ™” ํ›„์—๋„ ๋ญ”๊ฐ€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๋ฉด ์ด๊ฒƒ์„ ์‹คํ–‰ํ•ด๋ณด์ž (amazon-ecs-exec-checker) Step2) ๋กœ์ปฌ PC์— awscli, Session Manager ์„ค์น˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ์œ„ํ•ด์„œ๋Š” awscli, session Manag..

ECS๋ฅผ ์“ฐ๋ฉด์„œ ๋ถˆํŽธํ•œ์  (ํ›„๊ธฐ)

ECS๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ–ˆ๊ณ , ๊ตฌ์„ฑํ•œ์ง€ 1๋‹ฌ์ด ๊ฑฐ์˜ ๋‹ค ๋˜์–ด๊ฐ„๋‹ค. ๊ทธ๋Ÿฐ๋ฐ...... ์ƒ๊ฐ์ง€๋„ ๋ชปํ•˜๊ฒŒ ๋„ˆ๋ฌด ๋ถˆํŽธํ•œ์ ์ด ๋งŽ๋‹ค. ใ… ใ…  ์ง์ ‘ ๊ฒช์€ ECS์˜ ๋ถˆํŽธํ•œ ์ ๋“ค์„ ๋‚˜์—ดํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค. 1. ๊ด€๋ฆฌํˆด ๋ถ€์กฑ ..... ์˜ค๋ฅ˜ ๋ฐœ์ƒํ–ˆ์„๋•Œ, ์–ผ๋ฅธ ๋“ค์–ด๊ฐ€์„œ ๋กœ๊ทธ๋ฅผ ๋ด์•ผํ•˜๋Š”๋ฐ, ๋กœ๊ทธ๋ณด๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์–ด๋ ต๋‹ค.... ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋กœ๊ทธ๋ฅผ ๋ณด๋ ค๋ฉด ์–ผ๋ฅธ ec2 ์ ‘์†ํ•ด์„œ ๋ด์•ผํ•œ๋‹ค. ๋ณ„๋„์˜ ๋กœ๊ทธ ์†”๋ฃจ์…˜์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, ๋‚˜๋Š” ๊ทธ๋ƒฅ cloudwatch logs์—์„œ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜๊ฑฐ๋‚˜ (๋ถˆํŽธ), ec2์— ์ง์ ‘ ๋“ค์–ด๊ฐ€์„œ docker logs๋กœ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜๊ณ  ์žˆ๋‹ค.(์ด๊ฒƒ๋„ ๋ถˆํŽธ) k8s๋Š” k9s๋กœ ์—„์ฒญ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋กœ๊ทธ๋ฅผ ๋‹ค ๋ณผ ์ˆ˜ ์žˆ๋Š”๋ฐ ๋ง์ด๋‹ค.. ์ด๋Ÿฐ ์‹œ๋Œ€์— ์‚ด๊ณ ์žˆ๋Š” ์šฐ๋ฆฌ์—๊ฒŒ ecs๋Š” ๋„ˆ๋ฌด๋‚˜๋„ ๋ถˆํŽธํ•˜๋‹ค. ์ด๋ฆ„ ๊นƒํ—™๋ ˆํฌ ๋‹จ์  copliot ..

[CodePipeline] ECR์„ ์†Œ์Šค๋กœ ํ•ด์„œ CodeDeploy๋กœ ECS ๋ฐฐํฌํ•˜๊ธฐ

์•ˆ๋…•ํ•˜์„ธ์š” :) ์˜ค๋ž˜๊ฐ„๋งŒ์˜ ํฌ์ŠคํŒ…์ž…๋‹ˆ๋‹ค. ์˜ค๋Š˜์€ ECR์— ์ด๋ฏธ์ง€๊ฐ€ Push ๋˜๋ฉด, ECS์„œ๋น„์Šค ๋ฐฐํฌ ๋ฐฉ์‹(blue/green, rolling)์— ๋”ฐ๋ผ ECS์— ๋ฐฐํฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ƒฅ, ECR ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— latest ํƒœ๊ทธ๋ฅผ ๊ฐ€์ง„ ๋„์ปค์ด๋ฏธ์ง€๊ฐ€ push ๋˜๋ฉด, ๋ฐ”๋กœ ๋ฐฐํฌ๋˜๊ฒŒ๋”... ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค. AWS ๊ณต์‹ ๋ฌธ์„œ๋Š” ์—ฌ๊ธฐ๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ECS ์„œ๋น„์Šค๊ฐ€ ์ด๋ฏธ ๊ตฌ์„ฑ ๋˜์–ด์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ“Œ ์•„ํ‚คํ…์ณ ๐Ÿ“Œ Step 1) CodeCommit ๊ตฌ์„ฑ codecommit์ด ์•„๋‹ˆ์–ด๋„ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค. Github, Bitbucket๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ฝ”๋“œ์ปค๋ฐ‹ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ๋ธ”๋ฃจ/๊ทธ๋ฆฐ ๋ฐฐํฌ๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ appspec.yaml, taskdef.json ๋‘๊ฐœ์˜ ํŒŒ์ผ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋กค๋ง ๋ฐฐํฌ๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ im..

728x90