5f79f63
%global USE_FIPSCHECK true
5f79f63
%global USE_LIBCAP_NG true
5f79f63
%global USE_LABELED_IPSEC true
5f79f63
%global USE_CRL_FETCHING true
5f79f63
%global USE_DNSSEC true
5f79f63
%global USE_NM true
5f79f63
%global USE_LINUX_AUDIT true
5f79f63
5f79f63
%global _hardened_build 1
5f79f63
5f79f63
%global fipscheck_version 1.3.0
5f79f63
%global buildefence 0
5f79f63
%global development 0
5f79f63
5f79f63
#global prever rc1
5f79f63
5f79f63
Name: libreswan
5f79f63
Summary: IPsec implementation with IKEv1 and IKEv2 keying protocols
d3a863c
Version: 3.5
5f79f63
Release: %{?prever:0.}1%{?prever:.%{prever}}%{?dist}
5f79f63
License: GPLv2
5f79f63
Url: https://www.libreswan.org/
5f79f63
Source: https://download.libreswan.org/%{name}-%{version}%{?prever}.tar.gz
5f79f63
Group: System Environment/Daemons
5f79f63
BuildRequires: gmp-devel bison flex redhat-rpm-config pkgconfig
5f79f63
BuildRequires: systemd
5f79f63
Requires(post): coreutils bash 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}
5f79f63
5f79f63
BuildRequires: pkgconfig hostname
5f79f63
BuildRequires: nss-devel >= 3.12.6-2, nspr-devel
5f79f63
BuildRequires: pam-devel
5f79f63
%if %{USE_DNSSEC}
5f79f63
BuildRequires: unbound-devel
5f79f63
%endif
5f79f63
%if %{USE_FIPSCHECK}
5f79f63
BuildRequires: fipscheck-devel >= %{fipscheck_version}
5f79f63
# we need fipshmac
5f79f63
Requires: fipscheck%{_isa} >= %{fipscheck_version}
5f79f63
%endif
5f79f63
%if %{USE_LINUX_AUDIT}
5f79f63
Buildrequires: audit-libs-devel
5f79f63
%endif
5f79f63
5f79f63
%if %{USE_LIBCAP_NG}
5f79f63
BuildRequires: libcap-ng-devel
5f79f63
%endif
5f79f63
%if %{USE_CRL_FETCHING}
5f79f63
BuildRequires: openldap-devel curl-devel
5f79f63
%endif
5f79f63
%if %{buildefence}
5f79f63
BuildRequires: ElectricFence
5f79f63
%endif
5f79f63
# Only needed if xml man pages are modified and need regeneration
5f79f63
# BuildRequires: xmlto
5f79f63
5f79f63
Requires: nss-tools, nss-softokn
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}
5f79f63
5f79f63
%build
5f79f63
%if %{buildefence}
5f79f63
 %define efence "-lefence"
5f79f63
%endif
5f79f63
5f79f63
#796683: -fno-strict-aliasing
5f79f63
%{__make} \
5f79f63
%if %{development}
5f79f63
   USERCOMPILE="-g -DGCC_LINT %(echo %{optflags} | sed -e s/-O[0-9]*/ /) %{?efence} -fPIE -pie -fno-strict-aliasing -Wformat-nonliteral -Wformat-security" \
5f79f63
%else
5f79f63
  USERCOMPILE="-g -DGCC_LINT %{optflags} %{?efence} -fPIE -pie -fno-strict-aliasing -Wformat-nonliteral -Wformat-security" \
5f79f63
%endif
5f79f63
  USERLINK="-g -pie -Wl,-z,relro,-z,now %{?efence}" \
5f79f63
  INITSYSTEM=systemd \
5f79f63
  USE_DYNAMICDNS="true" \
5f79f63
  USE_NM=%{USE_NM} \
5f79f63
  USE_XAUTHPAM=true \
5f79f63
  USE_FIPSCHECK="%{USE_FIPSCHECK}" \
5f79f63
  USE_LIBCAP_NG="%{USE_LIBCAP_NG}" \
5f79f63
  USE_LABELED_IPSEC="%{USE_LABELED_IPSEC}" \
5f79f63
%if %{USE_CRL_FETCHING}
5f79f63
  USE_LDAP=true \
5f79f63
  USE_LIBCURL=true \
5f79f63
%endif
5f79f63
  USE_DNSSEC="%{USE_DNSSEC}" \
5f79f63
  INC_USRLOCAL=%{_prefix} \
5f79f63
  FINALLIBDIR=%{_libexecdir}/ipsec \
5f79f63
  FINALLIBEXECDIR=%{_libexecdir}/ipsec \
5f79f63
  MANTREE=%{_mandir} \
5f79f63
  INC_RCDEFAULT=%{_initrddir} \
5f79f63
  programs
5f79f63
FS=$(pwd)
5f79f63
5f79f63
%if %{USE_FIPSCHECK}
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} \
5f79f63
  fipshmac -d %{buildroot}%{_libdir}/fipscheck ` ls %{buildroot}%{_libexecdir}/ipsec/*|grep -v setup` \
5f79f63
  fipshmac -d %{buildroot}%{_libdir}/fipscheck %{buildroot}%{_sbindir}/ipsec \
5f79f63
%{nil}
5f79f63
%endif
5f79f63
5f79f63
%install
5f79f63
rm -rf ${RPM_BUILD_ROOT}
5f79f63
%{__make} \
5f79f63
  DESTDIR=%{buildroot} \
5f79f63
  INC_USRLOCAL=%{_prefix} \
5f79f63
  FINALLIBDIR=%{_libexecdir}/ipsec \
5f79f63
  FINALLIBEXECDIR=%{_libexecdir}/ipsec \
5f79f63
  MANTREE=%{buildroot}%{_mandir} \
5f79f63
  INC_RCDEFAULT=%{_initrddir} \
5f79f63
  INSTMANFLAGS="-m 644" \
5f79f63
  INITSYSTEM=systemd \
5f79f63
  install
5f79f63
FS=$(pwd)
5f79f63
rm -rf %{buildroot}/usr/share/doc/libreswan
5f79f63
5f79f63
install -d -m 0755 %{buildroot}%{_localstatedir}/run/pluto
7f95d07
# used when setting --perpeerlog without --perpeerlogbase
5f79f63
install -d -m 0700 %{buildroot}%{_localstatedir}/log/pluto/peer
5f79f63
install -d %{buildroot}%{_sbindir}
5f79f63
5f79f63
%if %{USE_FIPSCHECK}
5f79f63
mkdir -p %{buildroot}%{_libdir}/fipscheck
5f79f63
%endif
5f79f63
5f79f63
echo "include /etc/ipsec.d/*.secrets" > %{buildroot}%{_sysconfdir}/ipsec.secrets
5f79f63
rm -fr %{buildroot}/etc/rc.d/rc*
5f79f63
7f95d07
%files
5f79f63
%doc BUGS CHANGES COPYING CREDITS README LICENSE
5f79f63
%doc docs/*.*
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.conf
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/pluto
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/cacerts
5f79f63
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/crls
5f79f63
%attr(0700,root,root) %dir %{_sysconfdir}/ipsec.d/policies
5f79f63
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ipsec.d/policies/*
5f79f63
%attr(0700,root,root) %dir %{_localstatedir}/log/pluto/peer
5f79f63
%attr(0755,root,root) %dir %{_localstatedir}/run/pluto
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
5f79f63
%attr(0644,root,root) %doc %{_mandir}/*/*
5f79f63
5f79f63
%if %{USE_FIPSCHECK}
5f79f63
%{_libdir}/fipscheck/*.hmac
5f79f63
%endif
5f79f63
5f79f63
%preun
5f79f63
%systemd_preun ipsec.service
5f79f63
5f79f63
%postun
5f79f63
%systemd_postun_with_restart ipsec.service
5f79f63
7f95d07
%post
5f79f63
%systemd_post ipsec.service
5f79f63
5f79f63
%changelog
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