Permalink
Browse files

working state

also added privoxy
  • Loading branch information...
jaromil committed Dec 15, 2011
1 parent 765ee03 commit 929ab34317cdd29ae80fe8cdf8caea95d208a589
Showing with 98 additions and 270 deletions.
  1. +3 −3 etc/privoxy/config
  2. +7 −25 etc/tor/torrc.sample
  3. +0 −47 scripts/S69tor
  4. +79 −0 scripts/S99tor
  5. +9 −3 scripts/assemble-app-bin.sh
  6. +0 −192 scripts/linux-tor-prio.sh
  7. 0 scripts/torctl
View
@@ -267,7 +267,7 @@ user-manual /usr/share/doc/privoxy/user-manual
#
# No trailing "/", please.
#
-confdir /etc/privoxy
+confdir /apps/tor/etc/privoxy
#
#
# 2.2. templdir
@@ -324,7 +324,7 @@ confdir /etc/privoxy
#
# No trailing "/", please.
#
-logdir /var/log/privoxy
+logdir /tmp
#
#
# 2.4. actionsfile
@@ -735,7 +735,7 @@ logfile logfile
# listen-address [::1]:8118
#
#
-listen-address localhost:8118
+listen-address 0.0.0.0:8118
#
#
# 4.2. toggle
View
@@ -1,3 +1,10 @@
+####################
+## TorTV config file
+##
+## This file resembles the normal Tor configuration
+## the only difference is that there are two directives missing
+## since they are configured at runtime: Log and DataDirectory
+##
## Configuration file for a typical Tor user
## Last updated 16 July 2009 for Tor 0.2.2.1-alpha.
## (May or may not work for much older or much newer versions of Tor.)
@@ -25,31 +32,6 @@ SocksListenAddress 127.0.0.1 # accept connections only from localhost
#SocksPolicy accept 192.168.0.0/16
#SocksPolicy reject *
-## Logs go to stdout at level "notice" unless redirected by something
-## else, like one of the below lines. You can have as many Log lines as
-## you want.
-##
-## We advise using "notice" in most cases, since anything more verbose
-## may provide sensitive information to an attacker who obtains the logs.
-##
-## Send all messages of level 'notice' or higher to /usr/mipsel-linux-gnu/var/log/tor/notices.log
-#Log notice file /usr/mipsel-linux-gnu/var/log/tor/notices.log
-## Send every possible message to /usr/mipsel-linux-gnu/var/log/tor/debug.log
-#Log debug file /usr/mipsel-linux-gnu/var/log/tor/debug.log
-## Use the system log instead of Tor's logfiles
-#Log notice syslog
-## To send all messages to stderr:
-#Log debug stderr
-
-## Uncomment this to start the process in the background... or use
-## --runasdaemon 1 on the command line. This is ignored on Windows;
-## see the FAQ entry if you want Tor to run as an NT service.
-#RunAsDaemon 1
-
-## The directory for keeping all the keys/etc. By default, we store
-## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
-#DataDirectory /usr/mipsel-linux-gnu/var/lib/tor
-
## The port on which Tor will listen for local connections from Tor
## controller applications, as documented in control-spec.txt.
#ControlPort 9051
View
@@ -1,47 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2011 Denis Roio <jaromil@dyne.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# wait the boot to complete
-
-APPROOT=/apps/tor
-
-sleep 15
-
-touch /tmp/tor.log
-
-USBROOT=`cat /tmp/appsRoot | grep tor | sed 's/tor//`
-echo "Tor app running on USB $USBROOT" >> /tmp/tor.log
-date >> /tmp/tor.log
-echo "args: $@" >> /tmp/tor.log
-
-export USBROOT
-export APPROOT
-
-
-# shall generate the config
-if ! [ -r $USBROOT/tor.conf ]; then
- echo "config file not found" >> /tmp/tor.log
- echo "place tor.conf in your usb key" >> /tmp/tor.log
- exit 0
-else
-# source settings
- . $USBROOT/tor.conf
- echo "config file found in ${USBROOT}tor.conf" >> /tmp/tor.log
-fi
-
-mkdir -p $USBROOT/.tor
-
View
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Denis Roio <jaromil@dyne.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+APPROOT=/apps/tor
+
+sleep 15 # wait the boot to complete
+
+touch /tmp/tor.log
+chmod -x /tmp/tor.log
+
+log() { echo "[`date +%T`] $@" >> /tmp/tor.log; }
+
+USBROOT=`cat /tmp/appsRoot | grep tor | sed 's/tor//`
+log "Tor app running on USB $USBROOT"
+log "args: $@"
+
+export USBROOT
+export APPROOT
+
+log "Checking Internet connection ..."
+ping -q -c1 time.ien.it > /dev/null
+if [ $? != 0 ]; then
+ log "No Internet connection found, aborting Tor startup."
+ log "When connected one can re-launch this app.bin without a reboot:"
+ log "/apps/tor/etc/init.d/S69tor"
+ exit 0
+fi
+
+log "Updating clock using time.ien.it (NTP)"
+# fix the clock to actual time, else Tor will complain
+rdate time.ien.it >> /tmp/tor.log
+
+mkdir -p ${USBROOT}tor
+
+# generate the tor config
+if ! [ -r ${USBROOT}tor/tor.conf ]; then
+ cp /apps/tor/etc/tor/torrc.sample ${USBROOT}tor/tor.conf
+ log "Tor configuration created in ${USBROOT}tor/tor.conf"
+else
+ log "Tor configiration file found in ${USBROOT}tor/tor.conf"
+fi
+
+# generate the privoxy config
+if ! [ -r ${USBROOT}tor/privoxy.conf ]; then
+ cp /apps/tor/etc/privoxy/config ${USBROOT}tor/privoxy.conf
+ log "Privoxy configuration created in ${USBROOT}tor/privoxy.conf"
+else
+ log "Privoxy configiration file found in ${USBROOT}tor/privoxy.conf"
+fi
+
+log "Preparing to launch Tor daemon"
+cp ${USBROOT}/tor/tor.conf /tmp
+echo "Log notice file /tmp/tor-daemon.log" >> /tmp/tor.conf
+echo "DataDirectory ${USBROOT}tor/" >> /tmp/tor.conf
+echo "RunAsDaemon 1" >> /tmp/tor.conf
+
+log "Data directory set to ${USBROOT}tor/"
+
+# launch Tor
+log "Launching Tor in background"
+tor -f /tmp/tor.conf
+log "Launching Privoxy in background"
+privoxy ${USBROOT}tor/privoxy.conf
+log "Done."
@@ -23,6 +23,8 @@
appname=tor
+echo "This script requires sudo for loop mounting."
+
if [ -z $1 ]; then
# no argument, create fresh
@@ -41,10 +43,14 @@ if [ -z $1 ]; then
cp -v bin/tor* $appdir/bin &&
cp -v bin/privoxy* $appdir/bin &&
cp -rav etc/tor $appdir/etc &&
+ cp -rav etc/privoxy $appdir/etc &&
cp -v etc/geoip $appdir/etc &&
- cp -v scripts/S69tor $appdir/etc/init.d &&
- chmod a+x $appdir/etc/init.d/S69tor &&
- cp -v README $appdir &&
+ cp -v scripts/S99tor $appdir/etc/init.d &&
+ cp -v scripts/torctl $appdir/bin &&
+ cp -v scripts/tor-ctrl.sh $appdir/bin &&
+ cp -v scripts/torify $appdir/bin &&
+ chmod a+x $appdir/etc/init.d/S99tor &&
+ cp -v README $appdir
sudo chown -R root:root $appdir
Oops, something went wrong.

0 comments on commit 929ab34

Please sign in to comment.