19d822c
%global _hardened_build 1
6ce6d0a
# These are rpm macros and are 0 or 1
6ce6d0a
%global with_efence 0
6ce6d0a
%global with_development 0
6ce6d0a
%global with_cavstests 1
6ce6d0a
# Libreswan config options
6ce6d0a
%global libreswan_config \\\
6ce6d0a
    FINALLIBEXECDIR=%{_libexecdir}/ipsec \\\
6ce6d0a
    FINALMANDIR=%{_mandir} \\\
6ce6d0a
    FIPSPRODUCTCHECK=%{_sysconfdir}/system-fips \\\
6ce6d0a
    INC_RCDEFAULT=%{_initrddir} \\\
6ce6d0a
    INC_USRLOCAL=%{_prefix} \\\
6ce6d0a
    INITSYSTEM=systemd \\\
6ce6d0a
    NSS_REQ_AVA_COPY=false \\\
6ce6d0a
    USE_DNSSEC=true \\\
6ce6d0a
    USE_FIPSCHECK=true \\\
6ce6d0a
    USE_LABELED_IPSEC=true \\\
6ce6d0a
    USE_LDAP=true \\\
6ce6d0a
    USE_LIBCAP_NG=true \\\
6ce6d0a
    USE_LIBCURL=true \\\
6ce6d0a
    USE_LINUX_AUDIT=true \\\
6ce6d0a
    USE_NM=true \\\
6ce6d0a
    USE_SECCOMP=true \\\
6ce6d0a
    USE_XAUTHPAM=true \\\
6ce6d0a
%{nil}
5f79f63
19d822c
#global prever rc1
5f79f63
5f79f63
Name: libreswan
5f79f63
Summary: IPsec implementation with IKEv1 and IKEv2 keying protocols
19d822c
# version is generated in the release script
6ce6d0a
Version: 3.25
6ce6d0a
Release: %{?prever:0.}1%{?prever:.%{prever}}%{?dist}
5f79f63
License: GPLv2
e64cbf0
Url: https://libreswan.org/
e64cbf0
Source0: https://download.libreswan.org/%{?prever:development/}%{name}-%{version}%{?prever}.tar.gz
6ce6d0a
%if 0%{with_cavstests}
43d43de
Source1: https://download.libreswan.org/cavs/ikev1_dsa.fax.bz2
43d43de
Source2: https://download.libreswan.org/cavs/ikev1_psk.fax.bz2
43d43de
Source3: https://download.libreswan.org/cavs/ikev2.fax.bz2
43d43de
%endif
6ce6d0a
Requires(post): bash coreutils systemd
5f79f63
Requires(preun): systemd
5f79f63
Requires(postun): systemd
5f79f63
5f79f63
Conflicts: openswan < %{version}-%{release}
5f79f63
Obsoletes: openswan < %{version}-%{release}
5f79f63
Provides: openswan = %{version}-%{release}
decff41
Provides: openswan-doc = %{version}-%{release}
5f79f63
5f79f63
BuildRequires: pkgconfig hostname
6ce6d0a
BuildRequires: bison flex
6ce6d0a
BuildRequires: systemd-devel
6ce6d0a
BuildRequires: nss-devel >= 3.16.1
6ce6d0a
BuildRequires: nspr-devel
5f79f63
BuildRequires: pam-devel
43d43de
BuildRequires: libevent-devel
6ce6d0a
BuildRequires: unbound-devel >= 1.6.0-6
6ce6d0a
BuildRequires: ldns-devel
c23e85a
BuildRequires: libseccomp-devel
c23e85a
BuildRequires: libselinux-devel
19d822c
BuildRequires: fipscheck-devel
19d822c
Requires: fipscheck%{_isa}
5f79f63
Buildrequires: audit-libs-devel
5f79f63
BuildRequires: libcap-ng-devel
6ce6d0a
BuildRequires: openldap-devel
6ce6d0a
BuildRequires: curl-devel
6ce6d0a
%if 0%{with_efence}
5f79f63
BuildRequires: ElectricFence
5f79f63
%endif
43d43de
BuildRequires: xmlto
5f79f63
6ce6d0a
Requires: nss-tools
6ce6d0a
Requires: nss-softokn
923dd88
Requires: iproute >= 2.6.8
6ce6d0a
Requires: unbound-libs >= 1.6.6
5f79f63
5f79f63
%description
7f95d07
Libreswan is a free implementation of IPsec & IKE for Linux.  IPsec is
5f79f63
the Internet Protocol Security and uses strong cryptography to provide
5f79f63
both authentication and encryption services.  These services allow you
5f79f63
to build secure tunnels through untrusted networks.  Everything passing
7f95d07
through the untrusted net is encrypted by the ipsec gateway machine and
5f79f63
decrypted by the gateway at the other end of the tunnel.  The resulting
5f79f63
tunnel is a virtual private network or VPN.
5f79f63
5f79f63
This package contains the daemons and userland tools for setting up
5f79f63
Libreswan. To build KLIPS, see the kmod-libreswan.spec file.
5f79f63
5f79f63
Libreswan also supports IKEv2 (RFC4309) and Secure Labeling
5f79f63
5f79f63
Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04
5f79f63
5f79f63
%prep
5f79f63
%setup -q -n libreswan-%{version}%{?prever}
1168774
# Fedora should really figure this versioning out itself, not burden upstream
15c7491
sed -i "s:/usr/bin/python:/usr/bin/python3:" programs/verify/verify.in
1168774
sed -i "s:/usr/bin/python:/usr/bin/python3:" programs/show/show.in
1168774
sed -i "s:/usr/bin/python:/usr/bin/python3:" testing/cert_verify/usage_test
1168774
sed -i "s:/usr/bin/python:/usr/bin/python3:" testing/pluto/ikev1-01-fuzzer/cve-2015-3204.py
1168774
sed -i "s:/usr/bin/python:/usr/bin/python3:" testing/pluto/ikev2-15-fuzzer/send_bad_packets.py
1168774
sed -i "s:/usr/bin/python:/usr/bin/python3:" testing/x509/dist_certs.py
6ce6d0a
# enable crypto-policies support
6ce6d0a
sed -i "s:#[ ]*include \(.*\)\(/crypto-policies/back-ends/libreswan.config\)$:include \1\2:" programs/configs/ipsec.conf.in
ee061f3
5f79f63
%build
6ce6d0a
%if 0%{with_efence}
6ce6d0a
%global efence "-lefence"
5f79f63
%endif
5f79f63
5f79f63
#796683: -fno-strict-aliasing
43d43de
make %{?_smp_mflags} \
6ce6d0a
%if 0%{with_development}
6ce6d0a
    USERCOMPILE="-g -DGCC_LINT %(echo %{optflags} | sed -e s/-O[0-9]*/ /) %{?efence} -fPIE -pie -fno-strict-aliasing -Wformat-nonliteral -Wformat-security" \
19d822c
%else
6ce6d0a
    USERCOMPILE="-g -DGCC_LINT %{optflags} %{?efence} -fPIE -pie -fno-strict-aliasing -Wformat-nonliteral -Wformat-security" \
5f79f63
%endif
6ce6d0a
    USERLINK="-g -pie -Wl,-z,relro,-z,now %{?efence}" \
6ce6d0a
    %{libreswan_config} \
6ce6d0a
    programs
5f79f63
FS=$(pwd)
5f79f63
5f79f63
# Add generation of HMAC checksums of the final stripped binaries
5f79f63
%define __spec_install_post \
5f79f63
    %{?__debug_package:%{__debug_install_post}} \
5f79f63
    %{__arch_install_post} \
5f79f63
    %{__os_install_post} \
6ce6d0a
    fipshmac -d %{buildroot}%{_libdir}/fipscheck %{buildroot}%{_libexecdir}/ipsec/pluto \
5f79f63
%{nil}
5f79f63
5f79f63
%install
43d43de
make \
6ce6d0a
    DESTDIR=%{buildroot} \
6ce6d0a
    %{libreswan_config} \
6ce6d0a
    install
5f79f63
FS=$(pwd)
5f79f63
rm -rf %{buildroot}/usr/share/doc/libreswan
5f79f63
6ce6d0a
install -d -m 0700 %{buildroot}%{_rundir}/pluto
43d43de
# used when setting --perpeerlog without --perpeerlogbase
5f79f63
install -d -m 0700 %{buildroot}%{_localstatedir}/log/pluto/peer
5f79f63
install -d %{buildroot}%{_sbindir}
5f79f63
43d43de
install -d %{buildroot}%{_sysconfdir}/sysctl.d
43d43de
install -m 0644 packaging/fedora/libreswan-sysctl.conf \
6ce6d0a
    %{buildroot}%{_sysconfdir}/sysctl.d/50-libreswan.conf
43d43de
43d43de
install -d %{buildroot}%{_tmpfilesdir}
43d43de
install -m 0644 packaging/fedora/libreswan-tmpfiles.conf  \
6ce6d0a
    %{buildroot}%{_tmpfilesdir}/libreswan.conf
43d43de
5f79f63
mkdir -p %{buildroot}%{_libdir}/fipscheck
5f79f63
19d822c
echo "include %{_sysconfdir}/ipsec.d/*.secrets" \
6ce6d0a
    > %{buildroot}%{_sysconfdir}/ipsec.secrets
fe27601
rm -fr %{buildroot}%{_sysconfdir}/rc.d/rc*
5f79f63
6ce6d0a
%if 0%{with_cavstests}
43d43de
%check
43d43de
# There is an elaborate upstream testing infrastructure which we do not
43d43de
# run here - it takes hours and uses kvm
43d43de
# We only run the CAVS tests.
43d43de
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} .
43d43de
bunzip2 *.fax.bz2
c23e85a
c23e85a
# work around for older xen based machines
c23e85a
export NSS_DISABLE_HW_GCM=1
c23e85a
43d43de
: starting CAVS test for IKEv2
6ce6d0a
%{buildroot}%{_libexecdir}/ipsec/cavp -v2 ikev2.fax | \
43d43de
    diff -u ikev2.fax - > /dev/null
43d43de
: starting CAVS test for IKEv1 RSASIG
6ce6d0a
%{buildroot}%{_libexecdir}/ipsec/cavp -v1dsa ikev1_dsa.fax | \
43d43de
    diff -u ikev1_dsa.fax - > /dev/null
43d43de
: starting CAVS test for IKEv1 PSK
6ce6d0a
%{buildroot}%{_libexecdir}/ipsec/cavp -v1psk ikev1_psk.fax | \
43d43de
    diff -u ikev1_psk.fax - > /dev/null
43d43de
: CAVS tests passed
43d43de
%endif
43d43de
43d43de
%post
43d43de
%systemd_post ipsec.service
43d43de
43d43de
%preun
43d43de
%systemd_preun ipsec.service
43d43de
43d43de
%postun
43d43de
%systemd_postun_with_restart ipsec.service
43d43de
7f95d07
%files
43d43de
%doc CHANGES COPYING CREDITS README* LICENSE
43d43de
%doc docs/*.* docs/examples
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.conf
5f79f63
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ipsec.secrets
5f79f63
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d
5f79f63
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/policies
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.d/policies/*
43d43de
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysctl.d/50-libreswan.conf
43d43de
%attr(0700,root,root) %dir %{_localstatedir}/log/pluto
5f79f63
%attr(0700,root,root) %dir %{_localstatedir}/log/pluto/peer
6ce6d0a
%attr(0700,root,root) %dir %{_rundir}/pluto
43d43de
%attr(0644,root,root) %{_tmpfilesdir}/libreswan.conf
5f79f63
%attr(0644,root,root) %{_unitdir}/ipsec.service
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/pluto
5f79f63
%{_sbindir}/ipsec
5f79f63
%{_libexecdir}/ipsec
6ce6d0a
%doc %{_mandir}/*/*
c23e85a
%{_libdir}/fipscheck/pluto.hmac
5f79f63
5f79f63
%changelog
6ce6d0a
* Wed Jun 27 2018 Paul Wouters <pwouters@redhat.com> - 3.25-1
6ce6d0a
- Updated to 3.25
6ce6d0a
f9eee43
* Mon Feb 19 2018 Paul Wouters <pwouters@redhat.com> - 3.23-2
f9eee43
- Support crypto-policies package
f9eee43
- Pull in some patches from upstream and IANA registry updates
f9eee43
- gcc7 format-truncate fixes and workarounds
f9eee43
21239f4
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.23-1.1
21239f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
21239f4
dbe0b88
* Thu Jan 25 2018 Paul Wouters <pwouters@redhat.com> - 3.23-1
dbe0b88
- Updated to 3.23 - support for MOBIKE, PPK, CMAC, nic offload and performance improvements
dbe0b88
c599efd
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 3.22-1.1
c599efd
- Rebuilt for switch to libxcrypt
c599efd
7f8fe26
* Mon Oct 23 2017 Paul Wouters <pwouters@redhat.com> - 3.22-1
7f8fe26
- Updated to 3.22 - many bugfixes, and unbound ipsecmod support
7f8fe26
19d822c
* Wed Aug  9 2017 Paul Wouters <pwouters@redhat.com> - 3.21-1
19d822c
- Updated to 3.21
19d822c
ca2756c
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.20-1.2
ca2756c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
ca2756c
2f494a3
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.20-1.1
2f494a3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
2f494a3
2a470b1
* Tue Mar 14 2017 Paul Wouters <pwouters@redhat.com> - 3.20-1
2a470b1
- Updated to 3.20
2a470b1
5347f3b
* Fri Mar 03 2017 Paul Wouters <pwouters@redhat.com> - 3.20-0.1.dr4
5347f3b
- Update to 3.20dr4 to test mozbz#1336487 export CERT_CompareAVA
5347f3b
eb82dd3
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.19-1.1
eb82dd3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
eb82dd3
ee061f3
* Fri Feb 03 2017 Paul Wouters <pwouters@redhat.com> - 3.19-2
ee061f3
- Resolves: rhbz#1392191 libreswan: crash when OSX client connects
ee061f3
- Improved uniqueid and session replacing support
ee061f3
- Test Buffer warning fix on size_t
ee061f3
- Re-introduce --configdir for backwards compatibility
ee061f3
c23e85a
* Sun Jan 15 2017 Paul Wouters <pwouters@redhat.com> - 3.19-1
c23e85a
- Updated to 3.19 (see download.libreswan.org/CHANGES)
c23e85a
590db36
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.18-1.1
590db36
- Rebuild for Python 3.6
590db36
2c5d647
* Fri Jul 29 2016 Paul Wouters <pwouters@redhat.com> - 3.18-1
2c5d647
- Updated to 3.18 for CVE-2016-5391 rhbz#1361164 and VTI support
f72e93c
- Remove support for /etc/sysconfig/pluto (use native systemd instead)
2c5d647
bb4a5a6
* Thu May 05 2016 Paul Wouters <pwouters@redhat.com> - 3.17-2
53c8c07
- Resolves: rhbz#1324956 prelink is gone, /etc/prelink.conf.d/* is no longer used 
53c8c07
ee6d2cc
* Thu Apr 07 2016 Paul Wouters <pwouters@redhat.com> - 3.17-1
445105a
- Updated to 3.17 for CVE-2016-3071
445105a
- Disable LIBCAP_NG as it prevents unbound-control from working properly
ee6d2cc
- Temporarilly disable WERROR due to a few minor known issues
445105a
9d17b41
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.16-1.1
9d17b41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
9d17b41
e77c1e6
* Fri Dec 18 2015 Paul Wouters <pwouters@redhat.com> - 3.16-1
e77c1e6
- Updated to 3.16 (see https://download.libreswan.org/CHANGES)
e77c1e6
43d43de
* Tue Aug 11 2015 Paul Wouters <pwouters@redhat.com> - 3.15-1
43d43de
- Updated to 3.15 (see http://download.libreswan.org/CHANGES)
43d43de
- Resolves: rhbz#CVE-2015-3240 IKE daemon restart when receiving a bad DH gx
43d43de
- NSS database creation moved from spec file to service file
43d43de
- Run CAVS tests on package build
43d43de
- Added BuildRequire systemd-units and xmlto
43d43de
- Bumped minimum required nss to 3.16.1
43d43de
- Install tmpfiles
43d43de
- Install sysctl file
43d43de
- Update doc files to include
43d43de
15c7491
* Mon Jul 13 2015 Paul Wouters <pwouters@redhat.com> - 3.13-2
15c7491
- Resolves: rhbz#1238967 Switch libreswan to use python3
15c7491
dbd126d
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.13-1.1
dbd126d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
dbd126d
bc7d953
* Mon Jun 01 2015 Paul Wouters <pwouters@redhat.com> - 3.13-1
bc7d953
- Updated to 3.13 for CVE-2015-3204
bc7d953
1a3c473
* Fri Nov 07 2014 Paul Wouters <pwouters@redhat.com> - 3.12-1
1a3c473
- Updated to 3.12 Various IKEv2 fixes
1a3c473
38a33f1
* Wed Oct 22 2014 Paul Wouters <pwouters@redhat.com> - 3.11-1
38a33f1
- Updated to 3.11 (many fixes, including startup fixes)
1b179bf
- Resolves: rhbz#1144941 libreswan 3.10 upgrade breaks old ipsec.secrets configs
1b179bf
- Resolves: rhbz#1147072 ikev1 aggr mode connection fails after libreswan upgrade
1b179bf
- Resolves: rhbz#1144831 Libreswan appears to start with systemd before all the NICs are up and running
38a33f1
9a1635a
* Tue Sep 09 2014 Paul Wouters <pwouters@redhat.com> - 3.10-3
9a1635a
- Fix some coverity issues, auto=route on bootup and snprintf on 32bit machines
9a1635a
97335a7
* Mon Sep 01 2014 Paul Wouters <pwouters@redhat.com> - 3.10-1
97335a7
- Updated to 3.10, major bugfix release, new xauth status options
97335a7
c6e8ef6
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.9-1.1
c6e8ef6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
c6e8ef6
2f0670d
* Thu Jul 10 2014 Paul Wouters <pwouters@redhat.com> - 3.9-1
2f0670d
- Updated to 3.9. IKEv2 enhancements, ESP/IKE algo enhancements
2f0670d
- Mark libreswan-fips.conf as config file
f964054
- attr modifier for man pages no longer needed
a18af14
- BUGS file no longer exists upstream
2f0670d
83ca85f
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.8-1.1
83ca85f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
83ca85f
68fd6c5
* Sat Jan 18 2014 Paul Wouters <pwouters@redhat.com> - 3.8-1
68fd6c5
- Updated to 3.8, fixes rhbz#CVE-2013-6467 (rhbz#1054102)
68fd6c5
fe27601
* Wed Dec 11 2013 Paul Wouters <pwouters@redhat.com> - 3.7-1
fe27601
- Updated to 3.7, fixes CVE-2013-4564
68fd6c5
- Fixes creating a bogus NSS db on startup (rhbz#1005410)
fe27601
923dd88
* Thu Oct 31 2013 Paul Wouters <pwouters@redhat.com> - 3.6-1
923dd88
- Updated to 3.6 (IKEv2, MODECFG, Cisco interop fixes)
923dd88
- Generate empty NSS db if none exists
923dd88
decff41
* Mon Aug 19 2013 Paul Wouters <pwouters@redhat.com> - 3.5-3
decff41
- Add a Provides: for openswan-doc
decff41
ae48530
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.5-1.1
ae48530
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
ae48530
04df865
* Mon Jul 15 2013 Paul Wouters <pwouters@redhat.com> - 3.5-2
04df865
- Added interop patch for (some?) Cisco VPN clients sending 16 zero
04df865
  bytes of extraneous IKE data
04df865
- Removed fipscheck_version
04df865
d3a863c
* Sat Jul 13 2013 Paul Wouters <pwouters@redhat.com> - 3.5-1
d3a863c
- Updated to 3.5
d3a863c
ee5df2e
* Thu Jun 06 2013 Paul Wouters <pwouters@redhat.com> - 3.4-1
ee5df2e
- Updated to 3.4, which only contains style changes to kernel coding style
ee5df2e
- IN MEMORIAM: June 3rd, 2013 Hugh Daniel
ee5df2e
7f95d07
* Mon May 13 2013 Paul Wouters <pwouters@redhat.com> - 3.3-1
7f95d07
- Updated to 3.3, which resolves CVE-2013-2052
7f95d07
5f79f63
* Sat Apr 13 2013 Paul Wouters <pwouters@redhat.com> - 3.2-1
5f79f63
- Initial package for Fedora