Skip to content

๐Ÿ’ข private DB ์„œ๋ฒ„์— ์ ‘์†ํ•˜์ง€ ๋ชปํ•˜๋Š” ํ˜„์ƒ

kimminsu edited this page Dec 2, 2024 · 1 revision

private DB ์„œ๋ฒ„์— ์ ‘์†ํ•˜์ง€ ๋ชปํ•˜๋Š” ํ˜„์ƒ

๋ถ„์•ผ ์ž‘์„ฑ์ž ์ž‘์„ฑ์ผ
INFRA ๊น€๋ฏผ์ˆ˜ 24๋…„ 12์›” 03์ผ

๊ฐœ์š”

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ DB ์„œ๋ฒ„์™€ ์›น ๊ด€๋ จ ์„œ๋ฒ„๋ฅผ ๋ถ„๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด 2๊ฐœ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๊ตฌ์„ฑํ•œ ํ›„ public ์„œ๋ฒ„๋Š” ws์™€ was ๊ทธ๋ฆฌ๊ณ  ํด๋ผ์ด์–ธํŠธ ์„œ๋ฒ„๋ฅผ ๊ตฌ์„ฑํ•˜๋„๋ก ํ–ˆ๊ณ , private๋Š” DB๋ฅผ ๋‘์—ˆ๋‹ค.

ํ•˜์ง€๋งŒ ๊ฐ„ํ—์ ์œผ๋กœ DB ์„œ๋ฒ„๊ฐ€ ๊ฐ‘์ž๊ธฐ ์ ‘์†์ด ๋˜์ง€ ์•Š๋Š” ํ˜„์ƒ์ด ์žˆ์—ˆ๋‹ค. ํ•ด๋‹น ํ˜„์ƒ์€ ์ฒ˜์Œ์—๋Š” mysql ์„œ๋ฒ„๊ฐ€ ๋‹ค์šด์ด ๋˜์—ˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์ง€๋งŒ, SSH๋กœ๋„ ์ ‘์†ํ•˜์ง€ ๋ชปํ–ˆ๋‹ค. ์ด๋•Œ ๋ณด์•ˆ ๊ทœ์น™์ด๋‚˜ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”๋„ ์ œ๋Œ€๋กœ ์„ค์ •์ด ๋˜์–ด์žˆ์—ˆ๋‹ค.

๋ฐฉํ™”๋ฒฝ ๋ฌธ์ œ?

์šฐ์„  ๊ฐ€์žฅ ๋จผ์ € ์˜์‹ฌ๋˜์–ด์•ผ ํ•  ๋ฌธ์ œ๋Š” ๋ฐฉํ™”๋ฒฝ์ด์—ˆ๋‹ค. ์ธ์Šคํ„ด์Šค๋ฅผ ์„ค์น˜ํ•˜๋ฉด์„œ ๋ฐฉํ™”๋ฒฝ๋„ ๊ฐ™์ด ์„ค์ •๋˜์—ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์˜€๊ณ  DB์„œ๋ฒ„์— ๋“ค์–ด๊ฐ€์„œ ์ง์ ‘ ํ™•์ธํ•ด๋ณด์•˜๋‹ค.

  • iptables

  • firewall

์˜ˆ์ƒ๊ณผ๋Š” ๋‹ฌ๋ฆฌ ๋ฐฉํ™”๋ฒฝ์ด ํ™œ์„ฑํ™”๊ฐ€ ๋˜์–ด์žˆ์ง€ ์•Š์•˜๋‹ค.

ncloud ๋ฌธ์ œ?

