View | Details | Raw Unified | Return to bug 207129 | Differences between
and this patch

Collapse All | Expand All

(-)security/tor/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	tor
4
PORTNAME=	tor
5
PORTVERSION=	0.2.8.9
5
PORTVERSION=	0.2.8.9
6
PORTREVISION=	1
6
CATEGORIES=	security net ipv6
7
CATEGORIES=	security net ipv6
7
MASTER_SITES=	TOR
8
MASTER_SITES=	TOR
8
9
(-)security/tor/files/pkg-message.in (+8 lines)
Lines 11-14 Link Here
11
sysctl net.inet.ip.random_id=1
11
sysctl net.inet.ip.random_id=1
12
12
13
(see sysctl.conf(5)).
13
(see sysctl.conf(5)).
14
15
In order to run additional, independent instances of tor on the same machine
16
set tor_instances="inst1 inst2 ..." in your /etc/rc.conf, and create the
17
corresponding additional configuration files %%PREFIX%%/etc/tor/torrc@inst1, ...
18
19
Alternatively, you can use the extended instance definition to specify all
20
instance parameteres explicitly:
21
inst_name{:inst_conf:inst_user:inst_group:inst_pidfile:inst_data_dir}
14
================================================================================
22
================================================================================
(-)security/tor/files/tor.in (-1 / +56 lines)
Lines 11-20 Link Here
11
# they are command line options.
11
# they are command line options.
12
#
12
#
13
# tor_enable (bool):	Set it to "YES" to enable tor. Default: NO
13
# tor_enable (bool):	Set it to "YES" to enable tor. Default: NO
14
# tor_instances (str):	Set it to "YES" to enable tor. Default: ""
14
# tor_conf (str):	Points to your torrc file.
15
# tor_conf (str):	Points to your torrc file.
15
#			Default: %%PREFIX%%/etc/tor/torrc
16
#			Default: %%PREFIX%%/etc/tor/torrc
16
# tor_user (str):	Tor daemon user. Default: _tor
17
# tor_user (str):	Tor daemon user. Default: %%USER%%
18
# tor_group (str):	Tor group. Default: %%GROUP%%
19
# tor_pidfile (str):	Tor pid file.  Default: /var/run/tor/tor.pid
17
# tor_datadir (str):	Tor datadir.  Default: /var/db/tor
20
# tor_datadir (str):	Tor datadir.  Default: /var/db/tor
21
# tor_disable_default_instance (str):	Doesn't run the default instance. Default: NO
18
#
22
#
19
23
20
. /etc/rc.subr
24
. /etc/rc.subr
Lines 25-35 Link Here
25
load_rc_config ${name}
29
load_rc_config ${name}
26
30
27
: ${tor_enable="NO"}
31
: ${tor_enable="NO"}
32
: ${tor_instances=""}
28
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
33
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
29
: ${tor_user="%%USER%%"}
34
: ${tor_user="%%USER%%"}
35
: ${tor_group="%%GROUP%%"}
30
: ${tor_pidfile="/var/run/tor/tor.pid"}
36
: ${tor_pidfile="/var/run/tor/tor.pid"}
31
: ${tor_datadir="/var/db/tor"}
37
: ${tor_datadir="/var/db/tor"}
38
: ${tor_disable_default_instance="NO"}
32
39
40
instance=${2}
41
if [ -n "${instance}" ]; then
42
  # extended instance definition: parameters are set explicitly
43
  # the instance definition: inst_name{:inst_conf:inst_user:inst_group:inst_pidfile:inst_data_dir}
44
  inst_def=${instance}
45
  inst_name=${inst_def%%:*}
46
  inst_def=${inst_def#$inst_name}
47
  if [ -n "$inst_def" ]; then
48
    inst_def=${inst_def#:}
49
    tor_conf=${inst_def%%:*}
50
    inst_def=${inst_def#$tor_conf:}
51
    tor_user=${inst_def%%:*}
52
    inst_def=${inst_def#$tor_user:}
53
    tor_group=${inst_def%%:*}
54
    inst_def=${inst_def#$tor_group:}
55
    tor_pidfile=${inst_def%%:*}
56
    inst_def=${inst_def#$tor_pidfile:}
57
    tor_datadir=${inst_def#$tor_pidfile:}
58
    if [ -z "${tor_conf}" -o -z "${tor_user}" -o -z "${tor_group}" -o -z "${tor_pidfile}" -o -z "${tor_datadir}" ]; then
59
      warn "invalid tor instance ${inst_name} settings"
60
      exit 1
61
    fi
62
  else
63
    # short instance definition: default parameters are used
64
    tor_conf=${tor_conf}@${inst_name}
65
    tor_pidfile=${tor_pidfile}@${inst_name}
66
    tor_datadir=${tor_datadir}/instance@${inst_name}
67
  fi
68
  if ! [ -r ${tor_conf} ]; then
69
    warn "tor instance ${inst_name} config file ${tor_conf} doesn't exist or isn't readable"
70
    warn "you can copy the sample config %%PREFIX%%/etc/tor/torrc.sample and modify it"
71
    exit 1
72
  fi
73
  if ! [ -d ${tor_datadir} ]; then
74
    mkdir -p ${tor_datadir} && \
75
    chown ${tor_user}:${tor_group} ${tor_datadir} && \
76
    chmod 0700 ${tor_datadir} && \
77
    echo "${name}: created the instance data directory ${tor_datadir}"
78
  fi
79
fi
80
81
if [ -z "${instance}" -a -n "${tor_instances}" ]; then
82
  for i in ${tor_instances}; do
83
    %%PREFIX%%/etc/rc.d/tor $1 ${i} || warn "$1 failed for the tor instance $i"
84
  done
85
  checkyesno tor_disable_default_instance && return 0
86
fi
87
33
required_files=${tor_conf}
88
required_files=${tor_conf}
34
required_dirs=${tor_datadir}
89
required_dirs=${tor_datadir}
35
pidfile=${tor_pidfile}
90
pidfile=${tor_pidfile}

Return to bug 207129