#!/bin/sh # # $FreeBSD$ # # PROVIDE: dns-proxy-tor # REQUIRE: tor # BEFORE: LOGIN # # This rc script understands the following options which are read from /etc/rc.conf: # # dns_proxy_tor_enable (bool): Set to "NO" by default. # Set it to "YES" to enable dns-proxy-tor. # dns_proxy_tor_user (str): dns-proxy-tor Daemon user. Default is _dns-proxy-tor. # dns_proxy_tor_group (str): dns-proxy-tor Daemon group. Default is _dns-proxy-tor. # dns_proxy_tor_start_privileged (bool): Set to "NO" by default. If set to "YES", dns-proxy-tor # will be started as root and drop privileges itself. # You need to set this option if you want dns-proxy-tor # to bind to a reserved port. Do not set dns_proxy_user # to "root". # dns_proxy_tor_bind_port (str): Set to 5353 by default. # dns_proxy_tor_socks_resolve (bool): Set to "NO" by default. # Set it to "YES" to let dns-proxy-tor return real # IP adresses instead of virtual ones that only work # through Tor. # dns_proxy_tor_logfile (str): Default is "/var/log/dns-proxy-tor.log". Created if necessary. # dns_proxy_tor_loglevel (str): Default is "info". For other values read perldoc dns-proxy-tor. # # dns_proxy_tor_ctrl_addr_and_port( str): Tor's IP and control port. Default is "127.0.0.1:9051". # dns_proxy_tor_socks_addr_and_port(str): Tor's IP and socks port. Default is "127.0.0.1:9050". . %%RC_SUBR%% name="dns_proxy_tor" rcvar=${name}_enable command_interpreter="/usr/bin/perl" load_rc_config ${name} : ${dns_proxy_tor_enable="NO"} : ${dns_proxy_tor_user="_dns-proxy-tor"} : ${dns_proxy_tor_group="_dns-proxy-tor"} : ${dns_proxy_tor_bind_addr="127.0.0.1"} : ${dns_proxy_tor_bind_port="5353"} : ${dns_proxy_tor_start_privileged="NO"} : ${dns_proxy_tor_logfile="/var/log/dns-proxy-tor.log"} : ${dns_proxy_tor_loglevel="info"} : ${dns_proxy_tor_socks_resolve="NO"} : ${dns_proxy_tor_ctrl_addr_and_port="127.0.0.1:9051"} : ${dns_proxy_tor_socks_addr_and_port="127.0.0.1:9050"} : ${pidfile="%%PREFIX%%/var/run/dns-proxy-tor/dns-proxy-tor.pid"} start_precmd="if [ ! -e ${dns_proxy_tor_logfile} ]; then\ echo Creating ${dns_proxy_tor_logfile};\ touch ${dns_proxy_tor_logfile};\ chown ${dns_proxy_tor_user}:${dns_proxy_tor_group} ${dns_proxy_tor_logfile};\ fi" command="%%PREFIX%%/bin/dns-proxy-tor" command_args="-b ${dns_proxy_tor_bind_addr}:${dns_proxy_tor_bind_port} -p ${pidfile}\ -v ${dns_proxy_tor_loglevel} -l ${dns_proxy_tor_logfile} -t ${dns_proxy_tor_ctrl_addr_and_port}" if [ x$dns_proxy_tor_socks_resolve != xNO ]; then command_args="${command_args} -s ${dns_proxy_tor_socks_addr_and_port}" fi if [ x$dns_proxy_tor_start_privileged != xNO ]; then command_args="${command_args} -u ${dns_proxy_tor_user}:${dns_proxy_tor_user}" dns_proxy_tor_user="root" fi run_rc_command "$1"