Results 1 to 14 of 14

Thread: [How-To] Tor - The Onion Router for wl500g

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10

    install scripts for tor&polipo

    If you'd like to automatically install tor & polipo just copy-paste as such the following script to your SSH terminal for the router:
    Code:
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    START=/opt/etc/init.d/S99tor
    PFILE=/opt/var/run/polipo.pid
    LFILE=/opt/var/log/polipo.log
    PCONF=/opt/etc/polipo/polipo.conf
    #user editable part end
    
    ipkg update
    ipkg install tor polipo
    mkdir -p /opt/etc/polipo
    
    cat > /opt/etc/tor/torrc << __EOF__
    SocksPort 9050 # what port to open for local application connections
    SocksListenAddress 127.0.0.1 # accept connections only from localhost
    SocksListenAddress 192.168.1.1:9050 # listen on this IP:port also
    RunAsDaemon 1
    DataDirectory /opt/var/lib/tor
    #StrictExitNodes 1
    #ExitNodes {gb}
    __EOF__
    
    cat > ${PCONF} << __EOF__
    proxyAddress = "0.0.0.0"
    proxyPort = 8118
    allowedClients = 127.0.0.1, 192.168.1.0/24, 10.8.0.0/24
    allowedPorts = 1-65535
    proxyName = "localhost"
    cacheIsShared = false
    socksParentProxy = "localhost:9050"
    socksProxyType = socks5
    chunkHighMark = 4194304 # 4M Ram Usage
    objectHighMark = 1536
    localDocumentRoot = ""
    disableLocalInterface = true
    disableConfiguration = true
    dnsUseGethostbyname = yes
    disableVia = true
    censoredHeaders = from,accept-language,x-pad,link
    censorReferer = maybe
    maxConnectionAge = 5m
    maxConnectionRequests = 120
    serverMaxSlots = 8
    serverSlots = 2
    tunnelAllowedPorts = 1-65535
    daemonise = true
    pidFile = ${PFILE}
    logFile = ${LFILE}
    logLevel = 0x03
    __EOF__
    
    cat > ${START} << __EOF__
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    TNAME=/opt/bin/tor
    PNAME=/opt/bin/polipo
    CONF=${PCONF}
    EXSD=/bin/sed
    EXPS=/bin/ps
    
    if [ -z "\$1" ] ; then
        case \${0##*/} in
            S??*) rc="start" ;;
            K??*) rc="stop" ;;
            *) rc="usage" ;;
        esac
    else
        rc="\$1"
    fi
    
    TBN="\${TNAME##*/}"
    PBN="\${PNAME##*/}"
    case "\$rc" in
        start)
            if [ ! -x "\$TNAME" ]; then
              echo -e "\033[1;31m\$TBN is missing, try ipkg install \$TBN\033[0m"
              exit 1
            fi
            if [ ! -x "\$PNAME" ];then
              echo -e "\033[1;31m\$PBN is missing, try ipkg install \$PBN\033[0m"
              exit 2
            fi
            TST="\$(echo \${TNAME} | \$EXSD 's#/#\\\\/#g')"
            PST="\$(echo \${PNAME} | \$EXSD 's#/#\\\\/#g')"
            echo "Starting \$TBN and \$PBN"
            if [ -n "\$(\$EXPS | \$EXSD -n '/.*'''\$TST'''/p')" ]; then
                 echo -e "\033[1;33m\$TBN runs already\033[0m"
            else
              \${TNAME}
              sleep 1
            fi
            if [ -n "\$(\$EXPS | \$EXSD -n '/.*'''\$PST'''/p')" ]; then
                 echo -e "\033[1;33m\$PBN runs already\033[0m"
            else
              rm -f ${PFILE}
              \${PNAME} -c "\$CONF"
            fi
            ;;
        stop)
            echo "Stopping \$TBN and \$PBN"
            killall \${TNAME##*/}; killall \${PNAME##*/}
            ;;
        restart)
            echo "Restarting \$TBN and \$PBN"
            "\$0" stop
            sleep 2
            "\$0" start
            ;;
        *)
            echo "Usage: \$0 (start|stop|restart|usage)"
            ;;
    esac
    __EOF__
    chmod u+x ${START}
    ${START} start
    It will create the following files (save them if you have some of them already):
    /opt/etc/tor/torrc
    /opt/etc/polipo/polipo.conf
    /opt/etc/init.d/S99tor


    install.tar.gz

    You'll need to edit /opt/etc/tor/torrc if you have preference for exiting via tor in some country or you wish to activate the relay (check the discussion).
    In /opt/etc/polipo/polipo.conf you may wish to reduce logLevel.
    For more polipo options please check http://www.pps.jussieu.fr/~jch/softw...po/polipo.html

    My usual single line install instead:
    Code:
    cd /tmp && wget -O install.tar.gz "http://wl500g.info/attachment.php?attachmentid=8479&d=1322142484" && tar xvzf install.tar.gz && ./install.sh
    In my experience tor/polipo can use quite some memory/CPU time so if you plan to run many other programs on the router as well you may want to consider using RT-N16 or 128MB memory upgraded WL-500gPv1/WL-500W.

    If you'd like to disable automatic startup just re-name /opt/etc/init.d/S99tor to e.g. /opt/etc/init.d/DS99tor

    Enjoy!
    Last edited by ecaddict; 24-11-2011 at 13:48. Reason: fixed polipo pidfile removal

Similar Threads

  1. Новая прошивка 1.9.2.7-d/-rtn от энтузиастов и Олега
    By lly in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 5901
    Last Post: 16-11-2020, 09:31
  2. [How to] rtorrent & ntorrent
    By mancub in forum WL-500gP Tutorials
    Replies: 101
    Last Post: 18-12-2008, 07:21
  3. [HOW TO] Bluetooth in wl500g
    By TIk in forum WL-500g/WL-500gx Tutorials
    Replies: 1
    Last Post: 17-09-2008, 21:38
  4. [How To] Upgrade your Oleg firmware
    By wirespot in forum WL-500gP Tutorials
    Replies: 7
    Last Post: 21-07-2008, 16:38
  5. Replies: 0
    Last Post: 24-01-2007, 02:54

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •