OS:RHEL 6.5
原openssl版本:OpenSSL 1.0.1e-fips 11 Feb 2013
因为安全漏洞升级到1.0.1u版本,想尝试通过源码包编译成rpm安装包方式。
操作过程如下:
mkdir -p /root/rpmbuild/{SOURCES,SPECS}
cd rpmbuild/SOURCES/
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
tar xvzf openssl-1.0.1u.tar.gz
cp openssl-1.0.1u/openssl.spec ../SPECS
rpmbuild -ba ../SPECS/openssl.spec
运行到最后失败退出:
RPM build errors:
File not found by glob: /root/rpmbuild/BUILDROOT/openssl-1.0.1u-1.x86_64/usr/lib/.so
[root@192 SOURCES]# ll /root/rpmbuild/BUILDROOT/openssl-1.0.1u-1.x86_64/usr
total 20
drwxr-xr-x 2 root root 4096 Jul 29 21:39 bin
drwxr-xr-x 3 root root 4096 Jul 29 21:39 include
drwxr-xr-x 4 root root 4096 Jul 29 21:39 lib64
drwxr-xr-x 6 root root 4096 Jul 29 21:38 man
drwxr-xr-x 3 root root 4096 Jul 29 21:39 share
粘贴下源码包中自带的openssl.spec脚本内容:
%define _unpackaged_files_terminate_build 0
Release: 1
%define openssldir /var/ssl
Summary: Secure Sockets Layer and cryptography libraries and tools
Name: openssl
Version: 1.0.1u
Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz
License: OpenSSL
Group: System Environment/Libraries
Provides: SSL
URL: http://www.openssl.org/
Packager: Damien Miller <djm@mindrot.org>
BuildRoot: /var/tmp/%{name}-%{version}-root
%description
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, fully featured, and Open Source toolkit implementing the
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
protocols as well as a full-strength general purpose cryptography library.
The project is managed by a worldwide community of volunteers that use the
Internet to communicate, plan, and develop the OpenSSL tookit and its related
documentation.
OpenSSL is based on the excellent SSLeay library developed from Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style licence, which basically means that you are free to get and
use it for commercial and non-commercial purposes.
This package contains the base OpenSSL cryptography and SSL/TLS
libraries and tools.
%package devel
Summary: Secure Sockets Layer and cryptography static libraries and headers
Group: Development/Libraries
Requires: openssl
%description devel
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, fully featured, and Open Source toolkit implementing the
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
protocols as well as a full-strength general purpose cryptography library.
The project is managed by a worldwide community of volunteers that use the
Internet to communicate, plan, and develop the OpenSSL tookit and its related
documentation.
OpenSSL is based on the excellent SSLeay library developed from Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style licence, which basically means that you are free to get and
use it for commercial and non-commercial purposes.
This package contains the the OpenSSL cryptography and SSL/TLS
static libraries and header files required when developing applications.
%package doc
Summary: OpenSSL miscellaneous files
Group: Documentation
Requires: openssl
%description doc
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, fully featured, and Open Source toolkit implementing the
Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
protocols as well as a full-strength general purpose cryptography library.
The project is managed by a worldwide community of volunteers that use the
Internet to communicate, plan, and develop the OpenSSL tookit and its related
documentation.
OpenSSL is based on the excellent SSLeay library developed from Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style licence, which basically means that you are free to get and
use it for commercial and non-commercial purposes.
This package contains the the OpenSSL cryptography and SSL/TLS extra
documentation and POD files from which the man pages were produced.
%prep
%setup -q
%build
%define CONFIG_FLAGS -DSSL_ALLOW_ADH --prefix=/usr --openssldir=%{openssldir}
perl util/perlpath.pl /usr/bin/perl
%ifarch i386 i486 i586 i686
./Configure %{CONFIG_FLAGS} linux-elf shared
%endif
%ifarch ppc
./Configure %{CONFIG_FLAGS} linux-ppc shared
%endif
%ifarch alpha
./Configure %{CONFIG_FLAGS} linux-alpha shared
%endif
%ifarch x86_64
./Configure %{CONFIG_FLAGS} linux-x86_64 shared
%endif
LD_LIBRARY_PATH=pwd
make
LD_LIBRARY_PATH=pwd
make rehash
LD_LIBRARY_PATH=pwd
make test
%install
rm -rf $RPM_BUILD_ROOT
make MANDIR=/usr/man MANSUFFIX=ssl INSTALL_PREFIX="$RPM_BUILD_ROOT" install
ln -sf /usr/bin/openssl $RPM_BUILD_ROOT/usr/bin/ssleay
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(0644,root,root,0755)
%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
%attr(0755,root,root) /usr/bin/*
%attr(0755,root,root) /usr/lib/.so
%attr(0755,root,root) %{openssldir}/misc/*
%attr(0644,root,root) /usr/man/man[157]/*
%config %attr(0644,root,root) %{openssldir}/openssl.cnf
%dir %attr(0755,root,root) %{openssldir}/certs
%dir %attr(0755,root,root) %{openssldir}/misc
%dir %attr(0750,root,root) %{openssldir}/private
%files devel
%defattr(0644,root,root,0755)
%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
%attr(0644,root,root) /usr/lib/*.a
%attr(0644,root,root) /usr/lib/pkgconfig/openssl.pc
%attr(0644,root,root) /usr/include/openssl/*
%attr(0644,root,root) /usr/man/man[3]/*
%files doc
%defattr(0644,root,root,0755)
%doc CHANGES CHANGES.SSLeay LICENSE NEWS README
%doc doc
%post
ldconfig
%postun
ldconfig
%changelog
把 spec 文件里这行
%attr(0755,root,root) /usr/lib/ .so
删除试试 ?