[OpenSSL] command line 명령으로 TLS 서버 실행하기

기본적으로 s_server 인자와 -accept 를 사용한다. cert파일과 key파일은 자체 인증서를 생성하든지, letsencrypt에서 얻든지 한다. https에 사용되는 인증서를 letsencrypt로부터 얻는 방법은 [TLS] Letsencrypt로부터 https 사용을 위한 인증서 얻기를 참고한다.

$ openssl s_server -accept 443 -key /etc/letsencrypt/live/blog.dasomoli.org/privkey.pem -cert /etc/letsencrypt/live/blog.dasomoli.org/fullchain.pem

-msg 를 사용하면 TLS 관련 메시지를 볼 수 있다. decrypted된 text만 보고 싶다면 -quiet 옵션을 주면 된다. stdout으로 출력된다.

[TLS] Letsencrypt로부터 https 사용을 위한 인증서 얻기

80 포트나 443 포트로 현재 서비스 중인 것이 있다면 멈춘다.

# service apache2 stop

certbot을 이용해서 사용할 도메인의 인증서를 얻는다.

# certbot certonly --standalone -d blog.dasomoli.org

얻어온 인증서는 /etc/letsencrypt/live/도메인명/ 아래에 저장된다. 위의 경우는 /etc/letsencrypt/live/blog.dasomoli.org/ 아래에 저장된다. key 파일은 privkey.pem, cert 파일은 fullchain.pem이 주로 사용된다.

[Ubuntu] root 인증서 설치

프록시를 사용하는 환경에서 https 프로토콜을 사용할 때 인증 오류가 나는 경우, ca-certificate 인증 문제일 경우가 많다. 프록시 사용에 따른 인증서를 제공한다면 이걸 시스템 전역적으로 설치해주면 해결된다. 절차는 간단하다.

$ sudo mkdir /usr/share/ca-certificates/extra
$ sudo cp foo.crt /usr/share/ca-certificates/extra/
$ sudo dpkg-reconfigure ca-certificates

하고나서 껐다켜야 잘 되던데? 왜그런거지..

출처: http://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate