고양이와고래

Ubuntu 20.04 Apache-Tomcat SSL 인증서 적용 (openssl 특정버전 설치) 본문

WAS

Ubuntu 20.04 Apache-Tomcat SSL 인증서 적용 (openssl 특정버전 설치)

고양이와고래 2024. 6. 20. 16:54

▶ openssl 및 필요한 패키지 설치

1. configure, make, make install을 사용하기 위한 gcc 패키지 설치

apt install build-essential -y

 

 

2. openssl 설치

openssl version 확인

openssl version

 

 

2-1. 기존 openssl 삭제

apt remove -y openssl

 

 

2-2. openssl 1.0.2k 설치 (아래 링크에서 원하는 버전 선택)

https://www.openssl.org/source/old/index.html

설치 할 버전 우클릭 후 링크 주소 복사 클릭

 

 

2-3. wget 명령어를 통해 설치

wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz 입력 시 아래와 같이 오류가 뜸

 

 

2-3-1. --no-check-certificate 옵션을 활용하여 설치

wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz --no-check-certificate 

 

 

2-4. 설치한 파일 압축 해제

tar -xvzf openssl-1.0.2k.tar.gz

 

 

2-5. 압축이 해제된 폴더로 들어가, config 명령어를 통해 컴파일

./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared

 

 

2-6. 컴파일한 파일 설치

make && make install

 

 

2-7. 심볼릭 링크 설정

 

 

2-8. 설치 확인

openssl version

 


▶ SSL 인증서 생성

1. 인증서를 생성할 폴더 생성 및 권한 부여

cd /etc/apache2/
mkdir ssl
chmod 777 ssl

 

 

1-1. 서버 키파일 생성

1-1-1. 해당 부분엔 사용할 비밀번호 입력

openssl genrsa -des3 -out server.key 2048

Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:

 

 

1-2. csr 파일 생성

openssl req -new -key server.key -out server.csr

 

 

1-2-1. 굵은 글씨는 엔터를 입력해 생략 가능

root@shin-virtual-machine:/etc/apache2/ssl# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:비밀번호
You are about to be asked to enter information that will be incorporated
into 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 blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:Seoul
Locality Name (eg, city) []:Yeouido
Organization Name (eg, company) [Internet Widgits Pty Ltd]:회사이름
Organizational Unit Name (eg, section) []:부서이름
Common Name (e.g. server FQDN or YOUR name) []:이름
Email Address []:이메일주소

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:엔터
An optional company name []:엔터

 

 

1-3. crt 파일 생성
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt

아래 부분에 비밀번호 입력

 

 

1-4. 생성된 것을 확인

 


▶ SSL 인증서 적용

1. apache ssl 설정 파일 수정

1-1. 해당 부분을 아래와 같이 수정

위에서 생성한 server.crt 인증서 파일 경로 및 server.key 파일 경로 입력

vi /etc/apache2/sites-available/default-ssl.conf

SSLCertificateFile      /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key

 

 

 

1-2. 접속 허용을 위해 해당 부분을 아래와 같이 변경

<VirtualHost *:443>

 

 

1.3 ssl 모듈 및 ssl 설정 파일 enabled

a2enmod ssl

 

a2ensite default-ssl.conf

 

 

1-4. apache 재시작 및 패스워드 입력

 


▶ 적용 확인

1. https://IP 입력 시 아래와 같은 화면 출력

 


▶ 참고 링크

https://engineerpenguin.tistory.com/54

 

[리눅스(Linux)][우분투(Ubuntu)20.04] gcc 설치하기

configure, make, make install을 사용하여, 프로그램을 설치하려는 경우, GCC 설치가 필요하다. #GCC 설치되어있지 않은 경우, 다음과 같은 error 발생. # 해결방법 : 아래 명령어를 하나씩 복사하여 terminal

engineerpenguin.tistory.com

https://scbyun.com/1230

 

우분투(Ubuntu 22.04 LTS)에 OpenSSL(openssl-1.1.1)설치하기

우분투에 OpenSSL을 설치하는 방법(openssl-1.1.1) 테스트 환경 $ lsb_release -a No LSB modules are available. Distributor ID:Ubuntu Description:Ubuntu 22.04 LTS Release:22.04 Codename:jammy $ openssl version OpenSSL 3.0.2 15 Mar 2022 (Library:

scbyun.com

https://we-co.tistory.com/176

 

[OpenSSL] SSL 인증서를 설치하고 적용해보자! with ubuntu, Nginx

안녕하세요. 위기의 코딩맨입니다. 오늘은 HTTPS를 설정하기위해 SSL 인증서를 설치하는 방법을 간단하게 포스팅해보겠습니다. 업체를 통해서 SSL를 설치하면 비용도 발생하기도 하지만, 급할땐

we-co.tistory.com

https://askubuntu.com/questions/1160050/cant-install-openssl-on-ubuntu-18-04

 

Can't install Openssl on Ubuntu 18.04

I can't install openssl in Ubuntu 18.04. I followed the steps below: sudo apt install libssl-dev sudo apt install libssl1.0-dev wget https://www.openssl.org/source/openssl-1.1.1b.tar.gz sudo mkdir...

askubuntu.com

https://soir1984.tistory.com/64

 

Apache SSL 인증서 생성 방법

AWS REST API 서버를 만들기 위해 우선 Apache 서버에 사용될 SSL 인증서를 만들어봅시다. 인증기관(CA) 에서 인증서를 발생하려면 금전과 사용 도메인이 필요하므로 개인용 인증서를 생성하도록 합시

soir1984.tistory.com

https://soir1984.tistory.com/65

 

Apache SSL 적용 방법 #Feat. ubuntu 22.04

Apache 에 SSL 을 적용하는 방식에 대해 포스팅 합니다. SSL 적용 시 필요한 인증서를 생성하지 않았다면 아래 이전 포스팅을 참고하세요. 2022.12.15 - [IT/Middleware] - Apache SSL 인증서 생성 방법 Apache SSL

soir1984.tistory.com