3 %bcond_with tests # run tests. needs internet connection
5 Summary: Network proxy that terminates TLS/SSL connections
11 Source0: https://hitch-tls.org/source/%{name}-%{version}.tar.gz
12 # Source0-md5: f8b916e8739f55432ec8af5146e522ed
13 Patch0: %{name}.systemd.service.patch
14 Patch1: %{name}.initrc.redhat.patch
15 Patch3: %{name}-1.0.1_tests_nobody_group.patch
16 Patch4: %{name}.test07_missing_curl_resolve_on_el6.patch
17 Patch5: %{name}-1.1.0_stronger_ciphers.e7be033.patch
18 URL: https://hitch-tls.org/
19 BuildRequires: libev-devel >= 4
20 BuildRequires: libtool
21 BuildRequires: openssl
22 BuildRequires: openssl-devel >= 1.0.0
23 BuildRequires: rpmbuild(macros) >= 1.647
24 Requires(post,preun): /sbin/chkconfig
25 Requires(post,preun,postun): systemd-units >= 38
27 Requires: systemd-units >= 0.38
28 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30 %define hitch_user hitch
31 %define hitch_group hitch
32 %define hitch_homedir %{_localstatedir}/lib/hitch
33 %define hitch_confdir %{_sysconfdir}/%{name}
34 %define hitch_datadir %{_datadir}/hitch
37 hitch is a network proxy that terminates TLS/SSL connections and
38 forwards the unencrypted traffic to some backend. It is designed to
39 handle 10s of thousands of connections efficiently on multicore
51 CFLAGS="%{rpmcflags} -fPIE"
53 CPPFLAGS="-I%{_includedir}/libev"
63 rm -rf $RPM_BUILD_ROOT
65 DESTDIR=$RPM_BUILD_ROOT
67 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
70 s/user = ""/user = "%{hitch_user}"/g;
71 s/group = ""/group = "%{hitch_group}"/g;
72 s/backend = "\[127.0.0.1\]:8000"/backend = "[127.0.0.1]:6081"/g;
73 s/syslog = off/syslog = on/g;
74 ' hitch.conf.ex > hitch.conf
75 sed -i 's/daemon = off/daemon = on/g;' hitch.conf
77 install -p -D hitch.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/hitch.conf
78 install -d $RPM_BUILD_ROOT%{hitch_homedir}
79 install -d $RPM_BUILD_ROOT%{hitch_datadir}
80 install -p -D hitch.service $RPM_BUILD_ROOT%{systemdunitdir}/hitch.service
81 install -p -D hitch.tmpfilesd.conf $RPM_BUILD_ROOT%{systemdtmpfilesdir}/hitch.conf
82 install -p -D hitch.initrc.redhat $RPM_BUILD_ROOT%{_initrddir}/hitch
83 install -d $RPM_BUILD_ROOT%{_localstatedir}/run/hitch
84 touch $RPM_BUILD_ROOT%{_localstatedir}/run/hitch/hitch.pid
87 rm -rf $RPM_BUILD_ROOT
90 # TODO: register uid/gid
92 %groupadd -r %{hitch_group}
93 %useradd -r -g %{hitch_group} -s /sbin/nologin -d %{hitch_homedir} %{hitch_user}
97 %systemd_post hitch.service
98 %tmpfiles_create %{systemdtmpfilesdir}/hitch.conf
99 /sbin/chkconfig --add hitch
100 %service hitch restart
103 %systemd_preun hitch.service
105 /sbin/chkconfig --del hitch
108 %systemd_postun_with_restart hitch.service
111 %defattr(644,root,root,755)
112 %doc README.md LICENSE CHANGES.rst hitch.conf.ex
113 %dir %{_sysconfdir}/%{name}
114 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/hitch.conf
115 %attr(754,root,root) /etc/rc.d/init.d/hitch
116 %attr(755,root,root) %{_sbindir}/hitch
117 %{_mandir}/man8/hitch.8*
118 %{systemdunitdir}/hitch.service
119 %{systemdtmpfilesdir}/hitch.conf
120 %define no_install_post_check_tmpfiles 1
121 %attr(755,hitch,hitch) %dir %{_localstatedir}/run/hitch
122 %attr(644,hitch,hitch) %ghost %verify(not md5 mtime size) %{_localstatedir}/run/hitch/hitch.pid