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