7d3267
%define haproxy_user    haproxy
7d3267
%define haproxy_group   %{haproxy_user}
7d3267
%define haproxy_home    %{_localstatedir}/lib/haproxy
7d3267
%define haproxy_confdir %{_sysconfdir}/haproxy
7d3267
%define haproxy_datadir %{_datadir}/haproxy
7d3267
7d3267
%global _hardened_build 1
7d3267
7d3267
Name:           haproxy
7d3267
Version:        1.5.18
7d3267
Release:        9%{?dist}
7d3267
Summary:        TCP/HTTP proxy and load balancer for high availability environments
7d3267
7d3267
Group:          System Environment/Daemons
7d3267
License:        GPLv2+
7d3267
7d3267
URL:            http://www.haproxy.org/
7d3267
Source0:        http://www.haproxy.org/download/1.5/src/haproxy-%{version}.tar.gz
7d3267
Source1:        %{name}.service
7d3267
Source2:        %{name}.cfg
7d3267
Source3:        %{name}.logrotate
7d3267
Source4:        %{name}.sysconfig
7d3267
Source5:        halog.1
7d3267
7d3267
Patch0:         halog-unused-variables.patch
7d3267
Patch1:         iprange-return-type.patch
7d3267
Patch2:         haproxy-tcp-user-timeout.patch
7d3267
Patch3:         haproxy-systemd-wrapper-exit-code.patch
7d3267
Patch4:         haproxy-tcp-check-detect-down.patch
7d3267
7d3267
BuildRequires:  pcre-devel
7d3267
BuildRequires:  zlib-devel
7d3267
BuildRequires:  openssl-devel
7d3267
BuildRequires:  systemd-units
7d3267
7d3267
Requires(pre):      shadow-utils
7d3267
Requires(post):     systemd
7d3267
Requires(preun):    systemd
7d3267
Requires(postun):   systemd
7d3267
7d3267
%description
7d3267
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
7d3267
availability environments. Indeed, it can:
7d3267
 - route HTTP requests depending on statically assigned cookies
7d3267
 - spread load among several servers while assuring server persistence
7d3267
   through the use of HTTP cookies
7d3267
 - switch to backup servers in the event a main server fails
7d3267
 - accept connections to special ports dedicated to service monitoring
7d3267
 - stop accepting connections without breaking existing ones
7d3267
 - add, modify, and delete HTTP headers in both directions
7d3267
 - block requests matching particular patterns
7d3267
 - report detailed status to authenticated users from a URI
7d3267
   intercepted by the application
