Skip to content

Commit

Permalink
working state
Browse files Browse the repository at this point in the history
also added privoxy
  • Loading branch information
jaromil committed Dec 15, 2011
1 parent 765ee03 commit 929ab34
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 270 deletions.
6 changes: 3 additions & 3 deletions etc/privoxy/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -324,7 +324,7 @@ confdir /etc/privoxy
#
# No trailing "/", please.
#
logdir /var/log/privoxy
logdir /tmp
#
#
# 2.4. actionsfile
Expand Down Expand Up @@ -735,7 +735,7 @@ logfile logfile
# listen-address [::1]:8118
#
#
listen-address localhost:8118
listen-address 0.0.0.0:8118
#
#
# 4.2. toggle
Expand Down
32 changes: 7 additions & 25 deletions etc/tor/torrc.sample
Original file line number Diff line number Diff line change
@@ -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.)
Expand Down Expand Up @@ -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
Expand Down
47 changes: 0 additions & 47 deletions scripts/S69tor

This file was deleted.

79 changes: 79 additions & 0 deletions scripts/S99tor
Original file line number Diff line number Diff line change
@@ -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."
12 changes: 9 additions & 3 deletions scripts/assemble-app-bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

appname=tor

echo "This script requires sudo for loop mounting."

if [ -z $1 ]; then
# no argument, create fresh

Expand All @@ -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

Expand Down
Loading

0 comments on commit 929ab34

Please sign in to comment.