View | Details | Raw Unified | Return to bug 219116
Collapse All | Expand All

(-)security/tor-devel/Makefile (-17 / +9 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	tor
4
PORTNAME=	tor
5
DISTVERSION=	0.3.0.6
5
PORTVERSION=	0.3.0.6
6
PORTREVISION=	1
6
CATEGORIES=	security net ipv6
7
CATEGORIES=	security net ipv6
7
MASTER_SITES=	TOR
8
MASTER_SITES=	TOR
8
PKGNAMESUFFIX=	-devel
9
PKGNAMESUFFIX=	-devel
Lines 27-44 Link Here
27
		TOR_LDFLAGS_libevent="-L${LOCALBASE}/lib/" \
28
		TOR_LDFLAGS_libevent="-L${LOCALBASE}/lib/" \
28
		TOR_LIBEVENT_LIBS="${TOR_LIBEVENT_LIBS}"
29
		TOR_LIBEVENT_LIBS="${TOR_LIBEVENT_LIBS}"
29
30
30
OPTIONS_DEFINE=	MANPAGES STATIC_TOR TCMALLOC TOR2WEB TRANSPARENT
31
OPTIONS_DEFINE=	MANPAGES DOCS STATIC_TOR TCMALLOC TOR2WEB
31
OPTIONS_SUB=	yes
32
OPTIONS_SUB=	yes
32
33
33
STATIC_TOR_DESC=	Build a static tor
34
STATIC_TOR_DESC=	Build a static tor
34
TCMALLOC_DESC=		Use the tcmalloc memory allocation library
35
TCMALLOC_DESC=		Use the tcmalloc memory allocation library
35
TOR2WEB_DESC=		(EXPERT OPTION) Faster but non-anonymous hidden services
36
TOR2WEB_DESC=		(EXPERT OPTION) Faster but non-anonymous hidden services
36
TRANSPARENT_DESC=	Transparent proxy support
37
37
38
OPTIONS_DEFAULT=	MANPAGES TRANSPARENT
38
OPTIONS_DEFAULT=	MANPAGES
39
39
40
USE_RC_SUBR=	tor
40
USE_RC_SUBR=	tor
41
SUB_FILES=	pkg-message
41
SUB_FILES=	pkg-message
42
SUB_LIST=	USER="${USERS}" GROUP="${GROUPS}"
43
PLIST_SUB=	USER="${USERS}" GROUP="${GROUPS}"
42
44
43
GROUPS=		_tor
45
GROUPS=		_tor
44
USERS=		_tor
46
USERS=		_tor
Lines 48-55 Link Here
48
STATIC_TOR_USES=	ssl:build
50
STATIC_TOR_USES=	ssl:build
49
STATIC_TOR_USES_OFF=	ssl
51
STATIC_TOR_USES_OFF=	ssl
50
52
51
MANPAGES_BUILD_DEPENDS=	asciidoc:textproc/asciidoc
53
DOCS_BUILD_DEPENDS=	asciidoc:textproc/asciidoc
52
MANPAGES_CONFIGURE_OFF=	--disable-asciidoc
54
DOCS_CONFIGURE_OFF=	--disable-asciidoc
53
55
54
.include <bsd.port.options.mk>
56
.include <bsd.port.options.mk>
55
57
Lines 84-95 Link Here
84
CONFIGURE_ARGS+=	--enable-tor2web-mode
86
CONFIGURE_ARGS+=	--enable-tor2web-mode
85
.endif
87
.endif
86
88
87
.if ${PORT_OPTIONS:MTRANSPARENT}
88
CONFIGURE_ARGS+=	--enable-transparent
89
.else
90
CONFIGURE_ARGS+=	--disable-transparent
91
.endif
92
93
pre-everything::
89
pre-everything::
94
.if ${PORT_OPTIONS:MTOR2WEB}
90
.if ${PORT_OPTIONS:MTOR2WEB}
95
	@${ECHO_MSG}
91
	@${ECHO_MSG}
Lines 116-127 Link Here
116
	@${REINPLACE_CMD} -e "s@-ltcmalloc@${LOCALBASE}/lib/libtcmalloc.a@" \
112
	@${REINPLACE_CMD} -e "s@-ltcmalloc@${LOCALBASE}/lib/libtcmalloc.a@" \
117
		${WRKSRC}/configure
113
		${WRKSRC}/configure
118
114
119
post-configure:
120
	@${REINPLACE_CMD} -e '\|^nodist_man1_MANS =|s|$$|$$(install_mans:=.1)|' \
121
		${WRKSRC}/Makefile
122
123
post-install:
115
post-install:
124
	@${MKDIR} ${STAGEDIR}/var/log/tor ${STAGEDIR}/var/run/tor
116
	@${MKDIR} ${STAGEDIR}/var/log/tor ${STAGEDIR}/var/run/tor ${STAGEDIR}/var/db/tor
125
117
126
.if ! ${PORT_OPTIONS:MTOR2WEB}
118
.if ! ${PORT_OPTIONS:MTOR2WEB}
127
check regression-test test: build
119
check regression-test test: build
(-)security/tor-devel/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-devel/files/tor.in (-3 / +81 lines)
Lines 11-35 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):	List of instances. 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.
22
#			Only valid when tor_instances is used.
23
#			Default: NO
18
#
24
#
25
# The instance definition that tor_instances expects:
26
# inst_name{:inst_conf:inst_user:inst_group:inst_pidfile:inst_data_dir}
27
#
19
28
20
. /etc/rc.subr
29
. /etc/rc.subr
21
30
22
name="tor"
31
name="tor"
23
rcvar=tor_enable
32
rcvar=tor_enable
33
exit_code=0
24
34
25
load_rc_config ${name}
35
load_rc_config ${name}
26
36
27
: ${tor_enable="NO"}
37
: ${tor_enable="NO"}
38
: ${tor_instances=""}
28
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
39
: ${tor_conf="%%PREFIX%%/etc/tor/torrc"}
29
: ${tor_user="_tor"}
40
: ${tor_user="%%USER%%"}
41
: ${tor_group="%%GROUP%%"}
30
: ${tor_pidfile="/var/run/tor/tor.pid"}
42
: ${tor_pidfile="/var/run/tor/tor.pid"}
31
: ${tor_datadir="/var/db/tor"}
43
: ${tor_datadir="/var/db/tor"}
44
: ${tor_disable_default_instance="NO"}
32
45
46
instance=${slave_instance}
47
if [ -n "${instance}" ]; then
48
  inst_def=${instance}
49
  inst_name=${inst_def%%:*}
50
  [ "${inst_name}" != "main" ] || err 1 "${name} instance can't be named 'main'"
51
  inst_def=${inst_def#$inst_name}
52
  if [ -n "$inst_def" ]; then
53
    # extended instance: parameters are set explicitly
54
    inst_def=${inst_def#:}
55
    tor_conf=${inst_def%%:*}
56
    inst_def=${inst_def#$tor_conf:}
57
    tor_user=${inst_def%%:*}
58
    inst_def=${inst_def#$tor_user:}
59
    tor_group=${inst_def%%:*}
60
    inst_def=${inst_def#$tor_group:}
61
    tor_pidfile=${inst_def%%:*}
62
    tor_datadir=${inst_def#$tor_pidfile:}
63
    if [ -z "${tor_conf}" -o -z "${tor_user}" -o -z "${tor_group}" -o -z "${tor_pidfile}" -o -z "${tor_datadir}" ]; then
64
      warn "invalid tor instance ${inst_name} settings: ${instance}"
65
      exit 1
66
    fi
67
  else
68
    # regular instance: default parameters are used
69
    tor_conf=${tor_conf}@${inst_name}
70
    tor_pidfile=${tor_pidfile}@${inst_name}
71
    tor_datadir=${tor_datadir}/instance@${inst_name}
72
  fi
73
  if ! [ -r ${tor_conf} ]; then
74
    warn "tor instance ${inst_name} config file ${tor_conf} doesn't exist or isn't readable"
75
    warn "you can copy the sample config %%PREFIX%%/etc/tor/torrc.sample and modify it"
76
    exit 1
77
  fi
78
  if ! [ -d ${tor_datadir} ]; then
79
    mkdir -p ${tor_datadir} &&
80
    chown ${tor_user}:${tor_group} ${tor_datadir} &&
81
    chmod 0700 ${tor_datadir} &&
82
    echo "${name}: created the instance data directory ${tor_datadir}"
83
  fi
84
fi
85
86
if [ -z "${instance}" -a -n "${tor_instances}" ]; then
87
  inst_only="$2"
88
  inst_done=0
89
  for i in ${tor_instances}; do
90
    inst_name=${i%%:*}
91
    if [ -z "${inst_only}" -o "${inst_name}" = "${inst_only}" ]; then
92
      echo -n "${name} instance ${inst_name}: "
93
      if ! slave_instance=${i} %%PREFIX%%/etc/rc.d/tor "$1"; then
94
        exit_code=1
95
      fi
96
      inst_done=$((inst_done+1))
97
    fi
98
  done
99
  if [ -z "${inst_only}" -o "${inst_only}" = "main" ]; then
100
    checkyesno tor_disable_default_instance && return $exit_code
101
    echo -n "${name} main instance: "
102
  elif [ -n "${inst_only}" ]; then
103
    [ $inst_done -gt 0 ] || err 1 "${name} instance '$inst_only' isn't defined"
104
    return  $exit_code
105
  fi
106
fi
107
33
required_files=${tor_conf}
108
required_files=${tor_conf}
34
required_dirs=${tor_datadir}
109
required_dirs=${tor_datadir}
35
pidfile=${tor_pidfile}
110
pidfile=${tor_pidfile}
Lines 37-41 Link Here
37
command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir}"
112
command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir}"
38
extra_commands="reload"
113
extra_commands="reload"
39
114
40
run_rc_command "$1"
115
if ! run_rc_command "$1"; then
116
  exit_code=1
117
fi
41
118
119
return $exit_code
(-)security/tor-devel/pkg-plist (-6 / +7 lines)
Lines 7-17 Link Here
7
%%MANPAGES%%man/man1/tor-resolve.1.gz
7
%%MANPAGES%%man/man1/tor-resolve.1.gz
8
%%MANPAGES%%man/man1/tor.1.gz
8
%%MANPAGES%%man/man1/tor.1.gz
9
%%MANPAGES%%man/man1/torify.1.gz
9
%%MANPAGES%%man/man1/torify.1.gz
10
%%MANPAGES%%%%PORTDOCS%%%%DOCSDIR%%/tor-gencert.html
10
%%PORTDOCS%%%%DOCSDIR%%/tor-gencert.html
11
%%MANPAGES%%%%PORTDOCS%%%%DOCSDIR%%/tor-resolve.html
11
%%PORTDOCS%%%%DOCSDIR%%/tor-resolve.html
12
%%MANPAGES%%%%PORTDOCS%%%%DOCSDIR%%/tor.html
12
%%PORTDOCS%%%%DOCSDIR%%/tor.html
13
%%MANPAGES%%%%PORTDOCS%%%%DOCSDIR%%/torify.html
13
%%PORTDOCS%%%%DOCSDIR%%/torify.html
14
%%DATADIR%%/geoip
14
%%DATADIR%%/geoip
15
%%DATADIR%%/geoip6
15
%%DATADIR%%/geoip6
16
@dir(_tor,_tor,750) /var/run/tor
16
@dir(%%USER%%,%%GROUP%%,700) /var/run/tor
17
@dir(_tor,_tor,750) /var/log/tor
17
@dir(%%USER%%,%%GROUP%%,700) /var/log/tor
18
@dir(%%USER%%,%%GROUP%%,700) /var/db/tor

Return to bug 219116