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