2020-07-18 14:54:43 +00:00
|
|
|
%global _hardened_build 1
|
2018-06-27 18:09:50 +00:00
|
|
|
# These are rpm macros and are 0 or 1
|
|
|
|
%global with_efence 0
|
|
|
|
%global with_development 0
|
|
|
|
%global with_cavstests 1
|
2021-02-03 01:53:35 +00:00
|
|
|
%global nss_version 3.52
|
2020-09-28 02:54:09 +00:00
|
|
|
%global unbound_version 1.6.6
|
2021-02-03 01:53:35 +00:00
|
|
|
# Libreswan config options
|
2018-06-27 18:09:50 +00:00
|
|
|
%global libreswan_config \\\
|
|
|
|
FINALLIBEXECDIR=%{_libexecdir}/ipsec \\\
|
|
|
|
FINALMANDIR=%{_mandir} \\\
|
2020-09-28 02:54:09 +00:00
|
|
|
PREFIX=%{_prefix} \\\
|
2018-06-27 18:09:50 +00:00
|
|
|
INITSYSTEM=systemd \\\
|
2021-02-03 01:53:35 +00:00
|
|
|
SHELL_BINARY=%{_bindir}/sh \\\
|
2022-01-13 21:53:11 +00:00
|
|
|
USE_DNSSEC=true \\\
|
2018-06-27 18:09:50 +00:00
|
|
|
USE_LABELED_IPSEC=true \\\
|
|
|
|
USE_LDAP=true \\\
|
|
|
|
USE_LIBCAP_NG=true \\\
|
|
|
|
USE_LIBCURL=true \\\
|
|
|
|
USE_LINUX_AUDIT=true \\\
|
|
|
|
USE_NM=true \\\
|
2021-02-03 01:53:35 +00:00
|
|
|
USE_NSS_IPSEC_PROFILE=true \\\
|
2018-06-27 18:09:50 +00:00
|
|
|
USE_SECCOMP=true \\\
|
2021-02-03 01:53:35 +00:00
|
|
|
USE_AUTHPAM=true \\\
|
2018-06-27 18:09:50 +00:00
|
|
|
%{nil}
|
2013-04-13 20:58:36 +00:00
|
|
|
|
2021-02-03 01:53:35 +00:00
|
|
|
#global prever dr1
|
2013-04-13 20:58:36 +00:00
|
|
|
|
|
|
|
Name: libreswan
|
2021-02-03 01:53:35 +00:00
|
|
|
Summary: Internet Key Exchange (IKEv1 and IKEv2) implementation for IPsec
|
2017-08-10 02:53:01 +00:00
|
|
|
# version is generated in the release script
|
2024-06-22 01:49:10 +00:00
|
|
|
Version: 4.15
|
2024-03-11 20:32:41 +00:00
|
|
|
Release: %autorelease
|
2023-08-24 01:29:22 +00:00
|
|
|
# The code in lib/libswan/nss_copies.c is under MPL-2.0, while the
|
|
|
|
# rest is under GPL-2.0-or-later
|
|
|
|
License: GPL-2.0-or-later AND MPL-2.0
|
2015-12-18 20:41:52 +00:00
|
|
|
Url: https://libreswan.org/
|
2021-02-03 01:53:35 +00:00
|
|
|
Source0: https://download.libreswan.org/%{?prever:development/}%{name}-%{version}%{?prever}.tar.gz
|
2022-01-12 03:41:45 +00:00
|
|
|
Source1: https://download.libreswan.org/%{?prever:development/}%{name}-%{version}%{?prever}.tar.gz.asc
|
2023-01-10 18:55:54 +00:00
|
|
|
Source2: https://download.libreswan.org/LIBRESWAN-OpenPGP-KEY.txt
|
2018-06-27 18:09:50 +00:00
|
|
|
%if 0%{with_cavstests}
|
2022-01-12 03:41:45 +00:00
|
|
|
Source3: https://download.libreswan.org/cavs/ikev1_dsa.fax.bz2
|
|
|
|
Source4: https://download.libreswan.org/cavs/ikev1_psk.fax.bz2
|
|
|
|
Source5: https://download.libreswan.org/cavs/ikev2.fax.bz2
|
2015-08-25 03:23:01 +00:00
|
|
|
%endif
|
2021-02-03 01:53:35 +00:00
|
|
|
|
2024-06-22 01:49:10 +00:00
|
|
|
Patch1: libreswan-4.15-ipsec_import.patch
|
2024-08-06 00:46:06 +00:00
|
|
|
Patch2: libreswan-4.6-ikev1-policy-defaults-to-drop.patch
|
2024-08-06 02:01:02 +00:00
|
|
|
Patch3: libreswan-4.15-ondemand-tcp.patch
|
2024-08-06 02:34:28 +00:00
|
|
|
Patch4: libreswan-4.15-netlink-extack.patch
|
2024-06-22 01:49:10 +00:00
|
|
|
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: audit-libs-devel
|
|
|
|
BuildRequires: bison
|
|
|
|
BuildRequires: curl-devel
|
|
|
|
BuildRequires: flex
|
2022-01-12 03:41:45 +00:00
|
|
|
BuildRequires: gcc
|
|
|
|
BuildRequires: gnupg2
|
2021-02-03 01:53:35 +00:00
|
|
|
BuildRequires: hostname
|
2018-06-27 18:09:50 +00:00
|
|
|
BuildRequires: ldns-devel
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: libcap-ng-devel
|
|
|
|
BuildRequires: libevent-devel
|
2017-01-15 21:09:10 +00:00
|
|
|
BuildRequires: libseccomp-devel
|
|
|
|
BuildRequires: libselinux-devel
|
2022-01-12 03:41:45 +00:00
|
|
|
BuildRequires: make
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: nspr-devel
|
|
|
|
BuildRequires: nss-devel >= %{nss_version}
|
2021-02-03 01:53:35 +00:00
|
|
|
BuildRequires: nss-tools >= %{nss_version}
|
2018-06-27 18:09:50 +00:00
|
|
|
BuildRequires: openldap-devel
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: pam-devel
|
|
|
|
BuildRequires: pkgconfig
|
2022-10-14 00:23:35 +00:00
|
|
|
BuildRequires: systemd
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: systemd-devel
|
2022-10-14 00:23:35 +00:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2020-09-28 02:54:09 +00:00
|
|
|
BuildRequires: unbound-devel >= %{unbound_version}
|
|
|
|
BuildRequires: xmlto
|
2018-06-27 18:09:50 +00:00
|
|
|
%if 0%{with_efence}
|
2013-04-13 20:58:36 +00:00
|
|
|
BuildRequires: ElectricFence
|
|
|
|
%endif
|
2013-10-31 03:17:42 +00:00
|
|
|
Requires: iproute >= 2.6.8
|
2020-09-28 02:54:09 +00:00
|
|
|
Requires: nss >= %{nss_version}
|
|
|
|
Requires: nss-softokn
|
|
|
|
Requires: nss-tools
|
|
|
|
Requires: unbound-libs >= %{unbound_version}
|
2021-08-03 00:58:31 +00:00
|
|
|
Requires: logrotate
|
2021-08-03 00:44:07 +00:00
|
|
|
# for pidof
|
|
|
|
Requires: procps-ng
|
|
|
|
|
2022-10-14 00:23:35 +00:00
|
|
|
|
2020-09-28 02:54:09 +00:00
|
|
|
Requires(post): bash
|
|
|
|
Requires(post): coreutils
|
|
|
|
Requires(post): systemd
|
|
|
|
Requires(preun): systemd
|
|
|
|
Requires(postun): systemd
|
2013-04-13 20:58:36 +00:00
|
|
|
|
|
|
|
%description
|
2021-02-03 01:53:35 +00:00
|
|
|
Libreswan is a free implementation of IPsec & IKE for Linux. IPsec is
|
2013-04-13 20:58:36 +00:00
|
|
|
the Internet Protocol Security and uses strong cryptography to provide
|
|
|
|
both authentication and encryption services. These services allow you
|
|
|
|
to build secure tunnels through untrusted networks. Everything passing
|
2013-05-13 18:34:29 +00:00
|
|
|
through the untrusted net is encrypted by the ipsec gateway machine and
|
2013-04-13 20:58:36 +00:00
|
|
|
decrypted by the gateway at the other end of the tunnel. The resulting
|
|
|
|
tunnel is a virtual private network or VPN.
|
|
|
|
|
|
|
|
This package contains the daemons and userland tools for setting up
|
2020-02-14 17:46:49 +00:00
|
|
|
Libreswan.
|
2013-04-13 20:58:36 +00:00
|
|
|
|
2020-02-14 17:46:49 +00:00
|
|
|
Libreswan also supports IKEv2 (RFC7296) and Secure Labeling
|
2013-04-13 20:58:36 +00:00
|
|
|
|
|
|
|
Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04
|
|
|
|
|
|
|
|
%prep
|
2022-01-12 03:41:45 +00:00
|
|
|
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
|
2013-04-13 20:58:36 +00:00
|
|
|
%setup -q -n libreswan-%{version}%{?prever}
|
2018-06-27 18:09:50 +00:00
|
|
|
# enable crypto-policies support
|
2020-10-19 01:52:15 +00:00
|
|
|
sed -i "s:#[ ]*include \(.*\)\(/crypto-policies/back-ends/libreswan.config\)$:include \1\2:" configs/ipsec.conf.in
|
2024-03-12 00:59:11 +00:00
|
|
|
%ifarch s390x
|
|
|
|
# throws error on s390x
|
|
|
|
sed -i "s/SUBDIRS += hunkcheck/#SUBDIRS += hunkcheck/" testing/programs/Makefile
|
|
|
|
%endif
|
2022-01-12 03:41:45 +00:00
|
|
|
%autopatch -p1
|
2020-09-28 02:54:09 +00:00
|
|
|
|
2013-04-13 20:58:36 +00:00
|
|
|
%build
|
2022-08-26 00:45:28 +00:00
|
|
|
%make_build \
|
2018-06-27 18:09:50 +00:00
|
|
|
%if 0%{with_development}
|
2020-02-14 17:46:49 +00:00
|
|
|
OPTIMIZE_CFLAGS="%{?_hardened_cflags}" \
|
2017-08-10 02:53:01 +00:00
|
|
|
%else
|
2020-02-14 17:46:49 +00:00
|
|
|
OPTIMIZE_CFLAGS="%{optflags}" \
|
|
|
|
%endif
|
2021-02-03 01:53:35 +00:00
|
|
|
WERROR_CFLAGS="-Werror -Wno-missing-field-initializers -Wno-lto-type-mismatch -Wno-maybe-uninitialized" \
|
2020-02-14 17:46:49 +00:00
|
|
|
%if 0%{with_efence}
|
|
|
|
USE_EFENCE=true \
|
2013-04-13 20:58:36 +00:00
|
|
|
%endif
|
2021-02-03 01:53:35 +00:00
|
|
|
USERLINK="%{?__global_ldflags} -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -flto --no-lto" \
|
2018-06-27 18:09:50 +00:00
|
|
|
%{libreswan_config} \
|
|
|
|
programs
|
2013-04-13 20:58:36 +00:00
|
|
|
FS=$(pwd)
|
|
|
|
|
2021-02-03 01:53:35 +00:00
|
|
|
|
2013-04-13 20:58:36 +00:00
|
|
|
%install
|
2022-08-26 00:45:28 +00:00
|
|
|
%make_install \
|
2021-02-03 01:53:35 +00:00
|
|
|
%{libreswan_config} \
|
2013-04-13 20:58:36 +00:00
|
|
|
FS=$(pwd)
|
|
|
|
rm -rf %{buildroot}/usr/share/doc/libreswan
|
2020-09-28 02:54:09 +00:00
|
|
|
rm -rf %{buildroot}%{_libexecdir}/ipsec/*check
|
2023-09-05 21:18:14 +00:00
|
|
|
# avoids python depency and are old / aging tools that are not very useful
|
|
|
|
rm -rf %{buildroot}%{_libexecdir}/ipsec/show
|
|
|
|
rm -rf %{buildroot}%{_libexecdir}/ipsec/verify
|
2013-04-13 20:58:36 +00:00
|
|
|
|
2020-02-14 17:46:49 +00:00
|
|
|
install -d -m 0755 %{buildroot}%{_rundir}/pluto
|
2013-04-13 20:58:36 +00:00
|
|
|
install -d %{buildroot}%{_sbindir}
|
|
|
|
|
2021-06-07 01:22:20 +00:00
|
|
|
install -d %{buildroot}%{_sysctldir}
|
2015-08-25 03:23:01 +00:00
|
|
|
install -m 0644 packaging/fedora/libreswan-sysctl.conf \
|
2021-06-07 01:22:20 +00:00
|
|
|
%{buildroot}%{_sysctldir}/50-libreswan.conf
|
2015-08-25 03:23:01 +00:00
|
|
|
|
2017-08-10 02:53:01 +00:00
|
|
|
echo "include %{_sysconfdir}/ipsec.d/*.secrets" \
|
2021-02-03 01:53:35 +00:00
|
|
|
> %{buildroot}%{_sysconfdir}/ipsec.secrets
|
2013-12-11 01:30:56 +00:00
|
|
|
rm -fr %{buildroot}%{_sysconfdir}/rc.d/rc*
|
2013-04-13 20:58:36 +00:00
|
|
|
|
2018-06-27 18:09:50 +00:00
|
|
|
%if 0%{with_cavstests}
|
2015-08-25 03:23:01 +00:00
|
|
|
%check
|
|
|
|
# There is an elaborate upstream testing infrastructure which we do not
|
|
|
|
# run here - it takes hours and uses kvm
|
2022-01-12 03:41:45 +00:00
|
|
|
# We only run the CAVS tests and startup selftest
|
|
|
|
cp %{SOURCE3} %{SOURCE4} %{SOURCE5} .
|
2015-08-25 03:23:01 +00:00
|
|
|
bunzip2 *.fax.bz2
|
2017-01-15 21:09:10 +00:00
|
|
|
|
2015-08-25 03:23:01 +00:00
|
|
|
: starting CAVS test for IKEv2
|
2018-06-27 18:09:50 +00:00
|
|
|
%{buildroot}%{_libexecdir}/ipsec/cavp -v2 ikev2.fax | \
|
2015-08-25 03:23:01 +00:00
|
|
|
diff -u ikev2.fax - > /dev/null
|
|
|
|
: starting CAVS test for IKEv1 RSASIG
|
2018-06-27 18:09:50 +00:00
|
|
|
%{buildroot}%{_libexecdir}/ipsec/cavp -v1dsa ikev1_dsa.fax | \
|
2015-08-25 03:23:01 +00:00
|
|
|
diff -u ikev1_dsa.fax - > /dev/null
|
|
|
|
: starting CAVS test for IKEv1 PSK
|
2018-06-27 18:09:50 +00:00
|
|
|
%{buildroot}%{_libexecdir}/ipsec/cavp -v1psk ikev1_psk.fax | \
|
2015-08-25 03:23:01 +00:00
|
|
|
diff -u ikev1_psk.fax - > /dev/null
|
|
|
|
: CAVS tests passed
|
2021-02-03 01:53:35 +00:00
|
|
|
%endif
|
2020-09-28 02:54:09 +00:00
|
|
|
|
2021-02-03 01:53:35 +00:00
|
|
|
# Some of these tests will show ERROR for negative testing - it will exit on real errors
|
2020-09-28 02:54:09 +00:00
|
|
|
%{buildroot}%{_libexecdir}/ipsec/algparse -tp || { echo prooposal test failed; exit 1; }
|
|
|
|
%{buildroot}%{_libexecdir}/ipsec/algparse -ta || { echo algorithm test failed; exit 1; }
|
2021-02-03 01:53:35 +00:00
|
|
|
: Algorithm parser tests passed
|
2020-09-28 02:54:09 +00:00
|
|
|
|
|
|
|
# self test for pluto daemon - this also shows which algorithms it allows in FIPS mode
|
|
|
|
tmpdir=$(mktemp -d /tmp/libreswan-XXXXX)
|
|
|
|
certutil -N -d sql:$tmpdir --empty-password
|
|
|
|
%{buildroot}%{_libexecdir}/ipsec/pluto --selftest --nssdir $tmpdir --rundir $tmpdir
|
|
|
|
: pluto self-test passed - verify FIPS algorithms allowed is still compliant with NIST
|
|
|
|
|
2015-08-25 03:23:01 +00:00
|
|
|
%post
|
|
|
|
%systemd_post ipsec.service
|
2021-06-07 01:22:20 +00:00
|
|
|
%sysctl_apply 50-libreswan.conf
|
2015-08-25 03:23:01 +00:00
|
|
|
|
|
|
|
%preun
|
|
|
|
%systemd_preun ipsec.service
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%systemd_postun_with_restart ipsec.service
|
|
|
|
|
2013-05-13 18:34:29 +00:00
|
|
|
%files
|
2015-08-25 03:23:01 +00:00
|
|
|
%doc CHANGES COPYING CREDITS README* LICENSE
|
|
|
|
%doc docs/*.* docs/examples
|
2013-04-13 20:58:36 +00:00
|
|
|
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.conf
|
|
|
|
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ipsec.secrets
|
|
|
|
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d
|
|
|
|
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/policies
|
|
|
|
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.d/policies/*
|
2021-06-07 01:22:20 +00:00
|
|
|
%attr(0644,root,root) %config(noreplace) %{_sysctldir}/50-libreswan.conf
|
2018-07-09 02:37:04 +00:00
|
|
|
%attr(0755,root,root) %dir %{_rundir}/pluto
|
2021-02-03 01:53:35 +00:00
|
|
|
%attr(0700,root,root) %dir %{_sharedstatedir}/ipsec
|
|
|
|
%attr(0700,root,root) %dir %{_sharedstatedir}/ipsec/nss
|
2015-08-25 03:23:01 +00:00
|
|
|
%attr(0644,root,root) %{_tmpfilesdir}/libreswan.conf
|
2013-04-13 20:58:36 +00:00
|
|
|
%attr(0644,root,root) %{_unitdir}/ipsec.service
|
|
|
|
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/pluto
|
2021-02-03 01:53:35 +00:00
|
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/libreswan
|
2013-04-13 20:58:36 +00:00
|
|
|
%{_sbindir}/ipsec
|
|
|
|
%{_libexecdir}/ipsec
|
2021-02-03 01:53:35 +00:00
|
|
|
%doc %{_mandir}/*/*
|
2013-04-13 20:58:36 +00:00
|
|
|
|
|
|
|
%changelog
|
2024-03-11 20:32:41 +00:00
|
|
|
%autochangelog
|