카테고리 없음2021. 3. 7. 16:44
  1. 확인
  • 아파치 버전 확인

    /usr/local/apache/bin/apachectl -v ,

  • openssl 설치되어 있는지 확인

    rpm -qa | grep openssl (설치되어 있지 않으면 -> yum -y install openssl)

  • ssl 모듈 설치 되어있는지 확인

    /usr/local/apache/bin/apachectl -l

  1. 개인키 생성
  • 인증서를 보관할 디렉터리로 이동 하여 개인키 생성

    openssl genrsa -des3 -out <개인키 파일명>.key 2048

  • 확인

    openssl rsa -noout -text -in <개인키 파일명>.key

  1. CSR 생성
  • csr 생성

openssl req -new -key <개인키 파일명>.key -out<csr파일명>.csr

  • 항목 설명

Country Name (2 letter code) [XX]: -> 국가코드 (KR= 대한민국)

State or Province Name (full name) []: → 지역

Locality Name (eg, city) [Default City]: → 시/군/구

Organization Name (eg, company) [Default Company Ltd]: → 회사명

Organizational Unit Name (eg, section) []: → 부서명

CommonName (eg, your name or your server's hostname) []: → 도메인명

Email Address []: -> e-mail 주소

  1. 인증서 신청
  • csr 파일을 확인하여 ----BEGIN 부터 ----END 까지 복사하여 인증서를 신청한다.

    ex ) comodo

  1. 인증서 설치
  • /usr/local/apache/conf/httpd.conf 에서 ssl.conf를 사용하기 위하여 해당부분 주석해제

    Include conf/extra/httpd-ssl.conf

  • /usr/local/apache/conf/extra/httpd-ssl.conf 로 들어가서 자신의 환경에 맞게 설정

SSLCertificateFile /경로/~.crt
설명 : 발급 받은 파일 중 “인증서 파일”을 지정

SSLCertificateKeyFile /경로/~.key
설명 : 발급 받은 파일 중 “개인키 파일”을 지정

SSLCertificateChainFile /경로/ChainBundle.crt
설명 : 발급 받은 파일 중 “Chain CA인증서 파일”을 지정

SSLCACertificateFile /경로/ROOT.crt
설명 : 발급 받은 파일 중 “ROOT CA인증서 파일”을 지정

  1. 방화벽 설정
  • 방화벽에서 ssl 포트를 열어준다 (default 값은 443)
  1. 데몬재시작
  • /etc/init.d/apachectl start & restart

    ssl 설정 후 아파치 재구동 시 개인키 패스워드를 물어본다. 매번 데몬 재시작시 일일히 패스워드를 입력해야 하는 번거로움이 있다.

패스워드 제거 방법 **

  • cp <원본개인키> <백업개인키>

  • openssl rsa -in <원본개인키> -passout pass:'<개인키 패스워드>' -out <패스워드 제거후 생성할 키> -des3


  • 확인

    netstat -nltp

Tip. yum으로 설치한 httpd의 경우

  • /etc/httpd/conf.d/ssl.conf

  • /etc/httpd/conf/httpd.conf 에서 SSLCertificateFile ,SSLCertificateKeyFile 부분 환경에 맞게 설정

 

출처: jieunit.tistory.com/8

Posted by iWithJoy