[Server] Https ๋๋ฉ์ธ๊ณผ ์๋ธ๋๋ฉ์ธ์ ์ ์ฉํ๊ธฐ
๐Http
- HyperText Transfer Protocol
- W3 ์์์ ์ ๋ณด๋ฅผ ์ฃผ๊ณ ๋ฐ์ ์ ์๋ ํ๋กํ ์ฝ
- ์ฃผ๋ก TCP๋ฅผ ์ฌ์ฉํ๊ณ HTTP/3๋ถํฐ๋ UDP๋ฅผ ์ฌ์ฉํ๋ฉฐ, 80๋ฒ ํฌํธ๋ฅผ ์ฌ์ฉ
- ๋ธ๋ผ์ฐ์ ์ ์๋ฒ ์ฌ์ด์ ์ ๋ณด๋ฅผ ํ๋ฌธ์ผ๋ก ์ ์ก ( ๋คํธ์ํฌ์์ ์ ์ก๋๋ ์ ๋ณด๋ฅผ ์ฟ๋ณผ ์ ์๋ค)
๐Http
- HyperText Transfer Protocol over Secure Socket Layer
- TCP/IP 443ํฌํธ ์ฌ์ฉ
- ๊ธฐ์กด HTTP๋ ์ด์ด์์ SSL(TLS) ํ๋กํ ์ฝ์ ์น์ด ํ๋ฌธ ๋ฐ์ดํฐ๋ฅผ ์ํธํํจ
- ์์ผ ํต์ ์์ ์ผ๋ฐ ํ ์คํธ๋ฅผ ์ด์ฉํ๋ ๋์ ์, SSL์ด๋ TLS ํ๋กํ ์ฝ์ ํตํด ์ธ์ ๋ฐ์ดํฐ๋ฅผ ์ํธํ -> ๋ฐ์ดํฐ์ ์ ์ ํ ๋ณดํธ ๋ณด์ฅ
๐ HTTPS๋ฅผ ์ฌ์ฉํ๋ ์ด์
- ๊ธฐ๋ฐ์ฑ : HTTPS๋ ์ธํฐ๋ฅ๊ณผ ๊ฐ์ ๊ณต๊ณต ๋งค์ฒด์์ ๋ ์ฐธ์ฌ์ ๊ฐ์ ํต์ ์ ๋ณดํธ
- ๋ฌด๊ฒฐ์ฑ : HTTPS๋ ๋ณ์กฐ๋์ง ์์ ์ ๋ณด๋ก ๋ชฉ์ ์ง์ ๋๋ฌํ๊ฒ ํจ
- ์ธ์ฆ : HTTPS๋ฅผ ํตํด ์น ์ฌ์ดํธ์ ์ง์ ์ฌ๋ถ๋ฅผ ํ์ธํ ์ ์์
๐HTTPS๋ณด์์ด ๋ฐ์ด๋ ์ด์ !
๐SSL(Secure Socket Layer) ์ธ์ฆ์
: ์ฌ์ฉ์๊ฐ ์ฌ์ดํธ์ ์ ๊ณตํ๋ ์ ๋ณด๋ฅผ ์ํธํํ๋๋ฐ, ๋ฐ์ดํฐ๋ฅผ ์ํธ๋ก ๋ฐ๊ฟ์ค๋ค!
: ์ ์ก๋ ๋ฐ์ดํฐ๋ ์ค๊ฐ์์ ๋๊ฐ ํ์ณ๊ฐ๋๋ผ๋ ๋ฐ์ดํฐ๊ฐ ์ํธํ ๋์ด ์๊ธฐ ๋๋ฌธ์ ํด๋ ํ ์ ์๋ค.
: TLS(Transport Layer Security)์ ๊ณผ๊ฑฐ ๋ช ์นญ
๐ TLS๋ SSL 3.0์ ๊ธฐ์ดํด์ IETF๊ฐ ๋ง๋ ํ๋กํ ์ฝ๋ก ์ด๋ SSL 3.0์ ๋ณด๋ค ์์ ํ๊ฒ ํ๊ณ ํ๋กํ ์ฝ์ ์คํ์ ๋ ์ ํํ๊ณ ์์ ์ฑ์ ๋์ด๋ ๋ชฉ์ ์ผ๋ก ๊ณ ์๋จ.
๐Let's Encrypt
Let's Encrypt๋ ๋ฌด๋ฃ์ TLS/SSL ์ธ์ฆ์๋ฅผ ์ฝ๊ฒ ๊ฐ์ ธ์ค๊ณ ์ค์นํ ์ ์๋ ๋ฐฉ๋ฒ์ ์ ๊ณตํ๋
CA(์ธ์ฆ ๊ธฐ๊ด)์ผ๋ก, ์น ์๋ฒ์์ ์ํธํ๋ HTTPS๋ฅผ ์ฌ์ฉํ ์ ์๊ฒ ๋์์ค๋ค.
์ฌ์ฉ์์๊ฒ Certbot๋ผ๋ ์ํํธ์จ์ด๋ฅผ ์ ๊ณตํจ์ผ๋ก์จ ๊ตฌํํ ์ ์๊ฒ ๋์์ค๋ค.
1. Certbot ์ค์น
Certbot๋ฅผ ์ํ repository(์ ์ฅ์)๋ฅผ ์ถ๊ฐ
$ sudo apt update
$ sudo apt upgrade
$ sudo add-apt-repository ppa:certbot/certbot
Certbot์ Nginx ํจํค์ง๋ฅผ ์ค์น
$ sudo apt install python-certbot-nginx
2. Nginx Configuration ์ค์
Nginx ๊ธฐ๋ณธ ์ค์ ํ์ผ์ ๋ค์ด๊ฐ์ ์ธ์ฆ์๋ฅผ ์ ์ฉํ ๋๋ฉ์ธ ์ด๋ฆ์ ์ค์
$ sudo vim /etc/nginx/sites-available/default
๋ณ๊ฒฝ์ ํ๊ณ ํ ์คํธ๋ฅผ ์งํ
$ sudo nginx -t
Nginx๋ฅผ ๋ค์ ๋ก๋
sudo systemctl reload nginx
3. ๋ฐฉํ๋ฒฝ์ HTTPS ํ์ฉ
Ubuntu๋ ๊ธฐ๋ณธ์ ์ผ๋ก ufw๋ผ๋ ๊ธฐ๋ณธ์ ์ธ ๋ฐฉํ๋ฒฝ์ ๊ฐ์ง๊ณ ์๋ค๊ณ ํ๋ค.
HTTPS์ ๋ํ ๋ฐฉํ๋ฒฝ ํ์ฉ ์ค์ ์ด ํ์ํ๋ฐ, AWS EC2 ์ธ์คํด์ค์ ๊ฒฝ์ฐ๋ ๊ธฐ๋ณธ์ผ๋ก ๋ฐฉํ๋ฒฝ์ด
๋นํ์ฑํ๋์ด ์๋ค๊ณ ํจ.
$ sudo ufw status
1 : HTTP ์ฐ๊ฒฐ์ HTTPS๋ก ๋ฆฌ๋ค์ด๋ ํธ ํ์ง ์์
2 : HTTP์ฐ๊ฒฐ์ HTTPS๋ก ๋ฆฌ๋ค์ด๋ ํธํจ
๐ 2 ์ ํ
๋๋ฉ์ธ์ ๋ํ ์๋ฒ๋ฅผ ํ ์คํธ๋ฅผ ํ ์ ์๋ url
4. SSL Lab Server Test๋ก ์ด๋ํ์ฌ ํ ์คํธ
SSL Server Test (Powered by Qualys SSL Labs)
SSL Server Test This free online service performs a deep analysis of the configuration of any SSL web server on the public Internet. Please note that the information you submit here is used only to provide you the service. We don't use the domain names or
www.ssllabs.com
์ค๋ฅ๊ฐ ๋๋ค!!
--> SSL์ด ์ฌ์ฉํ๋ HTTPS์ ๋ํ ํฌํธํฌ์๋ฉ์ ์ํด์ฃผ์๊ธฐ ๋๋ฌธ์
๐์ธ์คํด์ค๋ฅผ ์์ฑํ๋ aws๋ก ๊ฐ์ ๋ณด์์ค์ ์ผ๋ก ๋ค์ด๊ฐ์ 443์ ๋ํ ํฌํธ๋ฅผ ์ด์ด์ค๋ค.
๋ค์ www.ssllabs.com/ssltest/ ์ฌ๊ธฐ๋ก ๋ค์ด๊ฐ์ ๊ฒ์ฌ!
SSL Server Test (Powered by Qualys SSL Labs)
SSL Server Test This free online service performs a deep analysis of the configuration of any SSL web server on the public Internet. Please note that the information you submit here is used only to provide you the service. We don't use the domain names or
www.ssllabs.com
5. Certbot ์๋ ๊ฐฑ์ ํ์ธ
์ค๋ฅ๊ฐ ๋์ง ์๊ณ ๋ชจ๋ ์ค์ ์ด ์ ์๋ฃ๋์๋ค!
๐Nginx์ ์๋ฒ๋ฅผ restart
$ sudo service nginx restart
์ฃผ์์ฐฝ์ yujindonut.shop์ผ๋ก ์น๋ฉด https://๋ก ์ ์ฉ์ด ๋์ด์๋๊ฒ์ ์ ์ ์ ์๋ค.
์ฐธ๊ณ
https://luminitworld.tistory.com/85
2-6 AWS์ Let's Encrypt๋ก HTTPS ์ ์ฉํ๊ธฐ
ํ์ฌ AWS์ ์๋ฒ ํ๊ฒฝ์ ๋ค์ ๊ฐ์ต๋๋ค. ์ด์์ฒด์ : Ubuntu 18.04 (LTS) ์น์๋ฒ : Nginx BL : PHP DBMS : MySQL ์น ์๋ฒ์ ๊ธฐ๋ณธ์ ์ธ ๋ถ๋ถ์ ๊ตฌ์ถํ์ผ๋ ์ด์ ๋ณด์ ๋ถ๋ถ์ ์ ๊ฒฝ ์จ๋ณด๊ฒ ์ต๋๋ค. HTTP(Hypertext Tr..
luminitworld.tistory.com
https://hyeran-story.tistory.com/159
HTTP vs. HTTPS (HTTP์ HTTPS ์ฐจ์ด์ )
HTTPS๋ HTTP์์ ๋ณด์์ด ๊ฐํ๋ ํ๋กํ ์ฝ์ด๋ค.. ์ด์ ๋ ๋ฐ์ ๋ชจ๋ฅด๋ ์ํ์๋๋ฐ ์๋ค๋ฅผ ์ข ๋ ์์ธํ ์ ํ์์ฑ์ ๋๊ปด์ ์์๋ณด๊ณ ์ ํ๋คโ๏ธ๐ฉ๐ป๐ป HTTP HyperText Transfer Protocol W3 ์์์ ์ ๋ณด
hyeran-story.tistory.com