7d3267
7d3267
%prep
7d3267
%setup -q
7d3267
%patch0 -p0
7d3267
%patch1 -p0
7d3267
%patch2 -p1
7d3267
%patch3 -p1
7d3267
%patch4 -p1
7d3267
7d3267
%build
7d3267
regparm_opts=
7d3267
%ifarch %ix86 x86_64
7d3267
regparm_opts="USE_REGPARM=1"
7d3267
%endif
7d3267
7d3267
%{__make} %{?_smp_mflags} CPU="generic" TARGET="linux2628" USE_OPENSSL=1 USE_PCRE=1 USE_ZLIB=1 ${regparm_opts} ADDINC="%{optflags}" USE_LINUX_TPROXY=1 USE_GETADDRINFO=1 ADDLIB="%{__global_ldflags}" DEFINE=-DTCP_USER_TIMEOUT=18
7d3267
7d3267
pushd contrib/halog
7d3267
%{__make} halog OPTIMIZE="%{optflags}"
7d3267
popd
7d3267
7d3267
pushd contrib/iprange
7d3267
%{__make} iprange OPTIMIZE="%{optflags}"
7d3267
popd
7d3267
7d3267
%install
7d3267
%{__make} install-bin DESTDIR=%{buildroot} PREFIX=%{_prefix} TARGET="linux2628"
7d3267
%{__make} install-man DESTDIR=%{buildroot} PREFIX=%{_prefix}
7d3267
7d3267
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
7d3267
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{haproxy_confdir}/%{name}.cfg
7d3267
%{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
7d3267
%{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
7d3267
%{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/halog.1
7d3267
%{__install} -d -m 0755 %{buildroot}%{haproxy_home}
7d3267
%{__install} -d -m 0755 %{buildroot}%{haproxy_datadir}
7d3267
%{__install} -d -m 0755 %{buildroot}%{_bindir}
7d3267
%{__install} -p -m 0755 ./contrib/halog/halog %{buildroot}%{_bindir}/halog
7d3267
%{__install} -p -m 0755 ./contrib/iprange/iprange %{buildroot}%{_bindir}/iprange
7d3267
%{__install} -p -m 0644 ./examples/errorfiles/* %{buildroot}%{haproxy_datadir}
7d3267
7d3267
for httpfile in $(find ./examples/errorfiles/ -type f)
7d3267
do
7d3267
    %{__install} -p -m 0644 $httpfile %{buildroot}%{haproxy_datadir}
7d3267
done
7d3267
7d3267
%{__rm} -rf ./examples/errorfiles/
7d3267
7d3267
find ./examples/* -type f ! -name "*.cfg" -exec %{__rm} -f "{}" \;
7d3267
7d3267
for textfile in $(find ./ -type f -name "*.txt" -o -name README)
7d3267
do
7d3267
    %{__mv} $textfile $textfile.old
7d3267
    iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old
7d3267
    %{__rm} -f $textfile.old
7d3267
done
7d3267
7d3267
%pre
7d3267
getent group %{haproxy_group} >/dev/null || groupadd -f -g 188 -r %{haproxy_group}
7d3267
if ! getent passwd %{haproxy_user} >/dev/null ; then
7d3267
    if ! getent passwd 188 >/dev/null ; then
7d3267
        useradd -r -u 188 -g %{haproxy_group} -d %{haproxy_home} -s /sbin/nologin -c "haproxy" %{haproxy_user}
7d3267
    else
7d3267
        useradd -r -g %{haproxy_group} -d %{haproxy_home} -s /sbin/nologin -c "haproxy" %{haproxy_user}
7d3267
    fi
7d3267
fi
7d3267
7d3267
%post
7d3267
%systemd_post %{name}.service
7d3267
7d3267
%preun
7d3267
%systemd_preun %{name}.service
7d3267
7d3267
%postun
7d3267
%systemd_postun_with_restart %{name}.service
7d3267
7d3267
%files
7d3267
%defattr(-,root,root,-)
7d3267
%doc doc/* examples/
7d3267
%doc CHANGELOG LICENSE README ROADMAP VERSION
7d3267
%dir %{haproxy_confdir}
7d3267
%dir %{haproxy_datadir}
7d3267
%{haproxy_datadir}/*
7d3267
%config(noreplace) %{haproxy_confdir}/%{name}.cfg
7d3267
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
7d3267
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
7d3267
%{_unitdir}/%{name}.service
7d3267
%{_sbindir}/%{name}
7d3267
%{_sbindir}/%{name}-systemd-wrapper
7d3267
%{_bindir}/halog
7d3267
%{_bindir}/iprange
7d3267
%{_mandir}/man1/*
7d3267
%attr(-,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_home}
7d3267
7d3267
%changelog
7d3267
* Wed Feb 27 2019 Ryan O'Hara <rohara@redhat.com> - 1.5.18-9
7d3267
- Detect down servers with mutliple tcp-check connect rules (#1677420)
7d3267
7d3267
* Wed Jul 25 2018 Ryan O'Hara <rohara@redhat.com> - 1.5.18-8
7d3267
- Build with USE_GETADDRINFO option (#1598491)
7d3267
7d3267
* Thu Nov 30 2017 Ryan O'Hara <rohara@redhat.com> - 1.5.18-7
7d3267
- Rebuild with openssl-1.0.2k (#1509139)
7d3267
7d3267
* Mon May 01 2017 Ryan O'Hara <rohara@redhat.com> - 1.5.18-6
7d3267
- Use KillMode=mixed in systemd service file (#1444709)
7d3267
7d3267
* Thu Mar 16 2017 Ryan O'Hara <rohara@redhat.com> - 1.5.18-5
7d3267
- Use soft-static allocation for haproxy UID/GID (#1386130)
7d3267
7d3267
* Wed Nov 16 2016 Ryan O'Hara <rohara@redhat.com> - 1.5.18-4
7d3267
- Return correct exit codes from systemd-wrapper (#1391990)
7d3267
7d3267
* Tue Jun 21 2016 Ryan O'Hara <rohara@redhat.com> - 1.5.18-3
7d3267
- Fix TCP user timeout patch for 1.5.18 release
7d3267
7d3267
* Thu Jun 16 2016 Ryan O'Hara <rohara@redhat.com> - 1.5.18-2
7d3267
- Add TARGET to install-bin for haproxy-systemd-wrapper
7d3267
7d3267
* Wed Jun 15 2016 Ryan O'Hara <rohara@redhat.com> - 1.5.18-1
7d3267
- Update to stable release 1.5.18 (#1344012)
7d3267
7d3267
* Tue Aug 25 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.14-3
7d3267
- Add EnvironmentFile to systemd service (#1191675)
7d3267
7d3267
* Mon Jul 06 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.14-1
7d3267
- Update to stable release 1.5.14 (CVE-2015-3281, #1212193)
7d3267
7d3267
* Wed Jun 24 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.12-2
7d3267
- Rebase TCP uset timeout patch for 1.5.12 release (#1212193)
7d3267
7d3267
* Tue Jun 23 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.12-1
7d3267
- Update to stable release 1.5.12 (#1212193)
7d3267
7d3267
* Thu May 21 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.4-5
7d3267
- Define TCP_USER_TIMEOUT at build time (#1190776)
7d3267
7d3267
* Wed Mar 04 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.4-4
7d3267
- Read sysconfig file for extra options (#1191675)
7d3267
7d3267
* Wed Mar 04 2015 Ryan O'Hara <rohara@redhat.com> - 1.5.4-3
7d3267
- Add tcp-ut bind option to set TCP_USER_TIMEOUT (#1190776)
7d3267
7d3267
* Tue Nov 18 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.4-2
7d3267
- Fix date in changelog
7d3267
7d3267
* Tue Sep 02 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.4-1
7d3267
- Update to stable release 1.5.4 (#1111714)
7d3267
7d3267
* Fri Jul 25 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.3-1
7d3267
- Update to stable release 1.5.3 (#1111714)
7d3267
7d3267
* Tue Jul 15 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.2-1
7d3267
- Update to stable release 1.5.2 (#1111714)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-6
7d3267
- Cleanup spec file (#1068642)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-5
7d3267
- Minor changes to summary and description (#1067146)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-4
7d3267
- Include iprange tool (#1078487)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-3
7d3267
- Include man page for halog (#1078461)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-2
7d3267
- Build with openssl and zlib (#1112184)
7d3267
7d3267
* Tue Jul 08 2014 Ryan O'Hara <rohara@redhat.com> - 1.5.1-1
7d3267
- Update to stable release 1.5.1 (#1111714)
7d3267
7d3267
* Fri Feb 28 2014 Ryan O'Hara <rohara@redhat.com> - 1.5-0.3.dev22
7d3267
- Use haproxy-systemd-wrapper in service file (#1067060)
7d3267
7d3267
* Wed Feb 12 2014 Ryan O'Hara <rohara@redhat.com> - 1.5-0.2.dev22
7d3267
- Specify assigned UID in useradd
7d3267
7d3267
* Mon Feb 10 2014 Ryan O'Hara <rohara@redhat.com> - 1.5-0.1.dev22
7d3267
- Update to development release 1.5-dev22 (#1043658)
7d3267
7d3267
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.4.24-3
7d3267
- Mass rebuild 2014-01-24
7d3267
7d3267
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.4.24-2
7d3267
- Mass rebuild 2013-12-27
7d3267
7d3267
* Mon Jun 17 2013 Ryan O'Hara <rohara@redhat.com> - 1.4.24-1
7d3267
- Update to 1.4.24 (CVE-2013-2174, #975160)
7d3267
7d3267
* Tue Apr 30 2013 Ryan O'Hara <rohara@redhat.com> - 1.4.23-3
7d3267
- Build with PIE flags (#955182)
7d3267
7d3267
* Mon Apr 22 2013 Ryan O'Hara <rohara@redhat.com> - 1.4.23-2
7d3267
- Build with PIE flags (#955182)
7d3267
7d3267
* Tue Apr 02 2013 Ryan O'Hara <rohara@redhat.com> - 1.4.23-1
7d3267
- Update to 1.4.23 (CVE-2013-1912, #947697)
7d3267
- Drop supplementary groups after setuid/setgid (#894626)
7d3267
7d3267
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.22-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
7d3267
7d3267
* Fri Oct 12 2012 Robin Lee <cheeselee@fedoraproject.org> - 1.4.22-1
7d3267
- Update to 1.4.22 (CVE-2012-2942, #824544)
7d3267
- Use linux2628 build target
7d3267
- No separate x86_64 build target for halog
7d3267
- halog build honors rpmbuild optflags
7d3267
- Specfile cleanup
7d3267
7d3267
* Mon Sep 17 2012 Václav Pavlín <vpavlin@redhat.com> - 1.4.20-3
7d3267
- Scriptlets replaced with new systemd macros (#850143)
7d3267
7d3267
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.20-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
7d3267
7d3267
* Tue Apr 03 2012 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.20-1
7d3267
- Update to 1.4.20
7d3267
7d3267
* Sun Feb 19 2012 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.19-4
7d3267
- fix haproxy.services file
7d3267
7d3267
* Sun Feb 19 2012 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.19-3
7d3267
- Update to use systemd fixing bug #770305
7d3267
7d3267
* Fri Feb 10 2012 Petr Pisar <ppisar@redhat.com> - 1.4.19-2
7d3267
- Rebuild against PCRE 8.30
7d3267
7d3267
* Sun Jan 29 2012 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.19-1
7d3267
- Update to 1.4.19
7d3267
7d3267
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.18-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
7d3267
7d3267
* Thu Sep 22 2011 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.18-1
7d3267
- Update to 1.4.18
7d3267
7d3267
* Tue Apr 26 2011 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.15-1
7d3267
- Update to 1.4.15
7d3267
7d3267
* Sun Feb 27 2011 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.11-1
7d3267
- update to 1.4.11
7d3267
7d3267
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
7d3267
7d3267
* Sun Dec 12 2010 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.9-1
7d3267
- update to 1.4.9
7d3267
7d3267
* Sun Jun 20 2010 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.8-1
7d3267
- update to 1.4.8
7d3267
7d3267
* Sun May 30 2010 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.4.6-1
7d3267
- update to 1.4.6
7d3267
7d3267
* Thu Feb 18 2010 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.23-1
7d3267
- update to 1.3.23
7d3267
7d3267
* Sat Oct 17 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.22-1
7d3267
- update to 1.3.22
7d3267
- added logrotate configuration
7d3267
7d3267
* Mon Oct 12 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.21-1
7d3267
- update to 1.3.21
7d3267
7d3267
* Sun Oct 11 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.20-1
7d3267
- update to 1.3.20
7d3267
7d3267
* Sun Aug 02 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.19-1
7d3267
- update to 1.3.19
7d3267
7d3267
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.18-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
7d3267
7d3267
* Sun May 17 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.18-1
7d3267
- update to 1.3.18
7d3267
7d3267
* Sat Apr 11 2009 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.17-1
7d3267
-  Update to 1.3.17
7d3267
7d3267
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.15.7-2
7d3267
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
7d3267
7d3267
* Tue Dec 30 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.15.7-1
7d3267
- update to 1.3.15.7
7d3267
- remove upstream patches, they are now part of source distribution
7d3267
7d3267
* Sat Nov 22 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.15.6-2
7d3267
- apply upstream patches
7d3267
7d3267
* Sat Nov 15 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.15.6-1
7d3267
- update to 1.3.15.6
7d3267
- use new build targets from upstream
7d3267
- add in recommended build options for x86 from upstream
7d3267
7d3267
* Sat Jun 28 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.6-1
7d3267
- update to 1.3.14.6
7d3267
- remove gcc 4.3 patch, it has been applied upstream
7d3267
- remove MIT license as that code has been removed from upstream
7d3267
7d3267
* Mon Apr 14 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.4-1
7d3267
- update to 1.3.14.4
7d3267
7d3267
* Sun Mar 16 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.3-1
7d3267
- update to 1.3.14.3
7d3267
7d3267
* Sat Mar 01 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.2-4
7d3267
- apply the gcc 4.3 patch to the build process
7d3267
7d3267
* Sat Mar 01 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.2-3
7d3267
- fix gcc 4.3 bug [#434144]
7d3267
- update init script to properly reload configuration
7d3267
7d3267
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.3.14.2-2
7d3267
- Autorebuild for GCC 4.3
7d3267
7d3267
* Sun Jan 20 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14.2-1
7d3267
- update to 1.3.14.2
7d3267
- update make flags that changed with this upstream release
7d3267
- added man page installation
7d3267
7d3267
* Sun Dec 16 2007 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.3.14-1
7d3267
- update to 1.3.14
7d3267
7d3267
* Mon Nov 05 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.4-1
7d3267
- update to 1.3.12.4
7d3267
7d3267
* Thu Nov 01 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.3-1
7d3267
- update to 1.3.12.3
7d3267
7d3267
* Fri Sep 21 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.2-3
7d3267
- fix init script 'reload' task
7d3267
7d3267
* Thu Sep 20 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.2-2
7d3267
- update License field
7d3267
7d3267
* Thu Sep 20 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.2-1
7d3267
- update to 1.3.12.2
7d3267
- remove the upstream patch
7d3267
7d3267
* Tue Sep 18 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.3.12.1-1
7d3267
- switch to 1.3.12.1 branch
7d3267
- add patch from upstream with O'Reilly licensing updates.
7d3267
- convert ISO-8859-1 doc files to UTF-8
7d3267
7d3267
* Sat Mar 24 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.2.17-2
7d3267
- addition of haproxy user
7d3267
- add license information
7d3267
7d3267
* Fri Mar 23 2007 Jeremy Hinegardner <jeremy@hinegardner.org> - 1.2.17-1
7d3267
- initial packaging