## NOTE: tor.spec is autogenerated from tor.spec.in . Edit the latter, ## not the former. ## Things that need to be edited frequently # # This should be incremented whenever the spec file changes, but # can drop back to zero at a new Tor version %define specver 1 ## Things users may want to change # # User (and group) name under which the Tor daemon runs. %define toruser @TORUSER@ %define torgroup @TORGROUP@ ## Version song and dance # # This should be the Tor version number, as it appears on the tarball, # including any "pre" or "rc" suffix. This gets massaged to # create the RPM version number, in a way that depends on the Tor # numbering scheme. %define native_version @VERSION@ %define version %(echo %{native_version} | sed -e 's/-/./g') ## Define output filename # # This creates filenames based upon the value of target_cpu defined above ## Release and OS identification song and dance # # This identifies the lineage of the spec file. This file is the # standard one that comes with Tor; various distributions may # have their own ideas about the right ways to do things. %define pkgspec tor # This spec is intended to build and install on multiple distributions # (someday). Detect the distribution we're building on. %define is_rh %(test -e /etc/redhat-release && echo 1 || echo 0) %define is_fc %(test -e /etc/fedora-release && echo 1 || echo 0) %define is_mdk %(test -e /etc/mandrake-release && echo 1 || echo 0) %define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0) %define is_rfl %(test -e /etc/redflag-release && echo 1 || echo 0) %if %{is_fc} %define ostag %(sed -e 's/^.*release /fc/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/fedora-release) %endif %if %{is_rh} %define ostag %(sed -e 's/^.*release /rh/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/redhat-release) %endif %if %{is_mdk} %define ostag mdk %endif %if %{is_suse} %define ostag suse%(grep openSUSE /etc/SuSE-release | awk '{print $2}' | sed -e 's/\\./_/') %endif %if %{is_rfl} %define ostag %(sed -e 's/^.*Desktop /redflag/' -e 's/ .*$//' -e 's/\\./_/g' < /etc/redflag-release) %endif # Using the build date ensures that every build really does get # a different release number. We use this trick for CVS versions. # For release versions, we don't want or need it. %define is_dev_version %(echo %{native_version} | grep 'dev' > /dev/null && echo 1 || echo 0) %if %{is_dev_version} %define blddate %(date -u +"%Y%m%d%H%M") %define release %{pkgspec}.%{specver}.%{ostag}.%{blddate} %else %define release %{pkgspec}.%{specver}.%{ostag} %endif ## General-purpose macros # # Some systems don't have some macros. If a macro doesn't seem # to exist on your system, add it here... %if %{!?__make:1}%{?__make:0} %define __make make %endif %if %{!?make:1}%{?make:0} %define make %{__make} %endif %if %{!?_localstatedir:1}%{?_localstatedir:0} %define _localstatedir @LOCALSTATEDIR@ %endif ## Package information # Name: tor Version: %{version} Release: %{release} Summary: Anonymizing overlay network for TCP (The onion router) URL: https://www.torproject.org/ Group: System Environment/Daemons License: 3-clause BSD Vendor: The Tor Project (https://torproject.org) Packager: Ondrej Mikle Requires: openssl >= 0.9.8, libevent >= 1.4.13 BuildRequires: openssl-devel >= 0.9.8, libevent-devel >= 1.4.13, asciidoc # Fedora 16 and RHEL 5 have following conflicting packages according to rpm search %if %{is_rh} Conflicts: tor-core, tor-lsb, tor-upstart %endif Requires(pre): /usr/bin/id, /bin/date, /bin/sh Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd Source0: https://www.torproject.org/dist/%{name}-%{native_version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description Tor is a connection-based low-latency anonymous communication system. Clients choose a source-routed path through a set of relays, and negotiate a "virtual circuit" through the network, in which each relay knows its predecessor and successor, but no others. Traffic flowing down the circuit is decrypted at each relay, which reveals the downstream relay. Basically, Tor provides a distributed network of relays. Users bounce their TCP streams (web traffic, ftp, ssh, etc) around the relays, and recipients, observers, and even the relays themselves have difficulty learning which users connected to which destinations. This package enables only a Tor client by default, but it can also be configured as a relay and/or a hidden service easily. Client applications can use the Tor network by connecting to the local socks proxy interface provided by your Tor instance. If the application itself does not come with socks support, you can use a socks client such as torsocks. Note that Tor does no protocol cleaning on application traffic. There is a danger that application protocols and associated programs can be induced to reveal information about the user. Tor depends on Torbutton and similar protocol cleaners to solve this problem. For best protection when web surfing, the Tor Project recommends that you use the Tor Browser Bundle, a standalone tarball that includes static builds of Tor, Torbutton, and a modified Firefox that is patched to fix a variety of privacy bugs. %prep %setup -q -n %{name}-%{native_version} %build %if %{is_suse} %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} --docdir=%{_docdir}/%{name} %else %if 0%{?rhel} > 0 && 0%{?rhel} < 6 # workaround for https://trac.torproject.org/projects/tor/ticket/7975 %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} --disable-curve25519 %else %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} %endif %endif %make %{?_smp_mflags} %install %makeinstall # Install init script and control script %__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir} %if %{is_suse} %__install -p -m 755 contrib/suse/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name} %else %__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name} %endif %__install -p -m 755 contrib/torctl ${RPM_BUILD_ROOT}%{_bindir} # Set up config file; "sample" file implements a basic user node. %__install -p -m 644 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc.sample ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/torrc # Install the logrotate control file. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d %__install -p -m 644 contrib/tor.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} # Directories that don't have any preinstalled files %__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name} %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name} %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name} %__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/tmp/%{name} %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} # These scripts are probably wrong for Mandrake or SuSE. They're certainly # wrong for Debian, but what are you doing using RPM on Debian? %pre # If tor is already installed and running (whether installed by RPM # or not), then kill it, but remember that it was running. %__rm -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release} if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then /sbin/service %{name} stop touch /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release} fi # # Create a user and group if need be # if [ ! -n "`/usr/bin/id -g %{torgroup} 2>/dev/null`" ]; then # One would like to default the GID, but doing that properly would # require thought. %{_sbindir}/groupadd %{torgroup} 2> /dev/null fi if [ ! -n "`/usr/bin/id -u %{toruser} 2>/dev/null`" ]; then # One would also like to default the UID, but doing that properly would # also require thought. if [ -x %{_sbindir}/nologin ]; then %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null else %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev/null fi fi exit 0 %post # If this is a new installation, use chkconfig to put tor in the # default set of runlevels. If it's an upgrade, leave the existing # configuration alone. if [ $1 -eq 1 ]; then /sbin/chkconfig --add %{name} /sbin/chkconfig %{name} on fi # Older tor RPMS used a different username for the tor daemon. # Make sure the runtime data have the right ownership. %__chown -R %{toruser}.%{torgroup} %{_localstatedir}/{lib,log,run}/%{name} if [ -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release} ]; then /sbin/service %{name} start %__rm -f /%{_localstatedir}/tmp/${name}-was-running-%{version}-%{release} fi exit 0 %preun # If no instances of tor will be installed when we're done, make # sure that it gets killed. We *don't* want to kill it or delete # any of its data on uninstall if it's being upgraded to a new # version, because the new version will actually already have # been installed and started before the uninstall script for # the old version is run, and we'd end up hosing it. if [ $1 -le 0 ]; then if [ -f %{_initrddir}/%{name} ] && /sbin/service %{name} status ; then /sbin/service %{name} stop fi /sbin/chkconfig --del %{name} %__rm -f ${_localstatedir}/lib/%{name}/cached-directory %__rm -f ${_localstatedir}/lib/%{name}/bw_accounting %__rm -f ${_localstatedir}/lib/%{name}/control_auth_cookie %__rm -f ${_localstatedir}/lib/%{name}/router.desc %__rm -f ${_localstatedir}/lib/%{name}/fingerprint fi exit 0 %files %defattr(-,root,root) %if %{is_suse} %doc INSTALL LICENSE README ChangeLog doc/HACKING doc/*html %endif %doc INSTALL LICENSE README ChangeLog doc/HACKING %{_mandir}/man*/* %{_bindir}/tor %{_bindir}/torctl %{_bindir}/torify %{_bindir}/tor-resolve %{_bindir}/tor-gencert %if %{is_suse} %else %{_docdir}/* %endif %{_datadir}/tor/geoip %{_datadir}/tor/geoip6 %config %{_initrddir}/%{name} %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name} %dir %attr(0755,root,%{torgroup}) %{_sysconfdir}/%{name}/ %config(noreplace) %attr(0644,root,%{torgroup}) %{_sysconfdir}/%{name}/* %attr(0700,%{toruser},%{torgroup}) %dir %{_localstatedir}/lib/%{name} %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/run/%{name} %attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name} %changelog * Wed Feb 6 2013 Ondrej Mikle - Bump to upstream 0.2.4.10-alpha * Wed Jan 16 2013 Ondrej Mikle - Bump to upstream 0.2.4.9-alpha (includes 0.2.4.8-alpha merge) - Major bugfixes in 0.2.4.9-alpha: - Fix backward compatibility logic when receiving an embedded ntor handshake tunneled in a CREATE cell. This clears up the "Bug: couldn't format CREATED cell" warning. Fixes bug 7959; bugfix on 0.2.4.8-alpha. - Major features in 0.2.4.8-alpha: - Preliminary support for directory guards (proposal 207) - Tor now supports a new circuit extension handshake designed instead of original circuit extension handshake, later called "TAP". - Relays can now enable the ECDHE TLS ciphersuites when available and appropriate. - Major bugfixes in 0.2.4.8-alpha: - Avoid crashing when, as a relay without IPv6-exit support, a client insists on getting an IPv6 address or nothing. Fixes bug 7814; bugfix on 0.2.4.7-alpha. * Fri Dec 28 2012 Ondrej Mikle - Bump to upstream 0.2.4.7-alpha - Tor 0.2.4.7-alpha introduces a new approach to providing fallback directory mirrors for more robust bootstrapping; fixes more issues where clients with changing network conditions refuse to make any circuits; adds initial support for exiting to IPv6 addresses; resumes being able to update our GeoIP database, and includes the geoip6 file this time; turns off the client-side DNS cache by default due to privacy risks; and fixes a variety of other issues. - major features and bugfixes (see Changelog in /usr/share for details): - alpha exit support for IPv6 addresses - replacing geoip countries with pseudo country code 'A1' with real country code - turn off client-side DNS caching, DNS cache now configurable at per-client-port level - alter circuit build timeout measurement to start at the point where we begin the CREATE/CREATE_FAST step * Thu Dec 20 2012 Ondrej Mikle - Bump to upstream 0.2.4.6-alpha - Tor 0.2.4.6-alpha fixes an assert bug that has been plaguing relays, makes our defense-in-depth memory wiping more reliable, and begins to count IPv6 addresses in bridge statistics, - major bugfixes: - Fix an assertion failure that could occur when closing a connection with a spliced rendezvous circuit. Fix for bug 7212; bugfix on Tor 0.2.4.4-alpha. - Tor tries to wipe potentially sensitive data after using it, so that if some subsequent security failure exposes Tor's memory, the damage will be limited. But we had a bug where the compiler was eliminating these wipe operations when it decided that the memory was no longer visible to a (correctly running) program, hence defeating our attempt at defense in depth. We fix that by using OpenSSL's OPENSSL_cleanse() operation, which a compiler is unlikely to optimize away. Future versions of Tor may use a less ridiculously heavy approach for this. Fixes bug 7352. Reported in an article by Andrey Karpov. * Sat Oct 27 2012 Ondrej Mikle - Bump to upstream 0.2.4.5-alpha - major bugfixes (security): - Fix a group of remotely triggerable assertion failures related to incorrect link protocol negotiation. Found, diagnosed, and fixed by "some guy from France". Fix for CVE-2012-2250; bugfix on 0.2.3.6-alpha. - Fix a denial of service attack by which any directory authority could crash all the others, or by which a single v2 directory authority could crash everybody downloading v2 directory information. Fixes bug 7191; bugfix on 0.2.0.10-alpha. - major bugfixes: - When parsing exit policy summaries from microdescriptors, we had previously been ignoring the last character in each one, so that "accept 80,443,8080" would be treated by clients as indicating a node that allows access to ports 80, 443, and 808. That would lead to clients attempting connections that could never work, and ignoring exit nodes that would support their connections. Now clients parse these exit policy summaries correctly. Fixes bug 7192; bugfix on 0.2.3.1-alpha. * Mon Oct 22 2012 Ondrej Mikle - Bump to upstream 0.2.4.4-alpha - new directory authorities (also in 0.2.3.23-rc): - Add Faravahar (run by Sina Rabbani) as the ninth v3 directory authority. Closes ticket 5749. - major bugfixes (security/privacy, also in 0.2.3.23-rc): - Disable TLS session tickets. OpenSSL's implementation was giving our TLS session keys the lifetime of our TLS context objects, when perfect forward secrecy would want us to discard anything that could decrypt a link connection as soon as the link connection was closed. Fixes bug 7139; bugfix on all versions of Tor linked against OpenSSL 1.0.0 or later. Found by Florent Daignière. - Discard extraneous renegotiation attempts once the V3 link protocol has been initiated. Failure to do so left us open to a remotely triggerable assertion failure. Fixes CVE-2012-2249; bugfix on 0.2.3.6-alpha. Reported by "some guy from France". * Sat Sep 22 2012 Ondrej Mikle - Bump to upstream 0.2.4.3-alpha - Security fixes: - Fix an assertion failure in tor_timegm() that could be triggered by a badly formatted directory object. Bug found by fuzzing with Radamsa. Fixes bug 6811; bugfix on 0.2.0.20-rc. - Major bugfixes: - Fix a possible crash bug when checking for deactivated circuits in connection_or_flush_from_first_active_circuit(). Fixes bug 6341; bugfix on 0.2.2.7-alpha. Bug report and fix received pseudonymously. - Allow routers to detect that their own DirPorts are running. When we removed support for versions_supports_begindir, we also accidentally removed the mechanism we used to self-test our DirPort. Diagnosed with help from kargig. Fixes bugs 6814 and 6815; bugfix on 0.2.4.2-alpha. - Security features: - Switch to a completely time-invariant approach for picking nodes weighted by bandwidth. Our old approach would run through the part of the loop after it had made its choice slightly slower than it ran through the part of the loop before it had made its choice. Addresses ticket 6538. - Disable the use of Guard nodes when in Tor2WebMode. Guard usage by tor2web clients allows hidden services to identity tor2web clients through their repeated selection of the same rendezvous and introduction point circuit endpoints (their guards). Resolves ticket 6888. * Thu Jun 21 2012 Ondrej Mikle - fixed to work with both rpmbuild and mock on RHEL/Fedora - removed unnecessary files from rpm such as .git repo - fixed build dependencies and package conflicts - fixed creating _tor user on Fedora 17 (ancient typo) - added/updated build instructions for RPM creation - confirmed to build and run on EL5, EL6, Fedora 16/17, OpenSuse 12.1 * Fri Aug 20 2010 Erinn Clark - add conflicts for Fedora packages - add logic for SuSE since it requires special doc handling * Mon Feb 22 2010 Erinn Clark - remove AUTHORS from %doc line since it no longer exists upstream - switch maintainers * Fri May 01 2009 Andrew Lewman - clean up distro detection and remove dead comment blocks * Sun Feb 22 2009 Andrew Lewman - update the description, vendor, and packager * Thu Sep 11 2008 Andrew Lewman - See r16867 - http://archives.seul.org/or/cvs/Sep-2008/msg00156.html * Tue Feb 27 2007 Andrew Lewman - Fix a potential race condition in how we determine the running state of tor. Found by Stefan Nordhausen. - see OR-CVS for details * Fri May 26 2006 Andrew Lewman - Add in a few "SUSEisms" to make dist-rpm actually work on suse - Turn Tor "on" via chkconfig - Update -mcpu to -mtune to make GCC happy - see OR-CVS for details * Tue Mar 28 2006 Andrew Lewman - converted to build the specified target cpu and arch - override related rpm macros to build correctly - see OR-CVS for details * Mon Jan 17 2005 John Bashinski - Take runtime user and group names from configure system. Default user/group names are now "_tor"; blame Roger... - Make logrotate control file a separate file in the source distribution, rather than creating it from the spec file. - Properly handle the order in which RPM executes scriptlets on upgrade. The old code would kill the daemon on upgrade. - Start the tor daemon after installation if and only if it was running before installation. Preserve runlevel setup on upgrade. - Package the torctl script; the init script is now a wrapper around it. * Tue Nov 5 2004 John Bashinski - Add skeletal support for multiple distributions - Even more ridiculous level of macro-ization - Modify version numbers so RPM can determine when it has a newer version - Return to including distribution name in package release number - Sharply trim description - Change user/group name from "tor" to "tordmn"; "tor" is a common given name (reported by Marius Hjelle) - Change group to "System Environment/Daemons" (suggested by Marius Hjelle) - Create logrotate file (suggested by Marius Hjelle) - Make Tor run as a user proxy by default (suggested by Marius Hjelle) - Autogenerate spec file from GNU autotools data, substituting version and whatnot - Be perhaps excessively paranoid with config file and directory modes - Remove auto-start and auto-stop at installation time; there's some kind of weird race going on, and it's arguably a bad thing anyway. * Mon Jun 06 2004 Nick Mathewson 0.0.7-0.std.0.1.rc2 - Make spec file more happy with fc2 packaging * Sat Jan 17 2004 John Bashinski - Basic spec file; tested with Red Hat 9.