tor.spec 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # TODO:
  2. # Add /etc/logrotate.d/tor
  3. #
  4. %define blddate %(date -u +"%Y%m%d%H%M")
  5. %define version 0.0.7
  6. %define version_extra rc2
  7. %define vepoch 0.1
  8. %define tor_version %{version}%{version_extra}
  9. # not quite right XXXXX
  10. %define release 0.std.%{vepoch}.%{version_extra}
  11. Name: tor
  12. Version: %{version}
  13. Release: %{release}
  14. Summary: Anonymizing overlay network for TCP
  15. Vendor: R. Dingledine <arma@seul.org>
  16. Packager: Nick Mathewson <nickm@seul.org>
  17. License: BSD-like
  18. Group: Applications/Internet
  19. URL: http://freehaven.net/tor/
  20. Source0: http://freehaven.net/tor/dist/tor-%{tor_version}.tar.gz
  21. Requires: openssl >= 0.9.6
  22. BuildRequires: openssl-devel >= 0.9.6
  23. Requires(pre): shadow-utils, /usr/bin/id, /bin/date, /bin/sh
  24. Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
  25. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
  26. %description
  27. Tor is a connection-based low-latency anonymous communication system which
  28. addresses many flaws in the original onion routing design.
  29. In brief, Onion Routing is a connection-oriented anonymizing communication
  30. service. Users choose a source-routed path through a set of nodes, and
  31. negotiate a "virtual circuit" through the network, in which each node
  32. knows its predecessor and successor, but no others. Traffic flowing down
  33. the circuit is unwrapped by a symmetric key at each node, which reveals
  34. the downstream node.
  35. Basically Tor provides a distributed network of servers ("onion
  36. routers"). Users bounce their tcp streams (web traffic, ftp, ssh, etc)
  37. around the routers, and recipients, observers, and even the routers
  38. themselves have difficulty tracking the source of the stream.
  39. Note that Tor does no protocol cleaning. That means there is a danger that
  40. application protocols and associated programs can be induced to reveal
  41. information about the initiator. Tor depends on Privoxy and similar protocol
  42. cleaners to solve this problem.
  43. Client applications can use the Tor network by connecting to the local
  44. onion proxy. If the application itself does not come with socks support
  45. you can use a socks client such as tsocks. Some web browsers like mozilla
  46. and web proxies like privoxy come with socks support, so you don't need an
  47. extra socks client if you want to use Tor with them.
  48. Remember that this is alpha code, and the network is very small -- Tor will
  49. not provide anonymity currently.
  50. This package provides the "tor" program, which serves as both a client
  51. and a relay node. Scripts will automatically create a "tor" user and
  52. group, set tor up to run as a daemon, and automatically start it at
  53. installation time.
  54. %prep
  55. %setup -q -n tor-%{tor_version}
  56. # Patch the startup script to use the right user and group IDs. Force
  57. # the use of /bin/sh as the shell for the "tor" account.
  58. ed -s contrib/tor.sh.in << '/EOF/' > /dev/null
  59. ,s/^TORUSER=$/TORUSER=tor/
  60. ,s/^TORGROUP=$/TORGROUP=tor/
  61. ,s:/bin/su:/bin/su -s /bin/sh:
  62. #
  63. # Save and exit ed
  64. w
  65. q
  66. /EOF/
  67. %build
  68. %configure
  69. %__make
  70. %install
  71. %makeinstall
  72. # Install init script.
  73. %__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir}
  74. %__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/tor
  75. # Directories that don't have any preinstalled files
  76. %__mkdir_p -m 700 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tor
  77. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/run/tor
  78. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/tor
  79. %clean
  80. [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  81. %pre
  82. [ -f %{_initrddir}/tor ] && /sbin/service tor stop
  83. if [ ! -n "`/usr/bin/id -g tor 2>/dev/null`" ]; then
  84. # One would like to default the GID, but doing that properly would
  85. # require thought.
  86. %{_sbindir}/groupadd tor 2> /dev/null
  87. fi
  88. if [ ! -n "`/usr/bin/id -u tor 2>/dev/null`" ]; then
  89. # One would also like to default the UID, but doing that properly would
  90. # also require thought.
  91. if [ -x /sbin/nologin ]; then
  92. %{_sbindir}/useradd -r -g tor -d / -s /sbin/nologin tor 2> /dev/null
  93. else
  94. %{_sbindir}/useradd -r -g tor -d / -s /bin/false tor 2> /dev/null
  95. fi
  96. fi
  97. %post
  98. /sbin/chkconfig --add tor
  99. /sbin/chkconfig tor && /sbin/service tor start
  100. %preun
  101. /sbin/chkconfig tor && /sbin/service tor stop
  102. /sbin/chkconfig --del tor
  103. %files
  104. %defattr(-,root,root)
  105. %doc AUTHORS INSTALL LICENSE README ChangeLog doc/HACKING doc/TODO doc/FAQ
  106. #%{_mandir}/man1/tor.1.gz
  107. #%{_mandir}/man1/torify.1.gz
  108. %{_mandir}/man*/*
  109. %{_bindir}/tor
  110. %{_bindir}/torify
  111. %config %{_initrddir}/tor
  112. %dir %{_sysconfdir}/tor/
  113. %config(noreplace) %{_sysconfdir}/tor/torrc.sample
  114. %config(noreplace) %{_sysconfdir}/tor/dirservers
  115. %config(noreplace) %{_sysconfdir}/tor/tor-tsocks.conf
  116. %attr(0700,tor,tor) %dir %{_localstatedir}/lib/tor
  117. %attr(0755,tor,tor) %dir %{_localstatedir}/run/tor
  118. %attr(0755,tor,tor) %dir %{_localstatedir}/log/tor
  119. %changelog
  120. * Mon Jun 06 2004 Nick Mathewson <nickm@freehaven.net> 0.0.7-0.std.0.1.rc2
  121. - Make spec file more happy with fc2 packaging
  122. * Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
  123. - Basic spec file; tested with Red Hat 9.