공통 OpenSSL의 설치 및 운영

황제낙엽 2007.09.27 21:56 조회 수 : 2423 추천:107

 

윈디하나의 솔라나라: OpenSSL

OpenSSL

설치할 OpenSSL 버전

  • OpenSSL 0.9.8a

OpenSSL을 사용할 어플리케이션 버전

  • Apache 2.0.50

들어가기 전에

  • OpenSSL은 보안 향상을 위해 사용된다. 그러나 OpenSSL에는 아직 버그가 존재하기 때문에, 수시로 OpenSSL의 버전을 확인해 업데이트 해주어야 한다.
  • SSL은 주로 패킷 스나이핑으로 인한 피해를 줄여줄 뿐이다. 그 이상은 안된다. 만능이 아니다! SSL 설치하고 '보안은 끝'이라고 생각하는 것은 오산일 뿐이다. [SSL을 설치했는데 왜 해킹을 당했나요?]라는 질문은 참 바보같은 질문이다. 해킹에는 수십~수백가지 방법이 있으며, SSL은 그중 하나인 패킷 스나이핑을 무력화할 뿐이다. (패킷스나이핑이 되지 않도록 하는게 아니라, 스나이핑 해봤자 내용이 암호화되어있어 무슨 내용인지 알 수 없도록 만드는 것이다)
  • SSL의 단점? 단 한가지있다. 느리다는 것이다. 느려도 너무 느리다. 패킷의 인코딩/디코딩에 많은 CPU자원을 소모한다. 필자는 이런 서버에는 과감히 다음과 같이 말한다. 'SSL 쓰지말아' 패킷 암호화를 하지 않아도 보안을 향상시킬 수 있는 다른 방법도 많다.
  • 최종 갱신일: 2007-04-19
  • 이 문서는 http://www.solanara.net/ 에서 최신버전을 구할 수 있다.

1. OpenSSL 설치

# 패키지 설치root@wl ~ # wget ftp://ftp.sunfreeware.com/pub/freeware/intel/9/openssl-0.9.8e-sol9-x86-local.gzroot@wl ~ # gunzip openssl-0.9.8e-sol9-intel-local.gzroot@wl ~ # pkgadd -d openssl-0.9.8e-sol9-intel-local# OpenSSL 소스 설치: http://www.openssl.orgroot@wl ~ # wget http://www.openssl.org/source/openssl-0.9.8e.tar.gzroot@wl ~ # gtar xvfz openssl-0.9.8e.tar.gzroot@wl ~ # cd openssl-0.9.8eroot@wl ~/openssl-0.9.8e # ./configroot@wl ~/openssl-0.9.8e # makeroot@wl ~/openssl-0.9.8e # make testroot@wl ~/openssl-0.9.8e # make install# 환경 설정root@wl ~ # vi /etc/profile# for OpenSSL located at /usr/local/sslif [ -d /usr/local/ssl ]then  PATH=$PATH:/usr/local/ssl/bin  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/libfi

2. OpenSSL 인증서 만들기

root@wl ~ # cd /usr/local/ssl/certsroot@wl /usr/local/ssl/certs # openssl req -new -nodes -out req.pem -keyout req.keyGenerating a 1024 bit RSA private key.......++++++.......++++++writing new private key to '/usr/local/ssl/certs/root.cert'-----You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:KRState or Province Name (full name) [Some-State]:GyungGiDoLocality Name (eg, city) []:SuwonOrganization Name (eg, company) [Internet Widgits Pty Ltd]:SolanaraOrganizational Unit Name (eg, section) []:SolanaraTeamCommon Name (eg, YOUR name) []:wl.solanara.net 1)Email Address []:admin@solanara.netPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:root@wl /usr/local/ssl/certs # ls -alF 2)

1) Apache설정파일인 httpd.conf의 ServerName에 들어갈 값을 적어준다. 아파치는 이부분을 검사한다. 도메인이 있다면 www.company.com과 같이 전체를 다 써준다. 없다면 192.186.0.1과 같이 IP를 써도 된다. 다른 내용을 쓰면 인증을 다시 받아야 하는 불상사가 생길 수 있다. 유료 루트 인증기관에 보내기 전에 전화를 걸어 반드시 확인하도록 한다.
2) 총 2개의 파일이 생성되었다. req.key는 공개키이고, req.pem (certificate signing request)을 CA(Certification Authority=인증기관, 예: 베리사인, 타우트)에게 보내 인증 받아야 한다.

