1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
8 SDESC[std]= Anonymizing overlay network for TCP
9 HOMEPAGE= https://www.torproject.org/
14 DISTFILE[1]= tor-0.4.7.16.tar.gz:main
21 OPTIONS_AVAILABLE= none
22 OPTIONS_STANDARD= none
24 BUILD_DEPENDS= asciidoc:single:std
27 BUILDRUN_DEPENDS= libevent:primary:std
32 USERGROUP_SPKG= primary
34 USES= cpe gmake pkgconfig ssl zlib zstd xz cclibs:primary
36 LICENSE= BSD3CLAUSE:primary
37 LICENSE_FILE= BSD3CLAUSE:{{WRKSRC}}/LICENSE
40 CPE_VENDOR= torproject
41 FPC_EQUIVALENT= security/tor
44 CONFIGURE_ARGS= --with-openssl-dir="{{OPENSSLBASE}}"
45 --enable-linker-hardening
50 CONFIGURE_ENV= TOR_CPPFLAGS_libevent="-I{{LOCALBASE}}/include"
51 TOR_LDFLAGS_libevent="-L{{LOCALBASE}}/lib/"
52 TOR_LIBEVENT_LIBS="-levent"
53 tor_cv_cflags__Wextra_semi=no
55 PLIST_SUB= USER="{{USERS}}"
58 SUB_LIST= USER="{{USERS}}"
62 ${REINPLACE_CMD} -E -e "s@(-z) (relro|now)@-Wl,\1,\2@g" \
64 ${REINPLACE_CMD} -e 's|lib/tor|db/tor|' \
65 ${WRKSRC}/src/config/torrc.*.in \
66 ${WRKSRC}/doc/man/tor.1.* \
67 ${WRKSRC}/doc/man/tor.html.in
68 ${REINPLACE_CMD} -e '/SOURCE_DATE_EPOCH/d' ${WRKSRC}/doc/asciidoc-helper.sh
69 ${REINPLACE_CMD} -e "s@-ltcmalloc@${LOCALBASE}/lib/libtcmalloc.so@" \
73 ${MKDIR} ${STAGEDIR}/var/log/tor \
74 ${STAGEDIR}/var/run/tor \
75 ${STAGEDIR}/var/db/tor
77 [FILE:547:descriptions/desc.primary]
78 Tor: an anonymizing overlay network for TCP
80 Tor is a connection-based low-latency anonymous communication system which
81 addresses many flaws in the original onion routing design.
83 Tor is a toolset for a wide range of organizations and people that want to
84 improve their safety and security on the Internet. Using Tor can help you
85 anonymize web browsing and publishing, instant messaging, IRC, SSH, and
86 more. Tor also provides a platform on which software developers can build
87 new applications with built-in anonymity, safety, and privacy features.
91 5aeeb071bd5c12eb2eec140a87f94052ecaeb03b5e1cee7d1e5cf1a3cbee7a7c 8120424 tor-0.4.7.16.tar.gz
94 [FILE:238:manifests/plist.primary]
95 @sample etc/tor/torrc.sample
98 tor-print-ed-signing-cert
104 @dir(%%USER%%,%%GROUP%%,700) /var/db/tor
105 @dir(%%USER%%,%%GROUP%%,700) /var/log/tor
106 @dir(%%USER%%,%%GROUP%%,700) /var/run/tor
109 [FILE:106:manifests/plist.docs]
112 tor-print-ed-signing-cert.html
118 [FILE:92:manifests/plist.man]
121 tor-print-ed-signing-cert.1
127 [FILE:4107:files/tor.in]
131 # REQUIRE: DAEMON FILESYSTEMS
134 # Add the following lines to /etc/rc.conf to enable tor.
135 # All these options will overide any settings in your local torrc as
136 # they are command line options.
138 # tor_enable (bool): Set it to "YES" to enable tor. Default: NO
139 # tor_instances (str): List of instances. Default: ""
140 # tor_conf (str): Points to your torrc file.
141 # Default: %%PREFIX%%/etc/tor/torrc
142 # tor_user (str): Tor daemon user. Default: %%USER%%
143 # tor_group (str): Tor group. Default: %%GROUP%%
144 # tor_pidfile (str): Tor pid file. Default: /var/run/tor/tor.pid
145 # tor_datadir (str): Tor datadir. Default: /var/db/tor
146 # tor_disable_default_instance (str): Doesn't run the default instance.
147 # Only valid when tor_instances is used.
149 # tor_setuid (str): Runtime setuid. Default: NO
151 # The instance definition that tor_instances expects:
152 # inst_name{:inst_conf:inst_user:inst_group:inst_pidfile:inst_data_dir}
161 load_rc_config ${name}
164 : ${tor_instances=""}
165 : ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
166 : ${tor_user="%%USER%%"}
167 : ${tor_group="%%GROUP%%"}
168 : ${tor_pidfile="/var/run/tor/tor.pid"}
169 : ${tor_datadir="/var/db/tor"}
170 : ${tor_disable_default_instance="NO"}
173 instance=${slave_instance}
174 if [ -n "${instance}" ]; then
176 inst_name=${inst_def%%:*}
177 [ "${inst_name}" != "main" ] || err 1 "${name} instance can't be named 'main'"
178 inst_def=${inst_def#$inst_name}
179 if [ -n "$inst_def" ]; then
180 # extended instance: parameters are set explicitly
181 inst_def=${inst_def#:}
182 tor_conf=${inst_def%%:*}
183 inst_def=${inst_def#$tor_conf:}
184 tor_user=${inst_def%%:*}
185 inst_def=${inst_def#$tor_user:}
186 tor_group=${inst_def%%:*}
187 inst_def=${inst_def#$tor_group:}
188 tor_pidfile=${inst_def%%:*}
189 tor_datadir=${inst_def#$tor_pidfile:}
190 if [ -z "${tor_conf}" -o -z "${tor_user}" -o -z "${tor_group}" -o -z "${tor_pidfile}" -o -z "${tor_datadir}" ]; then
191 warn "invalid tor instance ${inst_name} settings: ${instance}"
195 # regular instance: default parameters are used
196 tor_conf=${tor_conf}@${inst_name}
197 tor_pidfile=${tor_pidfile}@${inst_name}
198 tor_datadir=${tor_datadir}/instance@${inst_name}
200 if ! [ -r ${tor_conf} ]; then
201 warn "tor instance ${inst_name} config file ${tor_conf} doesn't exist or isn't readable"
202 warn "you can copy the sample config %%PREFIX%%/etc/tor/torrc.sample and modify it"
205 if ! [ -d ${tor_datadir} ]; then
206 mkdir -p ${tor_datadir} &&
207 chown ${tor_user}:${tor_group} ${tor_datadir} &&
208 chmod 0700 ${tor_datadir} &&
209 echo "${name}: created the instance data directory ${tor_datadir}"
213 if [ -z "${instance}" -a -n "${tor_instances}" ]; then
216 for i in ${tor_instances}; do
218 if [ -z "${inst_only}" -o "${inst_name}" = "${inst_only}" ]; then
219 echo -n "${name} instance ${inst_name}: "
220 if ! slave_instance=${i} %%PREFIX%%/etc/rc.d/tor "$1"; then
223 inst_done=$((inst_done+1))
226 if [ -z "${inst_only}" -o "${inst_only}" = "main" ]; then
227 checkyesno tor_disable_default_instance && return $exit_code
228 echo -n "${name} main instance: "
229 elif [ -n "${inst_only}" ]; then
230 [ $inst_done -gt 0 ] || err 1 "${name} instance '$inst_only' isn't defined"
235 required_files=${tor_conf}
236 required_dirs=${tor_datadir}
237 pidfile=${tor_pidfile}
238 command="%%PREFIX%%/bin/${name}"
239 command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir}"
240 extra_commands="reload"
242 if [ $tor_setuid = "YES" ]; then
243 if ! grep -q "^User ${tor_user}$" ${tor_conf}; then
244 echo "User ${tor_user}" >> ${tor_conf}
249 if grep -q "^User ${tor_user}$" ${tor_conf}; then
250 sed -i '' -e "s/^User ${tor_user}$//" ${tor_conf}
254 if ! run_rc_command "$1"; then