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