Ubuntu 24.04에 PQC 지원 NGINX 설치 가이드
주의사항
인공지능 클로드에 의해 작성된 문서입니다.
개요
NGINX는 TLS 지원을 위해 OpenSSL 라이브러리에 의존하며, OpenSSL 3.5 버전부터 NIST 승인 PQC 알고리즘이 기본적으로 활성화됩니다.
문제점: Ubuntu 24.04 LTS의 제한사항
Ubuntu 24.04 LTS는 OpenSSL 3.0.x 버전을 기본으로 제공하므로, 기본 패키지로 설치된 NGINX는 PQC를 지원하지 않습니다.
| 배포판 | OpenSSL 버전 | PQC 지원 |
|---|---|---|
| Ubuntu 24.04 LTS | 3.0.x | ❌ |
| Debian 13 "Trixie" | 3.5.x | ✅ |
| Alpine Linux 3.22 | 3.5.x | ✅ |
nginx -V
nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 3.0.16 11 Feb 2025 (running with OpenSSL 3.0.17 1 Jul 2025)
......
해결 방법: 소스에서 컴파일
Ubuntu 24.04에서 PQC를 지원하는 NGINX를 사용하려면 OpenSSL 3.5 이상 버전과 함께 NGINX를 직접 컴파일해야 합니다.
기존에 설치되어 있는 nginx 에서 실행파일만 교체하는 방식으로 진행합니다.
설치 단계
1. 필수 패키지 설치
sudo apt update
sudo apt install -y build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev \
libssl-dev libgd-dev libgeoip-dev libxml2-dev libxslt1-dev wget
2. OpenSSL 3.5+ 다운로드 및 컴파일
# 작업 디렉토리 생성
mkdir -p ~/nginx-build
cd ~/nginx-build
# OpenSSL 3.5 최신 버전 다운로드
wget https://www.openssl.org/source/openssl-3.5.1.tar.gz
tar -xzf openssl-3.5.1.tar.gz
cd openssl-3.5.1
# OpenSSL 컴파일 및 설치
./config --prefix=/usr/local/openssl-3.5.1 --openssldir=/usr/local/openssl-3.5.1 shared zlib
make -j$(nproc)
sudo make install
cd ..
3. NGINX 다운로드 및 컴파일
구버전을 다운로드 하면 error: ‘ENGINE_free’ is deprecated: Since OpenSSL 3.0 와 같은 오류가 발생합니다.
# NGINX 최신 버전 다운로드
wget http://nginx.org/download/nginx-1.27.3.tar.gz
tar -xzf nginx-1.27.3.tar.gz
cd nginx-1.27.3
make clean
# NGINX 컴파일 설정
# nginx -V 로 확인된 컴파일 옵션에 아래 내용을 추가해줍니다.
# --with-openssl=/home/$(whoami)/nginx-build/openssl-3.5.1 \
# --with-openssl-opt='enable-tls1_3'
#
./configure \
--with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-V1WJUN/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--modules-path=/usr/lib/nginx/modules \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-debug \
--with-compat \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_xslt_module=dynamic \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-openssl=/home/$(whoami)/nginx-build/openssl-3.5.1 \
--with-openssl-opt='enable-tls1_3'
# 컴파일 및 설치
make -j$(nproc)
# 컴파일된 모듈 확인
ls -la ~/nginx-build/nginx-1.27.3/objs/*.so
# 기존 모듈 백업
sudo mkdir -p /usr/share/nginx/modules.backup
sudo cp /usr/share/nginx/modules/*.so /usr/share/nginx/modules.backup/
# 새로운 모듈 복사
sudo cp ~/nginx-build/nginx-1.27.3/objs/*.so /usr/share/nginx/modules/
# 새로운 nginx 바이너리로 설정 테스트
sudo ./objs/nginx -t -c /etc/nginx/nginx.conf
4. nginx 파일 교체
# nginx 중지
sudo systemctl stop nginx
# 기존 실행파일 백업
sudo cp /usr/sbin/nginx /usr/sbin/nginx.backup
# 새 실행파일 복사
sudo cp objs/nginx /usr/sbin/nginx
# 라이브러리 경로 설정
echo "/usr/local/openssl-3.5.1/lib64" | sudo tee /etc/ld.so.conf.d/openssl-3.5.1.conf
sudo ldconfig
# 설정 파일 문법 검사
sudo nginx -t
# 버전 및 OpenSSL 확인
nginx -V | grep -i openssl
# nginx 시작
sudo systemctl start nginx
sudo systemctl status nginx
PQC 지원 확인
NGINX 버전 및 OpenSSL 버전 확인
nginx -V
출력 예시:
nginx version: nginx/1.18.0
built with OpenSSL 3.5.1 1 Jul 2025
TLS SNI support enabled
...
built with OpenSSL 3.5.1 또는 그 이상의 버전이 표시되어야 합니다.
PQC 암호화 스위트 테스트
PQC가 제대로 작동하는지 확인하려면 클라이언트와 서버 모두 OpenSSL 3.5 이상이 필요합니다.
먼저 NGINX 설정에서 TLS 1.3을 활성화해야 합니다:
server {
listen 443 ssl http2;
server_name example.com;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
# ssl_protocols TLSv1.3;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 구형 브라우저를 위해 TLSv1.2도 포함
ssl_prefer_server_ciphers on;
# ssl_ecdh_curve X25519:prime256v1; # TLSv1.2용
# 기타 설정...
}
OpenSSL CLI로 PQC 하이브리드 암호화 테스트:
# openssl s_client -groups "X25519MLKEM768" -tls1_3 -connect localhost:443 2>/dev/null | grep "Negotiated TLS"
/usr/local/openssl-3.5.1/bin/openssl s_client -groups "X25519MLKEM768" -tls1_3 -connect localhost:443 2>/dev/null | grep "Negotiated TLS"
성공 시 출력:
Negotiated TLS1.3 group: X25519MLKEM768
PQC 암호화 알고리즘
OpenSSL 3.5에서 지원하는 NIST 승인 PQC 알고리즘:
-
ML-KEM (Module-Lattice-Based Key-Encapsulation Mechanism): Kyber 알고리즘의 표준화 버전
- X25519MLKEM768: 하이브리드 방식 (기존 타원곡선 + PQC)
- MLKEM768: 순수 PQC 방식
-
ML-DSA (Module-Lattice-Based Digital Signature Algorithm): Dilithium 알고리즘의 표준화 버전
-
SLH-DSA (Stateless Hash-Based Digital Signature Algorithm): SPHINCS+ 알고리즘의 표준화 버전
참고 자료
보안 고려사항
- PQC는 미래의 양자 컴퓨터 위협에 대비한 것입니다
- 현재는 하이브리드 방식 (X25519MLKEM768)을 사용하는 것이 권장됩니다
- 정기적으로 OpenSSL과 NGINX를 최신 버전으로 업데이트하세요
- 프로덕션 환경에 적용하기 전에 충분한 테스트를 수행하세요