티스토리 뷰

아파치 인증서 세팅 방법

자 이제 본격적으로 인증서를 적용해본다.

기존에 apache httpd.conf를 수정했다면 원복을 하여 최초 초기값으로 하는게 좋다.

괜히 httpds.conf랑 ssl.conf랑 중복으로 설정되어 있으면 안되기 때문.

1. /etc/httpd/ 경로에 ssl 폴더를 만들어 인증서 파일 3개를 넣는다.
bbb.aaa.com.crt
bbb.aaa.com.key
ca-bundle.crt

httpd.conf 파일 내에
IncludeOptional conf.d/*.conf
Include conf.modules.d/*.conf
이렇게 되어 있어서
/etc/httpd/conf.d/ssl.conf 파일을 수정해도 먹힌다.

/etc/httpd/conf.d를 에디터로 연다.

상단에 Listen 443 https로 되어 있을 것이다.
이부분을
#Listen 443 https
Listen 8081 https
Listen 8082 https

2. 기본값 443을 주석처리하고 8081,8082를 쓰겠다고 위와 같이 선언해준다.(여기서는 443을 안쓰고 8081,8082를 쓸것이다.)

3. VirtualHost 에 있는 _default_:443을 8081로 바꾼다.
그 다음 Server Name을 쓰고 Proxy 설정을 한다. 아래와 같다.


ServerName aaa.com:8081

ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://1.1.1.1:8081/
ProxyPassReverse / http://1.1.1.1:8081/

4. 1번에 ssl 폴더에 인증서 3개를 넣은 SSL 정보 3개를 입력해준다.
SSLCertificateFile /etc/httpd/ssl/bbb.aaa.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/bbb.aaa.com.key
SSLCertificateChainFile /etc/httpd/ssl/ca-bundle.crt

혹시 위에것 연습하다가 httpd.conf 에 Listen 8081이 남아 있다면 삭제해야 한다.
아니면 apachctl restart할때 오류가 난다.
Listen 8081 이 httpd.conf와 ssl.conf 둘다 있으면 에러가 난다.


ssl.conf 의 VirtualHost 부분은 아래와 같다. (원래 있던것에서 주석은 지웠다.)



ServerName aaa.com:8081

ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://1.1.1.1:8081/
ProxyPassReverse / http://1.1.1.1:8081/

ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

SSLEngine on

SSLProtocol all -SSLv2 -SSLv3

SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA

SSLCertificateFile /etc/httpd/ssl/bbb.aaa.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/bbb.aaa.com.key
SSLCertificateChainFile /etc/httpd/ssl/ca-bundle.crt


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars


BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"





ServerName aaa.com:8082

ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://1.1.1.1:8082/
ProxyPassReverse / http://1.1.1.1:8082/

ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

SSLEngine on

SSLProtocol all -SSLv2 -SSLv3

SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA

SSLCertificateFile /etc/httpd/ssl/bbb.aaa.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/bbb.aaa.com.key
SSLCertificateChainFile /etc/httpd/ssl/ca-bundle.crt


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars


BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"



설정을 마쳤으면 웹서버를 다시 시작합니다.
apachectl restart
https://1.1.1.1:8081로 접속해본다.
http가 아닌 https로 해야한다.

잘 안되면 아래 사이트에서 테스트해보면 된다.
http://www.ssltest.net


SSL Status
Missing intermediate certificate
ServerName 1.1.1.1:8081 이렇게 되어 있는것을
ServerName aaa.com:8081 이렇게 바꾸니 되었다.

두번째 했을때는
Service Unavaliable 이 나왔다.

/var/log/httpd에 로그들이 있으니 참조하면 된다.

www.ssltest.net 에 들어가서 해보니
Test sent Server Name Indication (not supported by older clients, i.e. Window XP).

로그를 보니
/var/log/httpd/ssl_error_log

ap_proxy_connect_backend disabling worker for (1.1.1.1) for 60s
이런 메시지가 있었다.

ProxyPass / https://1.1.1.1:8081/ retry=0

구글링 해보니 위에처럼 해보라서 했더니 그래도 안됐다.

방화벽이 막히면 그럴 수 있다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함