Ravenports generated: 16 Sep 2020 13:17
[ravenports.git] / bucket_A0 / tor
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               tor
4 VERSION=                0.4.4.5
5 KEYWORDS=               security net
6 VARIANTS=               standard
7 SDESC[standard]=        Anonymizing overlay network for TCP
8 HOMEPAGE=               https://www.torproject.org/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            TOR/
13 DISTFILE[1]=            tor-0.4.4.5.tar.gz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        complete
16                         primary
17                         docs
18
19 OPTIONS_AVAILABLE=      none
20 OPTIONS_STANDARD=       none
21
22 BUILD_DEPENDS=          asciidoc:single:standard
23                         Zstandard:static:standard
24 BUILDRUN_DEPENDS=       libevent:single:standard
25                         xz:single:standard
26                         Zstandard:shared:standard
27                         nss:primary:standard
28
29 USERS=                  _tor
30 GROUPS=                 _tor
31 USERGROUP_SPKG=         primary
32
33 USES=                   cpe gmake pkgconfig ssl zlib cclibs:primary
34
35 LICENSE=                BSD3CLAUSE:primary
36 LICENSE_FILE=           BSD3CLAUSE:{{WRKSRC}}/LICENSE
37 LICENSE_SCHEME=         solo
38
39 CPE_VENDOR=             torproject
40 FPC_EQUIVALENT=         security/tor
41
42 MUST_CONFIGURE=         gnu
43 CONFIGURE_ARGS=         --with-openssl-dir="{{OPENSSLBASE}}"
44                         --enable-linker-hardening
45                         --enable-zstd
46                         --enable-lzma
47                         --enable-nss
48                         --disable-systemd
49 CONFIGURE_ENV=          TOR_CPPFLAGS_libevent="-I{{LOCALBASE}}/include"
50                         TOR_LDFLAGS_libevent="-L{{LOCALBASE}}/lib/"
51                         TOR_LIBEVENT_LIBS="-levent"
52                         tor_cv_cflags__Wextra_semi=no
53
54 PLIST_SUB=              USER="{{USERS}}"
55                         GROUP="{{GROUPS}}"
56 RC_SUBR=                tor:primary
57 SUB_LIST=               USER="{{USERS}}"
58                         GROUP="{{GROUPS}}"
59
60 post-patch:
61         ${REINPLACE_CMD} -E -e "s@(-z) (relro|now)@-Wl,\1,\2@g" \
62                 ${WRKSRC}/configure
63         ${REINPLACE_CMD} -e 's|lib/tor|db/tor|' \
64                 ${WRKSRC}/src/config/torrc.*.in \
65                 ${WRKSRC}/doc/tor.1.* \
66                 ${WRKSRC}/doc/tor.html.in
67         ${REINPLACE_CMD} -e "s@-ltcmalloc@${LOCALBASE}/lib/libtcmalloc.so@" \
68                 ${WRKSRC}/configure
69
70 post-install:
71         @${MKDIR} ${STAGEDIR}/var/log/tor \
72                 ${STAGEDIR}/var/run/tor \
73                 ${STAGEDIR}/var/db/tor
74
75 [FILE:547:descriptions/desc.primary]
76 Tor: an anonymizing overlay network for TCP
77
78 Tor is a connection-based low-latency anonymous communication system which
79 addresses many flaws in the original onion routing design.
80
81 Tor is a toolset for a wide range of organizations and people that want to
82 improve their safety and security on the Internet. Using Tor can help you
83 anonymize web browsing and publishing, instant messaging, IRC, SSH, and
84 more. Tor also provides a platform on which software developers can build
85 new applications with built-in anonymity, safety, and privacy features.
86
87
88 [FILE:97:distinfo]
89 a45ca00afe765e3baa839767c9dd6ac9a46dd01720a3a8ff4d86558c12359926      7808696 tor-0.4.4.5.tar.gz
90
91
92 [FILE:345:manifests/plist.primary]
93 @sample etc/tor/torrc.sample
94 bin/
95  tor
96  tor-print-ed-signing-cert
97  tor-resolve
98  torify
99 share/man/man1/
100  tor-gencert.1.gz
101  tor-print-ed-signing-cert.1.gz
102  tor-resolve.1.gz
103  tor.1.gz
104  torify.1.gz
105 share/tor/
106  geoip
107  geoip6
108 @dir(%%USER%%,%%GROUP%%,700) /var/db/tor
109 @dir(%%USER%%,%%GROUP%%,700) /var/log/tor
110 @dir(%%USER%%,%%GROUP%%,700) /var/run/tor
111
112
113 [FILE:106:manifests/plist.docs]
114 share/doc/tor/
115  tor-gencert.html
116  tor-print-ed-signing-cert.html
117  tor-resolve.html
118  tor.html
119  torify.html
120
121
122 [FILE:4107:files/tor.in]
123 #!/bin/sh
124 #
125 # PROVIDE: tor
126 # REQUIRE: DAEMON FILESYSTEMS
127 # BEFORE: LOGIN
128 #
129 # Add the following lines to /etc/rc.conf to enable tor.
130 # All these options will overide any settings in your local torrc as
131 # they are command line options.
132 #
133 # tor_enable (bool):    Set it to "YES" to enable tor. Default: NO
134 # tor_instances (str):  List of instances. Default: ""
135 # tor_conf (str):       Points to your torrc file.
136 #                       Default: %%PREFIX%%/etc/tor/torrc
137 # tor_user (str):       Tor daemon user. Default: %%USER%%
138 # tor_group (str):      Tor group. Default: %%GROUP%%
139 # tor_pidfile (str):    Tor pid file.  Default: /var/run/tor/tor.pid
140 # tor_datadir (str):    Tor datadir.  Default: /var/db/tor
141 # tor_disable_default_instance (str):   Doesn't run the default instance.
142 #                       Only valid when tor_instances is used.
143 #                       Default: NO
144 # tor_setuid (str):     Runtime setuid.  Default: NO
145 #
146 # The instance definition that tor_instances expects:
147 # inst_name{:inst_conf:inst_user:inst_group:inst_pidfile:inst_data_dir}
148 #
149
150 . /etc/rc.subr
151
152 name="tor"
153 rcvar=tor_enable
154 exit_code=0
155
156 load_rc_config ${name}
157
158 : ${tor_enable="NO"}
159 : ${tor_instances=""}
160 : ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
161 : ${tor_user="%%USER%%"}
162 : ${tor_group="%%GROUP%%"}
163 : ${tor_pidfile="/var/run/tor/tor.pid"}
164 : ${tor_datadir="/var/db/tor"}
165 : ${tor_disable_default_instance="NO"}
166 : ${tor_setuid="NO"}
167
168 instance=${slave_instance}
169 if [ -n "${instance}" ]; then
170   inst_def=${instance}
171   inst_name=${inst_def%%:*}
172   [ "${inst_name}" != "main" ] || err 1 "${name} instance can't be named 'main'"
173   inst_def=${inst_def#$inst_name}
174   if [ -n "$inst_def" ]; then
175     # extended instance: parameters are set explicitly
176     inst_def=${inst_def#:}
177     tor_conf=${inst_def%%:*}
178     inst_def=${inst_def#$tor_conf:}
179     tor_user=${inst_def%%:*}
180     inst_def=${inst_def#$tor_user:}
181     tor_group=${inst_def%%:*}
182     inst_def=${inst_def#$tor_group:}
183     tor_pidfile=${inst_def%%:*}
184     tor_datadir=${inst_def#$tor_pidfile:}
185     if [ -z "${tor_conf}" -o -z "${tor_user}" -o -z "${tor_group}" -o -z "${tor_pidfile}" -o -z "${tor_datadir}" ]; then
186       warn "invalid tor instance ${inst_name} settings: ${instance}"
187       exit 1
188     fi
189   else
190     # regular instance: default parameters are used
191     tor_conf=${tor_conf}@${inst_name}
192     tor_pidfile=${tor_pidfile}@${inst_name}
193     tor_datadir=${tor_datadir}/instance@${inst_name}
194   fi
195   if ! [ -r ${tor_conf} ]; then
196     warn "tor instance ${inst_name} config file ${tor_conf} doesn't exist or isn't readable"
197     warn "you can copy the sample config %%PREFIX%%/etc/tor/torrc.sample and modify it"
198     exit 1
199   fi
200   if ! [ -d ${tor_datadir} ]; then
201     mkdir -p ${tor_datadir} &&
202     chown ${tor_user}:${tor_group} ${tor_datadir} &&
203     chmod 0700 ${tor_datadir} &&
204     echo "${name}: created the instance data directory ${tor_datadir}"
205   fi
206 fi
207
208 if [ -z "${instance}" -a -n "${tor_instances}" ]; then
209   inst_only="$2"
210   inst_done=0
211   for i in ${tor_instances}; do
212     inst_name=${i%%:*}
213     if [ -z "${inst_only}" -o "${inst_name}" = "${inst_only}" ]; then
214       echo -n "${name} instance ${inst_name}: "
215       if ! slave_instance=${i} %%PREFIX%%/etc/rc.d/tor "$1"; then
216         exit_code=1
217       fi
218       inst_done=$((inst_done+1))
219     fi
220   done
221   if [ -z "${inst_only}" -o "${inst_only}" = "main" ]; then
222     checkyesno tor_disable_default_instance && return $exit_code
223     echo -n "${name} main instance: "
224   elif [ -n "${inst_only}" ]; then
225     [ $inst_done -gt 0 ] || err 1 "${name} instance '$inst_only' isn't defined"
226     return  $exit_code
227   fi
228 fi
229
230 required_files=${tor_conf}
231 required_dirs=${tor_datadir}
232 pidfile=${tor_pidfile}
233 command="%%PREFIX%%/bin/${name}"
234 command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir}"
235 extra_commands="reload"
236
237 if [ $tor_setuid = "YES" ]; then
238   if ! grep -q "^User ${tor_user}$" ${tor_conf}; then
239     echo "User ${tor_user}" >> ${tor_conf}
240   fi
241   tor_user="root"
242   tor_group="wheel"
243 else
244   if grep -q "^User ${tor_user}$" ${tor_conf}; then
245     sed -i '' -e "s/^User ${tor_user}$//" ${tor_conf}
246   fi
247 fi
248
249 if ! run_rc_command "$1"; then
250   exit_code=1
251 fi
252
253 return $exit_code
254