3. Root CA가 되기

CA에서 인증 받으려면 비용이 들기 때문에 테스트용으로는 자신이 CA가 될 필요가 있다. 그런데 CA가 되려면 Root CA(최상위 인증 기관)의 인증이 필요하다. 그리고 그 인증을 받기 위해서는 비용이 든다. 따라서 여기서는 Root CA가 되는 방법을 소개한다. Root CA도 CA중 하나이므로 CA가 하는 일을 모두 할 수 있다.

root@wl /usr/local/ssl/certs # openssl genrsa -des3 -out ca.key 1024 1)Generating RSA private key, 1024 bit long modulus............................++++++............++++++e is 65537 (0x10001)Enter pass phrase for ca.key:*****Verifying - Enter pass phrase for ca.key: *****root@wl /usr/local/ssl/certs # openssl req -new -x509 -days 365 -key ca.key -out ca.crt 2)Enter pass phrase for ca.key:You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:KRState or Province Name (full name) [Some-State]:GyungGiDoLocality Name (eg, city) []:SuwonOrganization Name (eg, company) [Internet Widgits Pty Ltd]:SolanaraOrganizational Unit Name (eg, section) []:SolanaraTeamCommon Name (eg, YOUR name) []:WindyHanaEmail Address []:admin@solanara.netroot@wl /usr/local/ssl/certs # openssl x509 -req -CA ca.crt -CAkey ca.key -days 365 -in req.pem -out signed-req.pem -CAcreateserial 3)Signature oksubject=/C=KR/ST=GyungGiDo/L=Suwon/O=Solanara/OU=SolanaraTeam/CN=wl.solanara.net/emailAddress=admin@solanara.netGetting CA Private KeyEnter pass phrase for ca.key:*****root@wl /usr/local/ssl/certs # chmod 600 *root@wl /usr/local/ssl/certs # ls -alF 4)총 18drwxr-xr-x   2 root     bin          512 10월 26일  13:44 ./drwxr-xr-x  10 root     bin          512 10월 26일  13:40 ../-rw-------   1 root     other       1074 10월 26일  13:44 ca.crt-rw-------   1 root     other        963 10월 26일  13:43 ca.key-rw-------   1 root     other         17 10월 26일  13:44 ca.srl-rw-------   1 root     other        887 10월 26일  13:43 req.key-rw-------   1 root     other        676 10월 26일  13:43 req.pem-rw-------   1 root     other        855 10월 26일  13:44 signed-req.pemroot@wl /usr/local/ssl/certs # 

1) Root CA의 1024bit private key 파일을 만든다. 결과 파일은 ca.key 이다.
2) 인증서를 만든다. 결과파일은 ca.crt파일이다. ca.crt를 Internet Explorer에 등록해주면 '올바르지 않은 CA'라는 에러메시지를 없앨 수 있다.
3) 이제 Root CA가 되는 일은 끝났다. 클라이언트가 요청한 req.pem을 싸인해주자. 결과파일은 signed-req.pem이다. 베리싸인과 같은 인증 기관은 이 명령 한줄만 실행 해주면 된다. (그러면서 도대체 얼마를 받는거야... ㅡ,.ㅡ)
4) ca.key와 req.key는 소중하게 보관해야 한다. 절대 외부에 유출되서는 안된다.
아파치와 같은 여러 유닉스 데몬에서 SSL을 사용할 때 사용되는 파일은 req.key와 signed-req.pem의 내용이며, 몇몇 데몬은 ca.crt의 내용까지 요구하는 경우도 있다. (형태가 파일인 경우가 대부분이지만 DB에 저장된 문자열일 수도 있다. 실제로 req.key 와 signed-req.pem 은 vi 에디터등으로 열어 내용을 볼 수 있는 텍스트 파일이다) ca.key파일은 디스켓에 담아 별도로 보관한다. (이것이 유출되지 않아야 SSL의 보안이 안전해진다. CA는 이 키 파일의 보안에 많은 비용을 들인다)

3. 어플리케이션 설치

※ Apache 프로그램 설치

