0895aa4
# Checks may only be ran from a host with internet connection
40f7568
%global runcheck	0
0895aa4
0895aa4
%global hitch_user	hitch
0895aa4
%global hitch_group	hitch
afceb4a
%global hitch_homedir	%{_sharedstatedir}/hitch
0895aa4
%global hitch_confdir	%{_sysconfdir}/hitch
0895aa4
%global hitch_datadir	%{_datadir}/hitch
6577e73
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
6577e73
dfee3e6
# A bug in the rhel7 builders? Looks like they set _pkgdocdir fedora style
dfee3e6
# without version...?
00ca6c6
%if 0%{?rhel} == 6 || 0%{?rhel} == 7
00ca6c6
%global _pkgdocdir %{_docdir}/%{name}-%{version}
00ca6c6
%endif
0895aa4
0895aa4
%global _hardened_build 1
0895aa4
0895aa4
Name:		hitch
420a630
Version:	1.5.2
3db7bc7
Release:	1%{?dist}
0895aa4
Summary:	Network proxy that terminates TLS/SSL connections
0895aa4
0895aa4
License:	BSD
1a41ea0
URL:		https://hitch-tls.org/
53793d6
Source0:	https://hitch-tls.org/source/%{name}-%{version}%{?v_rc}.tar.gz
0895aa4
0895aa4
BuildRequires:	libev-devel
0895aa4
BuildRequires:	openssl-devel
0895aa4
BuildRequires:	openssl
e73c707
BuildRequires:	pkgconfig
0895aa4
BuildRequires:	libtool
420a630
#BuildRequires:	python-docutils >= 0.6
0895aa4
Requires:	openssl
0895aa4
0895aa4
Patch0:		hitch.systemd.service.patch
0895aa4
Patch1:		hitch.initrc.redhat.patch
0895aa4
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0895aa4
Requires(post): systemd
0895aa4
Requires(preun): systemd
0895aa4
Requires(postun): systemd
0895aa4
BuildRequires: systemd
0895aa4
%else
0895aa4
Requires(preun): initscripts
0895aa4
%endif
0895aa4
0895aa4
%description
0895aa4
hitch is a network proxy that terminates TLS/SSL connections and forwards the
0895aa4
unencrypted traffic to some backend. It is designed to handle 10s of thousands
0895aa4
of connections efficiently on multicore machines.
0895aa4
0895aa4
%prep
53793d6
%setup -q -n %{name}-%{version}%{?v_rc}
0895aa4
%patch0
0895aa4
%patch1
ce56506
0895aa4
%build
1a41ea0
#./bootstrap
0895aa4
0895aa4
%if 0%{?rhel} == 6
0895aa4
CFLAGS="%{optflags} -fPIE"
0895aa4
LDFLAGS=" -pie"
0895aa4
CPPFLAGS=" -I%{_includedir}/libev"
0895aa4
export LDFLAGS
0895aa4
export CPPFLAGS
0895aa4
%endif
5a01c82
export CFLAGS
0895aa4
8f2e073
# manpages are prebuilt, no need to build again
8f2e073
export RST2MAN=/bin/true
8f2e073
00ca6c6
%configure --docdir=%_pkgdocdir
6577e73
0895aa4
make %{?_smp_mflags}
0895aa4
0895aa4
0895aa4
%install
6577e73
%make_install
1a41ea0
sed   '
dfee3e6
	s/user = .*/user = "%{hitch_user}"/g;
dfee3e6
	s/group = .*/group = "%{hitch_group}"/g;
0895aa4
	s/backend = "\[127.0.0.1\]:8000"/backend = "[127.0.0.1]:6081"/g;
3db7bc7
	$a\syslog = on
3db7bc7
	$a\log-level = 1
00ca6c6
	$a\# Add pem files to this directory
00ca6c6
	$a\pem-dir = "/etc/pki/tls/private"
53793d6
	' hitch.conf.example > hitch.conf
dfee3e6
e266e15
%if 0%{?fedora} 
e266e15
	sed -i 's/^ciphers =.*/ciphers = "PROFILE=SYSTEM"/g' hitch.conf
