%define _hardened_build 1 # Build conditionals # tests_long - Enabled by default, enables long running tests in %%check %bcond_without tests_long Name: openvpn Version: 2.5.9 Release: 1%{?dist} Summary: A full-featured TLS VPN solution URL: https://community.openvpn.net/ Source0: https://build.openvpn.net/downloads/releases/%{name}-%{version}.tar.gz Source1: https://build.openvpn.net/downloads/releases/%{name}-%{version}.tar.gz.asc Source2: roadwarrior-server.conf Source3: roadwarrior-client.conf # Upstream signing key Source10: gpgkey-F554A3687412CFFEBDEFE0A312F5F7B42F2B01E7.gpg Patch1: 0001-Change-the-default-cipher-to-AES-256-GCM-for-server-.patch Patch50: openvpn-2.4-change-tmpfiles-permissions.patch License: GPLv2 BuildRequires: gnupg2 BuildRequires: gcc BuildRequires: automake BuildRequires: autoconf BuildRequires: autoconf-archive BuildRequires: libtool BuildRequires: gettext BuildRequires: lzo-devel BuildRequires: lz4-devel BuildRequires: make BuildRequires: openssl-devel BuildRequires: pkcs11-helper-devel >= 1.11 BuildRequires: pam-devel BuildRequires: libselinux-devel BuildRequires: libcmocka-devel BuildRequires: systemd BuildRequires: systemd-devel %{?systemd_requires} Requires(pre): /usr/sbin/useradd %if 0%{?rhel} > 7 || 0%{?fedora} > 29 BuildRequires: python3-docutils %else # We cannot use python36-docutils on RHEL-7 as # the ./configure script does not currently find # the rst2man-3 executable, it only looks for rst2man BuildRequires: python-docutils %endif # For the perl_default_filter macro BuildRequires: perl-macros # Filter out the perl(Authen::PAM) dependency. # No perl dependency is really needed at all. %{?perl_default_filter} %description OpenVPN is a robust and highly flexible tunneling application that uses all of the encryption, authentication, and certification features of the OpenSSL library to securely tunnel IP networks over a single UDP or TCP port. It can use the Marcus Franz Xaver Johannes Oberhumers LZO library for compression. %package devel Summary: Development headers and examples for OpenVPN plug-ins %description devel OpenVPN can be extended through the --plugin option, which provides possibilities to add specialized authentication, user accounting, packet filtering and related features. These plug-ins need to be written in C and provides a more low-level and information rich access to similar features as the various script-hooks. %prep gpgv2 --quiet --keyring %{SOURCE10} %{SOURCE1} %{SOURCE0} %setup -q -n %{name}-%{version} %patch1 -p1 -b .ch_default_cipher %patch50 -p1 # %%doc items shouldn't be executable. find contrib sample -type f -perm /100 \ -exec chmod a-x {} \; %build %configure \ --enable-silent-rules \ --with-crypto-library=openssl \ --enable-pkcs11 \ --enable-selinux \ --enable-systemd \ --enable-x509-alt-username \ --enable-async-push \ --docdir=%{_pkgdocdir} \ SYSTEMD_UNIT_DIR=%{_unitdir} \ TMPFILES_DIR=%{_tmpfilesdir} %{__make} %{?_smp_mflags} %check # Test Crypto: ./src/openvpn/openvpn --genkey --secret key ./src/openvpn/openvpn --cipher aes-128-cbc --test-crypto --secret key ./src/openvpn/openvpn --cipher aes-256-cbc --test-crypto --secret key ./src/openvpn/openvpn --cipher aes-128-gcm --test-crypto --secret key ./src/openvpn/openvpn --cipher aes-256-gcm --test-crypto --secret key %if %{with tests_long} # Randomize ports for tests to avoid conflicts on the build servers. cport=$[ 50000 + ($RANDOM % 15534) ] sport=$[ $cport + 1 ] sed -e 's/^\(rport\) .*$/\1 '$sport'/' \ -e 's/^\(lport\) .*$/\1 '$cport'/' \ < sample/sample-config-files/loopback-client \ > %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-client sed -e 's/^\(rport\) .*$/\1 '$cport'/' \ -e 's/^\(lport\) .*$/\1 '$sport'/' \ < sample/sample-config-files/loopback-server \ > %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-server pushd sample # Test SSL/TLS negotiations (runs for 2 minutes): ../src/openvpn/openvpn --config \ %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-client & ../src/openvpn/openvpn --config \ %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-server wait popd rm -f %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-client \ %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u})-loopback-server %endif %install %{__make} install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -name '*.la' | xargs rm -f mkdir -p -m 0750 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/client $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/server cp %{SOURCE2} %{SOURCE3} sample/sample-config-files/ # Create some directories the OpenVPN package should own mkdir -m 0750 -p $RPM_BUILD_ROOT%{_rundir}/%{name}-{client,server} mkdir -m 0770 -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name} # Package installs into %%{_pkgdocdir} directly # Add various additional files cp -a AUTHORS ChangeLog contrib sample distro/systemd/README.systemd $RPM_BUILD_ROOT%{_pkgdocdir} # Remove some files which does not really belong here rm -f $RPM_BUILD_ROOT%{_pkgdocdir}/sample/Makefile{,.in,.am} rm -f $RPM_BUILD_ROOT%{_pkgdocdir}/contrib/multilevel-init.patch rm -rf $RPM_BUILD_ROOT%{_pkgdocdir}/sample/sample-keys %pre getent group openvpn &>/dev/null || groupadd -r openvpn getent passwd openvpn &>/dev/null || \ /usr/sbin/useradd -r -g openvpn -s /sbin/nologin -c OpenVPN \ -d /etc/openvpn openvpn %post %systemd_post openvpn-client@\*.service %systemd_post openvpn-server@\*.service %preun %systemd_preun openvpn-client@\*.service %systemd_preun openvpn-server@\*.service %postun %systemd_postun_with_restart openvpn-client@\*.service %systemd_postun_with_restart openvpn-server@\*.service %systemd_postun_with_restart openvpn@\*.service %files %{_pkgdocdir} %exclude %{_pkgdocdir}/README.IPv6 %exclude %{_pkgdocdir}/README.mbedtls %exclude %{_pkgdocdir}/sample/sample-plugins %{_mandir}/man8/%{name}.8* %{_mandir}/man5/%{name}-*.5* %{_sbindir}/%{name} %{_libdir}/%{name}/ %{_unitdir}/%{name}-client@.service %{_unitdir}/%{name}-server@.service %{_tmpfilesdir}/%{name}.conf %config %dir %{_sysconfdir}/%{name}/ %config %dir %attr(-,-,openvpn) %{_sysconfdir}/%{name}/client %config %dir %attr(-,-,openvpn) %{_sysconfdir}/%{name}/server %attr(0750,-,openvpn) %{_rundir}/%{name}-client %attr(0750,-,openvpn) %{_rundir}/%{name}-server %attr(0770,openvpn,openvpn) %{_sharedstatedir}/%{name} %files devel %{_pkgdocdir}/sample/sample-plugins %{_includedir}/openvpn-plugin.h %{_includedir}/openvpn-msg.h %changelog * Thu Feb 16 2023 David Sommerseth - 2.5.9-1 - Update to upstream OpenVPN 2.5.9 * Tue Nov 1 2022 David Sommerseth - 2.5.8-1 - Update to upstream OpenVPN 2.5.8 * Tue May 31 2022 David Sommerseth - 2.5.7-1 - Update to upstream OpenVPN 2.5.7 * Wed Mar 16 2022 David Sommerseth - 2.5.6-1 - Update to upstream OpenVPN 2.5.6 - Fixes CVE-2022-0547 * Tue Oct 5 2021 David Sommerseth - 2.5.5-1 - Update to upstream OpenVPN 2.5.5 (#2032844) * Tue Oct 5 2021 David Sommerseth - 2.5.4-1 - Release of OpenVPN 2.5.4 for Fedora Copr users - Added packaging of new man page: openvpn-examples(5) * Fri Jun 18 2021 David Sommerseth - 2.5.3-2 - Release of OpenVPN 2.5.3 for Fedora Copr users - Fixes CVE-2021-3606 * Tue Jun 1 2021 David Sommerseth - 2.5.2-2 - Fixed stray \ at the end of %%configure; reported by Pavel Kankovsky * Wed Apr 21 2021 David Sommerseth - 2.5.2-1 - Release of OpenVPN 2.5.2 for Fedora Copr users - Fixes CVE-2020-15078 - Replaces --ncp-ciphers with --data-ciphers in the server systemd service unit * Wed Feb 24 2021 David Sommerseth - 2.5.1-1 - Release of OpenVPN 2.5.1 for Fedora Copr users * Wed Oct 28 2020 David Sommerseth - 2.5.0-1 - Release of OpenVPN 2.5.0 for Fedora Copr users * Thu Oct 15 2020 David Sommerseth - 2.5_rc3-1 - Update to upstream OpenVPN 2.5_rc3 release * Wed Sep 30 2020 David Sommerseth - 2.5_rc2-1 - Update to upstream OpenVPN 2.5_rc2 release * Mon Sep 21 2020 David Sommerseth - 2.5_rc1-1 - Update to upstream OpenVPN 2.5_rc1 release * Fri Sep 11 2020 David Sommerseth - 2.5_beta4-1 - Update to upstream OpenVPN 2.5_beta4 release * Tue Sep 1 2020 David Sommerseth - 2.5_beta3-1 - Updated to upstream OpenVPN 2.5_beta3 release * Thu Aug 27 2020 David Sommerseth - 2.5_beta2-1 - Updated to upstream OpenVPN 2.5_beta2 release * Fri Aug 14 2020 David Sommerseth - 2.5_beta1-2 - Added PGP signature validation of the source tarball * Thu Aug 13 2020 David Sommerseth - 2.5_beta1-1 - Update to upstream OpenVPN 2.5_beta1 release