From owner-freebsd-questions@FreeBSD.ORG Sat Sep 27 03:12:55 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1E7DE71D for ; Sat, 27 Sep 2014 03:12:55 +0000 (UTC) Received: from fly.hiwaay.net (fly.hiwaay.net [216.180.54.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAD96EBB for ; Sat, 27 Sep 2014 03:12:54 +0000 (UTC) Received: from kabini1.local (rbn1-216-180-19-117.adsl.hiwaay.net [216.180.19.117]) (authenticated bits=0) by fly.hiwaay.net (8.13.8/8.13.8/fly) with ESMTP id s8R3Crn5013463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Fri, 26 Sep 2014 22:12:53 -0500 Message-ID: <54262CAB.9040402@hiwaay.net> Date: Fri, 26 Sep 2014 22:19:07 -0500 From: "William A. Mahaffey III" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Problems starting tor service .... References: <542423D4.8070706@hiwaay.net> <54242605.4090004@dat.pl> <5424330F.2060209@hiwaay.net> <20140926182223.0b204ceb@Papi> <5425E6F0.8030704@hiwaay.net> <20140926193736.43e50435@Papi> In-Reply-To: <20140926193736.43e50435@Papi> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2014 03:12:55 -0000 On 09/26/14 17:37, Mario Lobo wrote: > On Fri, 26 Sep 2014 17:21:36 -0500 > "William A. Mahaffey III" wrote: > >> On 09/26/14 16:22, Mario Lobo wrote: >>> On Thu, 25 Sep 2014 10:21:51 -0500 >>> "William A. Mahaffey III" wrote: >>> >>>> On 09/25/14 09:26, Maciej Milewski wrote: >>>>> On 25.09.2014 16:16, William A. Mahaffey III wrote: >>>>>> Sep 25 09:10:20.000 [warn] Couldn't open file for 'Log notice >>>>>> file /var/log/tor': Permission denied >>>>>> Sep 25 09:10:20.000 [notice] Closing partially-constructed Socks >>>>>> listener on 127.0.0.1:9050 >>>>>> Sep 25 09:10:20.000 [warn] Failed to parse/validate config: >>>>>> Failed to init Log options. See logs for details. >>>>>> Sep 25 09:10:20.000 [err] Reading config failed--see warnings >>>>>> above. >>>>> Wrong /var/log/tor permissions? >>>>> >>>> I *think* /vsar/log/tor is supposed to be a directory, not sure >>>> about that .... In any event, I also started privoxy & it had no >>>> problems starting, setting up its /var/log dir, etc.: >>>> >>>> >>>> [root@kabini1, /etc, 10:18:24am] 385 % lsof -n | grep privoxy >>>> lsof: WARNING: compiled for FreeBSD release 9.1-RELEASE-p17; this >>>> is 9.3-RELEASE. >>>> privoxy 88652 privoxy cwd VDIR 0,102 >>>> 1024 2 / privoxy 88652 privoxy rtd VDIR >>>> 0,102 1024 2 / privoxy 88652 privoxy >>>> txt VREG 0,166 267352 >>>> 807043 /usr/local/sbin/privoxy privoxy 88652 privoxy txt >>>> VREG 0,102 108664 2006401 /libexec/ld-elf.so.1 >>>> privoxy 88652 privoxy 0r VCHR 0,17 >>>> 0t0 17 /dev/null >>>> privoxy 88652 privoxy 1w VCHR 0,17 >>>> 0t0 17 /dev/null >>>> privoxy 88652 privoxy 2u IPv4 >>>> 0xfffffe018622b3d0 0t0 TCP 127.0.0.1:8118 >>>> (LISTEN) [root@kabini1, /etc, 10:18:43am] 386 % (lltr10 /var/log/; >>>> date) -rw------- 1 root wheel 5427 Sep 24 12:00 >>>> cron.0.bz2 -rw-r----- 1 root wheel 795 Sep 25 00:00 >>>> maillog.0.bz2 -rw------- 1 root wheel 757 Sep 25 03:02 >>>> ipfw.today -rw-r----- 1 root wheel 1448 Sep 25 04:55 >>>> sendmail.st -rw-r----- 1 root wheel 3427 Sep 25 04:55 >>>> maillog -rw------- 1 root wheel 42302 Sep 25 05:33 >>>> auth.log -rw------- 1 root wheel 69791 Sep 25 09:00 >>>> security drwxr-x--- 2 privoxy privoxy 512 Sep 25 09:18 >>>> privoxy/ -rw-r--r-- 1 root wheel 625277 Sep 25 09:18 >>>> messages -rw------- 1 root wheel 35859 Sep 25 10:15 cron >>>> Thu Sep 25 10:19:04 CDT 2014 >>>> [root@kabini1, /etc, 10:19:04am] 387 % history | grep service >>>> 360 9:10 service tor start >>>> 369 9:18 service privoxy start >>>> 370 9:18 service tor start >>>> 375 9:24 vi services >>>> 376 9:27 grep any services >>>> 387 10:19 history | grep service >>>> [root@kabini1, /etc, 10:19:26am] 388 % grep wheel passwd >>>> [root@kabini1, /etc, 10:20:41am] 389 % >>>> >>>> >>>> both privoxy & tor have their own users defined in passwd, neither >>>> are in the group wheel .... who knows .... TIA for any further >>>> clues .... >>>> >>>> >>> mkdir /var/log/tor >>> chown tor:tor /var/log/tor >>> >>> Watch out because on my system the user created was _tor, so check >>> yours ! >>> >>> After that, restart tor. >>> >> >> Hmmmm, OK: >> >> [root@kabini1, /etc, 11:17:01pm] 391 % mkdir /var/log/tor >> You have new mail. >> [root@kabini1, /etc, 5:14:01pm] 392 % chown _tor:_tor /var/log/tor >> [root@kabini1, /etc, 5:14:11pm] 393 % ( lltr10 /var/log/ ; date ) >> drwxr-x--- 2 privoxy privoxy 512 Sep 25 09:18 privoxy/ >> -rw-r--r-- 1 root wheel 625277 Sep 25 09:18 messages >> -rw-r----- 1 root wheel 792 Sep 26 00:00 maillog.0.bz2 >> -rw------- 1 root wheel 466 Sep 26 03:02 mount.today >> -rw------- 1 root wheel 757 Sep 26 03:02 ipfw.today >> -rw-r----- 1 root wheel 1448 Sep 26 04:55 sendmail.st >> -rw-r----- 1 root wheel 3428 Sep 26 04:55 maillog >> -rw------- 1 root wheel 43052 Sep 26 05:33 auth.log >> -rw------- 1 root wheel 85255 Sep 26 17:11 cron >> drwxr-xr-x 2 _tor _tor 512 Sep 26 17:14 tor/ >> Fri Sep 26 17:14:15 CDT 2014 >> [root@kabini1, /etc, 5:14:15pm] 394 % grep tor passwd >> operator:*:2:5:System &:/:/usr/sbin/nologin >> _tor:*:256:256:Tor anonymizing router:/var/db/tor:/usr/sbin/nologin >> [root@kabini1, /etc, 5:14:21pm] 395 % grep tor group passwd >> group:operator:*:5:root >> group:_tor:*:256: >> passwd:operator:*:2:5:System &:/:/usr/sbin/nologin >> passwd:_tor:*:256:256:Tor anonymizing >> router:/var/db/tor:/usr/sbin/nologin [root@kabini1, /etc, 5:14:38pm] >> 396 % >> >> >> Then: >> >> >> [root@kabini1, /etc, 5:14:53pm] 397 % service tor start >> Starting tor. >> Sep 26 17:15:01.136 [notice] Tor v0.2.4.23 (git-598c61362f1b3d3e) >> running on FreeBSD with Libevent 2.0.21-stable and OpenSSL >> 0.9.8za-freebsd. Sep 26 17:15:01.137 [notice] Tor can't help you if >> you use it wrong! Learn how to be safe at >> https://www.torproject.org/download/download#warning Sep 26 >> 17:15:01.137 [notice] Read configuration file >> "/usr/local/etc/tor/torrc". Sep 26 17:15:01.154 [notice] Opening >> Socks listener on 127.0.0.1:9050 Sep 26 17:15:01.000 [warn] Couldn't >> open file for 'Log notice file /var/log/tor': Is a directory >> Sep 26 17:15:01.000 [notice] Closing partially-constructed Socks >> listener on 127.0.0.1:9050 >> Sep 26 17:15:01.000 [warn] Failed to parse/validate config: Failed to >> init Log options. See logs for details. >> Sep 26 17:15:01.000 [err] Reading config failed--see warnings above. >> /usr/local/etc/rc.d/tor: WARNING: failed to start tor >> [root@kabini1, /etc, 5:15:01pm] 398 % \rm -rf /var/log/tor >> [root@kabini1, /etc, 5:15:26pm] 399 % >> >> Obviously my surmise about /var/log/tor being a dir are .... >> *wrong* :-/ .... The permission thing is quite curious, since privoxy >> has similar permissions (its own user/group) & was able to create its >> log-dir .... puzzling .... >> > Also for a few hints more, check out > > /usr/local/etc/rc.d/tor > [root@kabini1, /etc, 10:14:17pm] 433 % ll /usr/local/etc/rc.d/tor -r-xr-xr-x 1 root wheel 1336 Aug 21 18:09 /usr/local/etc/rc.d/tor* [root@kabini1, /etc, 10:14:24pm] 434 % cat /usr/local/etc/rc.d/tor #!/bin/sh # # $FreeBSD: head/security/tor/files/tor.in 324351 2013-08-07 12:54:37Z bf $ # # PROVIDE: tor # REQUIRE: NETWORKING SERVERS USR # BEFORE: LOGIN # # Add the following lines to /etc/rc.conf to enable tor. # All these options will overide any settings in your local torrc as # they are command line options. # # tor_enable (bool): Set it to "YES" to enable tor. Default: NO # tor_conf (str): Points to your torrc file. # Default: /usr/local/etc/tor/torrc # tor_user (str): Tor daemon user. Default: _tor # tor_datadir (str): Tor datadir. Default: /var/db/tor # tor_logfile (str): Tor log file. Default: /var/log/tor # tor_loglevel (str): Tor log severity level. Default: notice # . /etc/rc.subr name="tor" rcvar=tor_enable load_rc_config ${name} : ${tor_enable="NO"} : ${tor_conf="/usr/local/etc/tor/torrc"} : ${tor_user="_tor"} : ${tor_pidfile="/var/run/tor/tor.pid"} : ${tor_logfile="/var/log/tor"} : ${tor_loglevel="notice"} : ${tor_datadir="/var/db/tor"} required_files=${tor_conf} required_dirs=${tor_datadir} pidfile=${tor_pidfile} command="/usr/local/bin/${name}" command_args="-f ${tor_conf} --PidFile ${tor_pidfile} --RunAsDaemon 1 --DataDirectory ${tor_datadir} --+Log ${tor_loglevel}\ file\ ${tor_logfile}" extra_commands="log" log_cmd="${name}_log" tor_log() { cat ${tor_logfile} } run_rc_command "$1" [root@kabini1, /etc, 10:14:27pm] 435 % i.e. /var/log/tor is a file, *not* a dir. however: [root@kabini1, /etc, 10:17:03pm] 436 % \rm -rf /var/log/tor [root@kabini1, /etc, 10:17:08pm] 437 % ( lltr10 /var/log/ ; date ) -rw------- 1 root wheel 69791 Sep 25 09:00 security drwxr-x--- 2 privoxy privoxy 512 Sep 25 09:18 privoxy/ -rw-r----- 1 root wheel 792 Sep 26 00:00 maillog.0.bz2 -rw------- 1 root wheel 466 Sep 26 03:02 mount.today -rw------- 1 root wheel 757 Sep 26 03:02 ipfw.today -rw-r----- 1 root wheel 1448 Sep 26 04:55 sendmail.st -rw-r----- 1 root wheel 3428 Sep 26 04:55 maillog -rw------- 1 root wheel 43052 Sep 26 05:33 auth.log -rw-r--r-- 1 root wheel 625526 Sep 26 22:07 messages -rw------- 1 root wheel 93124 Sep 26 22:15 cron Fri Sep 26 22:17:32 CDT 2014 [root@kabini1, /etc, 10:17:32pm] 438 % service tor start Starting tor. Sep 26 22:17:54.942 [notice] Tor v0.2.4.23 (git-598c61362f1b3d3e) running on FreeBSD with Libevent 2.0.21-stable and OpenSSL 0.9.8za-freebsd. Sep 26 22:17:54.942 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning Sep 26 22:17:54.942 [notice] Read configuration file "/usr/local/etc/tor/torrc". Sep 26 22:17:54.959 [notice] Opening Socks listener on 127.0.0.1:9050 Sep 26 22:17:54.000 [warn] Couldn't open file for 'Log notice file /var/log/tor': Permission denied Sep 26 22:17:54.000 [notice] Closing partially-constructed Socks listener on 127.0.0.1:9050 Sep 26 22:17:54.000 [warn] Failed to parse/validate config: Failed to init Log options. See logs for details. Sep 26 22:17:54.000 [err] Reading config failed--see warnings above. /usr/local/etc/rc.d/tor: WARNING: failed to start tor [root@kabini1, /etc, 10:17:54pm] 439 % ( lltr10 /var/log/ ; date ) -rw------- 1 root wheel 69791 Sep 25 09:00 security drwxr-x--- 2 privoxy privoxy 512 Sep 25 09:18 privoxy/ -rw-r----- 1 root wheel 792 Sep 26 00:00 maillog.0.bz2 -rw------- 1 root wheel 466 Sep 26 03:02 mount.today -rw------- 1 root wheel 757 Sep 26 03:02 ipfw.today -rw-r----- 1 root wheel 1448 Sep 26 04:55 sendmail.st -rw-r----- 1 root wheel 3428 Sep 26 04:55 maillog -rw------- 1 root wheel 43052 Sep 26 05:33 auth.log -rw------- 1 root wheel 93124 Sep 26 22:15 cron -rw-r--r-- 1 root wheel 625580 Sep 26 22:18 messages Fri Sep 26 22:18:04 CDT 2014 [root@kabini1, /etc, 10:18:04pm] 440 % -- William A. Mahaffey III ---------------------------------------------------------------------- "The M1 Garand is without doubt the finest implement of war ever devised by man." -- Gen. George S. Patton Jr.