root@wl ~/httpd-2.0.50 # ./configure --prefix=/usr/local/apache2 --enable-so --with-mpm=worker  --enable-ssl --with-ssl=/usr/local/sslroot@wl ~/httpd-2.0.50 # makeroot@wl ~/httpd-2.0.50 # make installroot@wl ~/httpd-2.0.50 # mkdir /usr/local/apache2/conf/ssl.keyroot@wl ~/httpd-2.0.50 # cd /usr/local/apache2/conf/ssl.keyroot@wl /usr/local/apache2/conf/ssl.key # ln -s /usr/local/ssl/certs/req.key server.key # Server Private Keyroot@wl /usr/local/apache2/conf/ssl.key # mkdir /usr/local/apache2/conf/ssl.crtroot@wl /usr/local/apache2/conf/ssl.key # cd /usr/local/apache2/conf/ssl.crtroot@wl /usr/local/apache2/conf/ssl.crt # ln -s /usr/local/ssl/certs/signed-req.pem server.crt # Server Certificateroot@wl /usr/local/apache2/conf/ssl.key # apachectl startssl # 아파치 시작. apachectl start 만하면 SSL이 시작되지 않는다.root@wl /usr/local/apache2/conf/ssl.key # apachectl stop # 아파치 종료

http://www.linuxquestions.org/questions/showthread.php?t=271170 PassPHASE없애기 cp server.key server.key.original openssl rsa -in server.key.original -out server.key chmod 400 server.key

번호 제목 글쓴이 날짜 조회 수
공지 [계속 추가중] SBOM 용어 정의 황제낙엽 2025.04.10 21564
공지 [계속 추가중] Keycloak 용어 및 설정 옵션 정의 황제낙엽 2024.02.02 20405
146 SPDX 2.3, 계속 써도 되나요? — 3.0으로 넘어갈 때를 판단하는 실무 기준 황제낙엽 2026.08.11 55
145 같은 OSS 지만 여러 버전을 등록해야 하는 경우 황제낙엽 2026.04.24 1972
144 [FOSSLight Dependency Scanner] Android Project 의 Dependency Scan 을 위한 Android SDK 설치와 설정 황제낙엽 2026.04.23 1843
143 FOSSLight Hub 의 REST API 이용 (v2) 황제낙엽 2026.03.19 2500
142 [FOSSLight/검토용] 개발그룹의 sbom-info.yaml 분석 및 피드백 절차 황제낙엽 2026.03.16 1982
141 [FOSSLight/관리용] Project Identification 진행에서 최종 SBOM SPDX 문서 추출 황제낙엽 2026.02.09 1916
140 [FOSSLight] 'Download Location' 컬럼 값에 'Different from DB' 라는 푸른색 메세지가 출력 file 황제낙엽 2026.02.06 3613
139 [FOSSLight] Project Identification 진행시의 신규 OSS 등록 처리 방법 황제낙엽 2026.02.06 3750
138 [FOSSLight Hub] License 정보를 직접 등록시 필요한 항목 목록 황제낙엽 2026.02.06 3579
137 [FOSSLight Hub] Open Source 정보를 직접 등록시 필요한 항목 목록 황제낙엽 2026.02.06 3352
136 [OSS] Microsoft.Web.WebView2 황제낙엽 2026.02.06 3352
135 [FOSSLight] fosslight 프로젝트의 'Pre-Review' > 'Open Source' 팝업창의 세 버튼에 대한 용도 황제낙엽 2026.02.06 3572
134 [FOSSLight/검토용] prechecker convert 결과 Hub 등록후 Identification 처리 file 황제낙엽 2026.02.05 3289
133 python venv 설치, fosslight source scanner , binary scanner 설치, 버전 확인 황제낙엽 2026.02.02 3508
132 SPDX 템플릿 다운로드 및 온라인 변환기 황제낙엽 2026.01.22 3870
131 SBOM(Software Bill of Materials) 및 소프트웨어 공급망 보안 관련 주요 정부 기관 및 단체 황제낙엽 2026.01.22 3605
130 [FOSSLight] online guide link 황제낙엽 2026.01.14 1844
129 identification 에서 출력하는 warning, error 메세지 황제낙엽 2025.12.29 1427
128 sbom-info.yaml 을 이용한 dependency scan excel 작성 file 황제낙엽 2025.12.29 3578
127 binary scan 결과물에 대해 취약점이 없는데 왜 SBOM에 넣어야 하나? 황제낙엽 2025.12.17 3484