์ด๋ฒˆ์—๋Š” ncloud์—์„œ ์˜๋„์ ์œผ๋กœ ๋ง‰์•˜๋‹ค๋Š” ์˜์‹ฌ์„ ํ•˜๊ฒŒ๋˜์—ˆ๋‹ค. ์˜์‹ฌ์„ ํ•œ ๊ณ„๊ธฐ๋Š” ๋‹ค๋ฅธ ํŒ€์› ๋ถ„๊ป˜์„œ ๋˜ ๋‹ค๋ฅธ ์ธ์Šคํ„ด์Šค๋ฅผ ๋งŒ๋“  ํ›„ ํ•ด๋‹น ์ธ์Šคํ„ด์Šค๋ฅผ ์šฐํšŒํ•œ ํ›„ DB ์„œ๋ฒ„์— ์ ‘๊ทผํ–ˆ์„ ๋•Œ ์ ‘์†์ด ์ž˜ ๋˜์—ˆ๋‹ค๊ณ  ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๋˜ํ•œ ์ผ์ • ์‹œ๊ฐ„์ด ์ง€๋‚œ ํ›„ ๋‹ค์‹œ ์ ‘์†ํ–ˆ์„ ๋•Œ๋Š” ์ž˜ ๋˜์—ˆ๋‹ค. ๊ทธ๋กœ์ธํ•ด ncloud์—์„œ privte์— ๋งŽ์€ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ์ด ์˜ค๊ฐ€๋ฉด ๋ฒค์„ ์ง„ํ–‰ ํ–ˆ์„๊ฑฐ๋ผ ์ƒ๊ฐ์ด ๋“ค์—ˆ๊ณ , ๊ณ ๊ฐ์„ผํ„ฐ์— ํ•œ๋ฒˆ ๋ฌธ์˜ํ–ˆ์—ˆ๋‹ค.

ํ•˜์ง€๋งŒ ncloud๋„ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ์—ˆ๋‹ค.

์›์ธ์€ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ” ์„ค์ •

์—ฌ๋Ÿฌ๊ฐ€์ง€๋ฅผ ์‹œ๋„ํ•ด ๋ณด์•˜์ง€๋งŒ, ํ•ด๊ฒฐ์ด ๋˜์ง€ ์•Š์•„์„œ ์ขŒ์ ˆ์— ๋น ์กŒ์„ ๋•Œ, ์ด์ „์— ํ•™๊ต ๊ณผ์ œ๋กœ ์ง„ํ–‰ํ–ˆ๋˜ ๋ผ์šฐํŒ…์ด ์ƒ๊ฐ์ด ๋‚ฌ์—ˆ๊ณ  ๊ด€๋ จ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ž˜ ์—ฐ๊ฒฐ์ด ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ–ˆ๋‹ค.

ํ™•์ธํ•ด๋ณธ ๊ฒฐ๊ณผ ์ง์ ‘์ ์œผ๋กœ ๋‚ด๋ถ€ ์„œ๋ฒ„(192.168.96.100.6)์— ์ ‘์†ํ•˜๋Š” ๊ฒฝ๋กœ๊ฐ€ ์—†์–ด์„œ ์ถ”๊ฐ€๋ฅผ ํ–ˆ๋‹ค.

ip route add [DESTINATION] via [GATEWAY] dev [DEVICE]

๋ผ์šฐํŒ…์„ ์ง์ ‘ ์—ฐ๊ฒฐํ•˜๊ณ  ๋‚œ ํ›„ ๋‹ค์‹œ ์ ‘์†ํ–ˆ์„ ๋•Œ ์ ‘์†์ด ์ž˜ ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

๐Ÿœ ํŒ€ ๊ฐœ๋ฏธ

๐Ÿ›๏ธ ํŒ€ ๋ฌธํ™”

๊ฐœ๋ฐœ ์œ„ํ‚ค

FE

BE

Infra

๐Ÿ—ฃ๏ธ ๋ฐœํ‘œ

๐Ÿ“š ํšŒ์˜๋ก

๐Ÿ”ด ์ธํ„ฐ๋ฏธ์…˜
๐ŸŸ  1์ฃผ์ฐจ
๐ŸŸก 2์ฃผ์ฐจ
๐ŸŸข 3์ฃผ์ฐจ
๐Ÿ”ต 4์ฃผ์ฐจ
๐ŸŸฃ 5์ฃผ์ฐจ
๐ŸŸค 6์ฃผ์ฐจ

๐Ÿ’ญ ํšŒ๊ณ 

๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ ๋ฉ˜ํ† ๋ง

Clone this wiki locally