e266e15
%endif
e266e15
53793d6
rm -f %{buildroot}%{_datarootdir}/doc/%{name}/hitch.conf.example
1a41ea0
0895aa4
install -p -D -m 0644 hitch.conf %{buildroot}%{_sysconfdir}/hitch/hitch.conf
0895aa4
install -d -m 0755 %{buildroot}%{hitch_homedir}
0895aa4
install -d -m 0755 %{buildroot}%{hitch_datadir}
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0895aa4
install -p -D -m 0644 hitch.service %{buildroot}%{_unitdir}/hitch.service
00ca6c6
install -p -D -m 0644 limit.conf    %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
00ca6c6
0895aa4
%else
0895aa4
install -p -D -m 0755 hitch.initrc.redhat %{buildroot}%{_initrddir}/hitch
0895aa4
install -d -m 0755 %{buildroot}%{_localstatedir}/run/hitch
0895aa4
%endif
0895aa4
0895aa4
# check is not enabled by default, as it won't work on the koji builders, 
0895aa4
# nor on machines that can't reach the Internet. 
0895aa4
%check
0895aa4
%if 0%{?runcheck} == 1
e266e15
make check
0895aa4
%endif
0895aa4
0895aa4
%pre
0895aa4
groupadd -r %{hitch_group} &>/dev/null ||:
0895aa4
useradd -r -g %{hitch_group} -s /sbin/nologin -d %{hitch_homedir} %{hitch_user} &>/dev/null ||:
0895aa4
0895aa4
0895aa4
%post
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0895aa4
%systemd_post hitch.service
0895aa4
%else
0895aa4
/sbin/chkconfig --add hitch
0895aa4
%endif
0895aa4
0895aa4
%preun
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0895aa4
%systemd_preun hitch.service
0895aa4
%else
cee4246
if [ $1 -lt 1 ]; then
0895aa4
/sbin/service hitch stop > /dev/null 2>&1
0895aa4
/sbin/chkconfig --del hitch
cee4246
fi
0895aa4
%endif
0895aa4
0895aa4
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0895aa4
%postun
0895aa4
%systemd_postun_with_restart hitch.service
0895aa4
%endif
0895aa4
0895aa4
0895aa4
%files
0895aa4
%doc README.md
6577e73
%doc CHANGES.rst
53793d6
%doc hitch.conf.example
53793d6
%doc docs/*
0895aa4
%if 0%{?rhel} == 6
0895aa4
%doc LICENSE
0895aa4
%else
0895aa4
%license LICENSE
0895aa4
%endif
1a41ea0
%{_sbindir}/%{name}
afceb4a
%{_mandir}/man5/%{name}.conf.5*
afceb4a
%{_mandir}/man8/%{name}.8*
afceb4a
%dir %{_sysconfdir}/%{name}
afceb4a
%attr(0700,%hitch_user,%hitch_user) %dir %hitch_homedir
afceb4a
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
0895aa4
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
afceb4a
%{_unitdir}/%{name}.service
00ca6c6
%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/limit.conf
afceb4a
%ghost %verify(not md5 size mtime)  /run/%{name}/%{name}.pid
0895aa4
0895aa4
%else
afceb4a
%{_initrddir}/%{name}
afceb4a
%attr(0755,%hitch_user,%hitch_user) %dir %{_localstatedir}/run/%{name}
420a630
%attr(0644,%hitch_user,%hitch_user) %ghost %verify(not md5 size mtime)	%{_localstatedir}/run/%{name}/%{name}.pid
0895aa4
%endif
0895aa4
0895aa4
0895aa4
%changelog
420a630
* Wed Nov 27 2019 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.5.2-1
420a630
- New upstream release
420a630
- Removed patches merged upstream
420a630
3db7bc7
* Tue Nov 26 2019 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.5.1-1
3db7bc7
- New upstream release
3db7bc7
- Added a patch working around upstream bug #322
3db7bc7
- Example config now sets debug-level=1 and logs to syslog
3db7bc7
00ca6c6
* Tue Nov 12 2019 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.5.0-4
00ca6c6
- Added support for epel8
00ca6c6
- Added a systemd limit.conf with defaults LimitCORE=infinity, LimitNOFILE=10240
00ca6c6
- Added pem-dir = "/etc/pki/tls/private" to the example config
00ca6c6
- Changed systemd Type=forking matching the example config, fixes bz #1731420
00ca6c6
- Simplified handling of the _docdir macro
00ca6c6
3af2675
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-3
3af2675
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
3af2675
758b1f4
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
758b1f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
758b1f4
bcfe53f
* Tue Jan 22 2019 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.5.0-1
bcfe53f
- New upstream release
bcfe53f
6f10da7
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.8-2
6f10da7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
6f10da7
3ee6853
* Thu Apr 19 2018 Ingvar Hagelund <ingvar@redpill-linpro.com>  - 1.4.8-1
3ee6853
- New upstream release 1.4.8, closes bz 1569501
3ee6853
aadac2e
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.6-5
aadac2e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
aadac2e
f596ad8
* Mon Sep 04 2017 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.4.6-4
f596ad8
- Rebuilt against openssl-1.0.2k for epel7
f596ad8
e752806
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.6-3
e752806
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
e752806
a54dda8
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.6-2
a54dda8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
a54dda8
3e90246
* Wed Jun 07 2017 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.4.6-1
3e90246
- New upstream release
3e90246
- Removed unnecessary fix for upstream bug #181
3e90246
5a01c82
* Wed May 31 2017 Ingvar Hagelund <ingvar@redpill-linpro.com> - 1.4.5-1
5a01c82
- New upstream release
5a01c82
- Had to add -Wno-error=strict-aliasing because of upstream bug #181
5a01c82
f87bd84
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.4-3
f87bd84
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
f87bd84
f6eb45b
* Fri Dec 23 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4.4-2
afceb4a
- More macros
afceb4a
- Use systemd's RuntimeDirectory instead of tmpfilesd
afceb4a
- hitch now owns its homedir, closing bz #1405948
afceb4a
d354252
* Thu Dec 22 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4.4-1
d354252
- New upstream release
d354252
- Removed merged patch for openssl-1.1
d354252
ce56506
* Thu Nov 17 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4.3-1
ce56506
- New upstream release
ce56506
- Added upstream patch for openssl-1.1
ce56506
dfee3e6
* Thu Nov 17 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4.2-1
dfee3e6
- New upstream release
dfee3e6
- Added new manpage for hitch.conf
dfee3e6
- Updated sed edit of the example config to match values in the test suite
dfee3e6
- Added a hack for un-fedora-styling _pkgdocdir on rhel7 builders
dfee3e6
3f2d696
* Sat Sep 24 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4.1-1
3f2d696
- New upstream release
3f2d696
e73c707
* Tue Sep 13 2016 Ingvar Hagelund <ingvar@repdill-linpro.com> 1.4.0-1
e73c707
- New upstream release
e73c707
53793d6
* Thu Aug 25 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.3.1-1
53793d6
- New upstream release
53793d6
- Fixes for beta3 ironed out upstream, so removed
53793d6
53793d6
* Mon Aug 08 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.3.0-0.1.beta3
53793d6
- New upstream beta release
53793d6
- Manually build man page, BuildRequires python-docutils => 0.6
53793d6
- Check suit now runs on el6 without patching
53793d6
cee4246
* Fri May 20 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.2.0-2
cee4246
- Added missing check on upgrade/uninstall in postun script on epel6
cee4246
e266e15
* Mon Apr 25 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.2.0-1
e266e15
- New upstream release
e266e15
- Clean up test tree before build
e266e15
- Removed no longer needed test patch 
e266e15
- Rebased missing_curl_resolve_on_el6 test patch
e266e15
- Added reload option to systemd service file and sysv initrc script
e266e15
- Changed the default cipher to "PROFILE=SYSTEM" on fedora
e266e15
fb5d7ab
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-2
fb5d7ab
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
fb5d7ab
8f2e073
* Thu Jan 28 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.1.1-1
8f2e073
- New upstream release
8f2e073
- Removed patches included upstream
8f2e073
- No need to rebuild the manpage, as the upstream distribution includes it
8f2e073
6577e73
* Mon Nov 23 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.1.0-1
6577e73
- New upstream release
6577e73
- Use the _pkgdocdir macro to avoid docdir hacks for el6
6577e73
- Added a patch from upstream that sets stronger ciphers as default
6577e73
1a41ea0
* Thu Oct 15 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.1-1
1a41ea0
- New upstream release
1a41ea0
- New Home and Source0 URLs
1a41ea0
- Rebased patches
1a41ea0
- Changed initrc and systemd start up scripts to match new binary name
1a41ea0
cfbd8e5
* Tue Aug 04 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.5.1.beta5
cfbd8e5
- New upstream beta
cfbd8e5
- Dropped patch3 and patch5, they are fixed in upstream
cfbd8e5
- Rebased patch for curl on el6
cfbd8e5
- hitch no longer autocreates the default config, so use the provided example
cfbd8e5
cdfd9fa
* Tue Aug 04 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.4.3.beta4
b325d36
- Much simpler patch for github issue #37
b325d36
b3fb299
* Mon Aug 03 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.4.2.beta4
b3fb299
- Patching around upstream github issue #37
b3fb299
7faa896
* Mon Aug 03 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.4.1.beta4
7faa896
- New upstream beta
7faa896
- Dropped setgroups patch as it has been accepted upstream
7faa896
- Simple sed replace nobody for nogroup in test08
7faa896
0895aa4
* Sun Jul 19 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.3.4.beta3
0895aa4
- Some more fixes for the fedora package review, ref Cicku
0895aa4
0895aa4
* Thu Jul 16 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.3.3.beta3
0895aa4
- Some more fixes for the fedora package review, ref Jeff Backus
0895aa4
0895aa4
* Fri Jun 26 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.3.2.beta3
0895aa4
- Added _hardened_build macro and PIE on el6
0895aa4
0895aa4
* Thu Jun 25 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.3.1.beta3
0895aa4
- Some fixes for the fedora package review, ref Sören Möller
0895aa4
- Now runs the test suite in check, adding BuildRequire openssl
0895aa4
- Added a patch that fixed missing cleaning running daemons from test suite
0895aa4
- Added a patch that made test07 run on older curl (epel6)
0895aa4
- Package owns /etc/hitch
0895aa4
- Added pidfile to systemd and tmpfiles.d configuration
0895aa4
- Added pidfile to redhat sysv init script
0895aa4
0895aa4
* Wed Jun 10 2015 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.0.0-0.3.beta3
0895aa4
- Initial wrap for fedora
0895aa4