tor.spec.in 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. %define rellevel 2
  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: @VERSION@
  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-%{version}.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. Force
  50. # the use of /bin/sh as the shell for the "tor" account.
  51. ed -s contrib/tor.sh.in << '/EOF/' > /dev/null
  52. ,s/^TORUSER=$/TORUSER=tor/
  53. ,s/^TORGROUP=$/TORGROUP=tor/
  54. ,s:/bin/su:/bin/su -s /bin/sh:
  55. #
  56. # Save and exit ed
  57. w
  58. q
  59. /EOF/
  60. %build
  61. %configure
  62. %__make
  63. %install
  64. %makeinstall
  65. # Install init script.
  66. %__mkdir_p ${RPM_BUILD_ROOT}%{initdir}
  67. %__install -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{initdir}/tor
  68. # Directories that don't have any preinstalled files
  69. %__mkdir_p -m 700 ${RPM_BUILD_ROOT}/var/lib/tor
  70. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/run/tor
  71. %__mkdir_p -m 755 ${RPM_BUILD_ROOT}/var/log/tor
  72. %clean
  73. [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  74. %pre
  75. [ -f %{initdir}/tor ] && /sbin/service tor stop
  76. if [ ! -n "`/usr/bin/id -g tor 2>/dev/null`" ]; then
  77. # One would like to default the GID, but doing that properly would
  78. # require thought.
  79. %{_sbindir}/groupadd tor 2> /dev/null
  80. fi
  81. if [ ! -n "`/usr/bin/id -u tor 2>/dev/null`" ]; then
  82. # One would also like to default the UID, but doing that properly would
  83. # also require thought.
  84. if [ -x /sbin/nologin ]; then
  85. %{_sbindir}/useradd -r -g tor -d / -s /sbin/nologin tor 2> /dev/null
  86. else
  87. %{_sbindir}/useradd -r -g tor -d / -s /bin/false tor 2> /dev/null
  88. fi
  89. fi
  90. %post
  91. /sbin/chkconfig --add tor
  92. /sbin/chkconfig tor && /sbin/service tor start
  93. %preun
  94. /sbin/chkconfig tor && /sbin/service tor stop
  95. /sbin/chkconfig --del tor
  96. %files
  97. %defattr(-,root,root)
  98. %doc AUTHORS INSTALL LICENSE README
  99. %{_mandir}/man*/*
  100. %{_bindir}/tor
  101. %{_bindir}/torify
  102. %{initdir}/tor
  103. %dir %{_sysconfdir}/tor/
  104. %config(noreplace) %{_sysconfdir}/tor/torrc
  105. %config(noreplace) %{_sysconfdir}/tor/dirservers
  106. %config(noreplace) %{_sysconfdir}/tor/tor-tsocks.conf
  107. %attr(-,tor,tor) %dir /var/lib/tor
  108. %attr(-,tor,tor) %dir /var/run/tor
  109. %attr(-,tor,tor) %dir /var/log/tor
  110. %changelog
  111. * Sat Jan 17 2004 John Bashinski <jbash@velvet.com>
  112. - Basic spec file; tested with Red Hat 9.