이 가이드는 Rocky Linux 8.10에서 최신 OpenSSL 3.3.1과 OpenSSH 9.8p1을 소스에서 컴파일하여 RPM 패키지를 제작하고 설치하는 방법을 설명합니다. 최신 버전은 CVE-2023-5363, CVE-2023-38408 등과 같은 알려진 취약점을 해결합니다.
1. 사전 준비
1.1 시스템 업데이트
시스템을 최신 상태로 업데이트하여 최신 패치 및 의존성을 확보합니다.
sudo dnf update -y
sudo dnf install -y epel-release
sudo dnf install -y rpmdevtools gcc make perl wget zlib-devel pam-devel libselinux-devel
1.2 RPM 빌드 환경 설정
RPM 패키지를 빌드하기 위해 홈 디렉토리에 RPM 빌드 트리를 생성합니다.
rpmdev-setuptree
이 명령은 ~/rpmbuild/ 디렉토리에 SPECS 및 SOURCES 디렉토리를 생성합니다.
2. OpenSSL 3.3.1 RPM 제작 및 설치
2.1 OpenSSL 소스 다운로드
최신 OpenSSL 3.3.1 소스를 다운로드합니다.
cd ~/rpmbuild/SOURCES
wget https://github.com/openssl/openssl/releases/download/openssl-3.3.1/openssl-3.3.1.tar.gz
2.2 OpenSSL SPEC 파일 작성
~/rpmbuild/SPECS/openssl.spec 파일을 작성합니다.
cat > ~/rpmbuild/SPECS/openssl.spec << 'EOF'
Name: openssl
Version: 3.3.1
Release: 1%{?dist}
Summary: OpenSSL cryptographic library
License: Apache-2.0
URL: https://www.openssl.org/
Source0: https://github.com/openssl/openssl/releases/download/openssl-%{version}/openssl-%{version}.tar.gz
BuildRequires: gcc make perl zlib-devel
Requires: zlib
%description
OpenSSL is a toolkit for SSL/TLS and general-purpose cryptography.
%prep
%setup -q
%build
./config --prefix=/usr/local/openssl --openssldir=/etc/ssl shared zlib
make
%install
make install DESTDIR=%{buildroot}
%files
/usr/local/openssl/bin/*
/usr/local/openssl/lib/*
/usr/local/openssl/lib64/*
/etc/ssl/*
/usr/local/openssl/include/*
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%changelog
* Wed May 28 2025 Your Name - 3.3.1-1
- Initial RPM build for OpenSSL 3.3.1
EOF
2.3 OpenSSL RPM 빌드
SPEC 파일을 사용하여 RPM 패키지를 빌드합니다.
cd ~/rpmbuild/SPECS
rpmbuild -ba openssl.spec
2.4 OpenSSL RPM 설치
기존 OpenSSL을 제거하고 새 RPM을 설치합니다.
sudo dnf remove -y openssl-libs
sudo dnf install -y ~/rpmbuild/RPMS/x86_64/openssl-3.3.1-1.el8.x86_64.rpm
설치된 버전을 확인합니다:
openssl version
출력: OpenSSL 3.3.1 1 Jun 2024
3. OpenSSH 9.8p1 RPM 제작 및 설치
3.1 OpenSSH 소스 다운로드
최신 OpenSSH 9.8p1 소스를 다운로드합니다.
cd ~/rpmbuild/SOURCES
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
3.2 OpenSSH SPEC 파일 작성
~/rpmbuild/SPECS/openssh.spec 파일을 작성합니다.
cat > ~/rpmbuild/SPECS/openssh.spec << 'EOF'
Name: openssh
Version: 9.8p1
Release: 1%{?dist}
Summary: OpenSSH secure shell client and server
License: BSD
URL: https://www.openssh.com/
Source0: https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
BuildRequires: gcc make zlib-devel openssl-devel pam-devel libselinux-devel
Requires: openssl-libs zlib pam libselinux
%description
OpenSSH is a free version of the SSH connectivity tools.
%prep
%setup -q
%build
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --with-ssl-dir=/usr/local/openssl
make
%install
make install DESTDIR=%{buildroot}
%files
/usr/bin/*
/usr/sbin/*
/etc/ssh/*
/var/lib/sshd/*
/usr/libexec/openssh/*
/usr/share/man/man*/*
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%changelog
* Wed May 28 2025 Your Name - 9.8p1-1
- Initial RPM build for OpenSSH 9.8p1
EOF
3.3 OpenSSH RPM 빌드
SPEC 파일을 사용하여 RPM 패키지를 빌드합니다.
cd ~/rpmbuild/SPECS
rpmbuild -ba openssh.spec
3.4 OpenSSH RPM 설치
기존 OpenSSH를 제거하고 새 RPM을 설치합니다.
sudo dnf remove -y openssh-server openssh-clients
sudo dnf install -y ~/rpmbuild/RPMS/x86_64/openssh-9.8p1-1.el8.x86_64.rpm
sudo systemctl restart sshd
설치된 버전을 확인합니다:
ssh -V
출력: OpenSSH_9.8p1, OpenSSL 3.3.1 1 Jun 2024
4. 취약점 확인
설치 후, 취약점 스캐너를 실행하여 CVE-2023-5363(OpenSSL) 및 CVE-2023-38408(OpenSSH)와 같은 취약점이 해결되었는지 확인합니다. 또는 패키지 변경 로그를 확인하여 패치 여부를 검증할 수 있습니다:
rpm -q openssl --changelog | grep CVE
rpm -q openssh --changelog | grep CVE
'리눅스 리뷰 > Rocky Linux 8' 카테고리의 다른 글
Rocky Linux 8.x End of Support (EOS) 및 End of Life (EOL) 정보 (0) | 2025.06.18 |
---|---|
Rocky Linux 8.10에서 DNF 업데이트 명령어 이해하기: `dnf update`, `dnf update kernel`, `dnf update --security` (0) | 2025.06.12 |
폐쇄망 환경에서 USB로 Rocky Linux 8.9를 8.10으로 업그레이드하는 방법 (0) | 2025.05.27 |
Rocky Linux 8.10 계정 로그인 보안 설정 가이드 (0) | 2025.05.14 |
Rocky Linux 8.10: OpenSSL 및 OpenSSH 최신 버전 설치 가이드 (0) | 2025.04.20 |