tor/tor.spec
2023-10-06 22:03:43 +00:00

129 lines
4.3 KiB
RPMSpec

%define runuser toruser
Summary: Anonymizing overlay network for TCP (The onion router)
Name: tor
Version: 0.4.8.7
Release: 1
License: BSD
Group: Networking/Other
URL: https://www.torproject.org
Source0: https://dist.torproject.org/%{name}-%{version}.tar.gz
Source1: %{name}.logrotate
Source3: %{name}.sysconfig
Source4: %{name}.service
Source5: %{name}-tmpfiles.conf
Source100: %{name}.rpmlintrc
# see https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/398
Patch0: %{name}-fix-build.patch
BuildRequires: autoconf2.5
BuildRequires: ghostscript
BuildRequires: pkgconfig(libevent)
#BuildRequires: pkgconfig(openssl)
BuildRequires: openssl-devel
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(systemd)
#BuildRequires: pkgconfig(libsystemd-daemon)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libzstd)
Buildrequires: pkgconfig(nss)
Requires: openssl
Requires: tsocks
Requires(pre,post,preun,postun): rpm-helper
Requires(post): systemd
%description
Tor is a connection-based low-latency anonymous communication system.
This package provides the "tor" program, which serves as both a client and
a relay node. Scripts will automatically create a "%{runuser}" user and
group, and set tor up to run as a daemon when the system is rebooted.
Applications connect to the local Tor proxy using the SOCKS
protocol. The local proxy chooses a path through a set of relays, in
which each relay knows its predecessor and successor, but no
others. Traffic flowing down the circuit is unwrapped by a symmetric
key at each relay, which reveals the downstream relay.
Warnings: Tor does no protocol cleaning. That means there is a danger
that application protocols and associated programs can be induced to
reveal information about the initiator. Tor depends on Privoxy and
similar protocol cleaners to solve this problem. This is alpha code,
and is even more likely than released code to have anonymity-spoiling
bugs. The present network is very small -- this further reduces the
strength of the anonymity provided. Tor is not presently suitable
for high-stakes anonymity.
%files
%doc ReleaseNotes INSTALL LICENSE README* ChangeLog doc/HACKING
%{_mandir}/man*/*
%{_bindir}/tor
%{_bindir}/torify
%{_bindir}/tor-resolve
#{_bindir}/tor-gencert
%{_bindir}/tor-print-ed-signing-cert
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755,root,%{runuser}) %{_sysconfdir}/%{name}/
%config(noreplace) %attr(0644,root,%{runuser}) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%attr(0700,%{runuser},%{runuser}) %dir %{_localstatedir}/lib/%{name}
%attr(0750,%{runuser},%{runuser}) %dir %{_var}/%{name}
%attr(0750,%{runuser},%{runuser}) %dir %{_var}/log/%{name}
%{_sysconfdir}/bash_completion.d/%{name}
%{_datadir}/%{name}
%pre
%_pre_useradd %{runuser} / /bin/false
%post
%tmpfiles_create %{name}
%_post_service %{name}
%preun
%_preun_service %{name}
rm -f %{_localstatedir}/%{name}/cached-directory
rm -f %{_localstatedir}/%{name}/bw_accounting
rm -f %{_localstatedir}/%{name}/control_auth_cookie
rm -f %{_localstatedir}/%{name}/router.desc
rm -f %{_localstatedir}/%{name}/fingerprint
%postun
%_postun_userdel %{runuser}
%_postun_groupdel %{runuser}
#----------------------------------------------------------------------------
%prep
%setup -q
#patch0 -p0
%build
%configure2_5x --enable-systemd \
--enable-lzma \
--enable-zstd \
--enable-nss
%make
%install
%makeinstall
install -p -m 644 %{buildroot}%{_sysconfdir}/%{name}/torrc.sample %{buildroot}%{_sysconfdir}/%{name}/torrc
mkdir -p -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
cat %{SOURCE1} > %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
mkdir -p -m 755 %{buildroot}%{_sysconfdir}/sysconfig/
cat %{SOURCE3} > %{buildroot}%{_sysconfdir}/sysconfig/%{name}
mkdir -p -m 700 %{buildroot}%{_localstatedir}/lib/%{name}
mkdir -p -m 755 %{buildroot}%{_var}/%{name}
mkdir -p -m 755 %{buildroot}%{_var}/log/%{name}
# Bash completion
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
echo 'complete -F _command $filenames torify' > %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}
# Systemd support
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}.service
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf