tor.spec 4.8 KB

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