\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[pdftex,bookmarks=true,colorlinks,linkcolor=blue,urlcolor=blue,citecolor=blue]{hyperref}

%opening
\title{JonDoDaemon Handbook}
\author{JonDos GmbH}
\date{\today}

\begin{document}
\maketitle
\tableofcontents

\section{JonDoDaemon for Debian, Ubuntu and LMDE}
For all of you who do not like those fancy GUIs we have a console proxy client. JonDoConsole may be operated by command line interface or remotly by telnet interface. Like JonDo it acts as a proxy and will forward the traffic of your internet applications encrypted to the mix cascades and hides your IP address.\\

The package contains 3 wrapper scripts for \textit{JonDoConsole.jar}:
\begin{enumerate}
 \item \textbf{jondoconsole} is a command line app. It looks for an applicable JRE (OpenJDK or Sun) to start the Java application \textit{JonDoConsole.jar}.
 \item \textbf{jondodaemon} is a script for running JonDoConsole in background with user permissions. It can start and stop the daemon, check the status, set a password for remote access and start the remote controler app for connection to a running daemon.
 \item The sys-V-init script \textbf{/etc/init.d/jondodaemon} can start the JonDo daemon at boot time in background and stop it at shutdown. 
\end{enumerate}

\section{Install}
You can install the package \textit{jondodaemon} from our \href{https://anonymous-proxy-servers.net/en/help/firststeps2.html}{software repostitory} or you may download the DEB package from the download page and install it by hand.\\

Requirements:
\begin{itemize}
 \item A Java runtime environment is required.\\You may use \textit{openjdk-6-jre-headless} or \textit{sun-java6-jre} (non-free). 
 \item The package \textit{rlwrap} is required.
 \item The package \textit{java-wrappers} is required.
\end{itemize}

First install the required packages with the package manager of your distribution. Afterwards you may install jondodaemon package by:
\begin{verbatim}
   > sudo dpkg -i jondodaemon_all.deb
\end{verbatim} 


\section{Run JonDoConsole}
If you did not need a daemon but only a GUI-less console client, you may start:
\begin{verbatim}
  $ jondoconsole
  JonDoConsole> help
  ...
  JonDoConsole> quit
  $
\end{verbatim} 

\subsubsection*{Short explanation of some commands}

\textbf{help} will display an overview about available commands. For more detailed information try \textbf{help command}.
 \begin{verbatim}
 JonDoConsole> help
 
 Type 'help <command>' for more information about a specific command,
 'status', 'info', 'choose', 'start', 'stop', 'switch', 'autoswitch', 
 'blacklist', 'http' for controlling services,
 'coupon', 'import', 'export', 'delete', 'change', 'password', 
 'requestMonthlyBytes', 'pi' for managing your premium accounts,
 'reload', 'reloadPay', 'autoReload', 'autoReloadPay', 'paymentProxy', 
 'infoserviceProxy' for updating service information,
 'loglevel', 'logdetail', 'logtype' for altering debug settings, 
 'exit' or 'quit' to leave or 'shutdown' to stop the daemon.
 JonDoConsole>
\end{verbatim} 

\textbf{status} will show you information about your premium account balance, the cascade you are connected and some activated or disabled features.
 \begin{verbatim}
 JonDoConsole> status
 
 State:CONNECTED, AutoSwitch:OFF, HTTPFilter:ON,
 autoInfoServiceUpdate:ON, autoAccountUpdate:ON, Balance: 126.2 MByte
 Current service: 'Koala-SpeedPartner-Titan'
 Speed: >= 800 kbit/s Delay: <= 750 ms
 Current users: 50 Security: 6,1/6,6 [Mix1: ch, Mix2: de, Mix3: nl] PREMIUM SOCKS
 Operator1(at): Zeitwort, Operator2(de): SpeedPartner, Operator3(gb): Delta-Protect
 JonDoConsole>
 \end{verbatim}

\textbf{switch} will change the cascade and choose a new one randomly.\\

\textbf{choose} and \textbf{info} will display a list of available mix cascades and ask you to choose a cascade for switching.
\begin{verbatim}
    JonDoConsole> choose
 
    1. Fondue-Montesquieu-Saturn      [S] (nl->de,  nl->de,  bg->gb)
    * 2. Koala-SpeedPartner-Titan     [S] (ch->at,  de,  nl->gb)
    3. Opossum-Berwald-Merkur         [S] (ch->at,  cz->gb,  bg->gb)
    4. Neptun-Wombat-Shamrock         [S] (nl->gb,  ch->at,  fr->us)
    5. Hermes-Grolsch-Transformer     [S] (ua->de,  nl->de,  gb->bg)
    Please enter a mix service index or type <ENTER> to skip.
    JonDoConsole:choose> 
\end{verbatim}

\textbf{exit} or \textbf{quit} close the programm.\\

\textbf{shutdown} close the programm and shutdown a remote connected daemon (in case you are using the remote control interface of daemon).

\subsubsection*{How to use premium services}
You may use JonDonym for free, but free mix cascades are restricted in some cases. Full speed and anonymisation features you will get only with a premium account. You may buy a coupon code at the \href{https://shop.anonymous-proxy-servers.net/bin/payment}{webshop of JonDos GmbH} and use the command \textbf{coupon} to create a premium account:
\begin{verbatim}
   JonDoConsole> coupon
   Please enter a coupon code or type <ENTER> to skip.
   JonDoConsole:code> C72FA880A38E992A
\end{verbatim}

Alternatively you can import premium accounts from your JonDo (GUI) configuration or from a backup file. Use the command \textbf{import}:
\begin{verbatim}
   JonDoConsole> import
   A JAP/JonDo configuration file was found at '/home/xxxxx/.jap.conf'.
   Would you like to import from this config file (c) or do you want to
   manually (m) specify a path for importing accounts? Type <ENTER> to skip.
   JonDoConsole:choose (c) or (m)> m
   JonDoConsole:file> 
\end{verbatim}



\section{Run JonDoDaemon in background}
You can run JonDoConsole as daemon in background by using the wrapper script \textit{jondodaemon}. You can start and stop the daemon and check the status (\textit{running} or \textit{not running}).
\begin{verbatim}
  $ jondodaemon start | stop | status
\end{verbatim} 

\subsubsection*{Enable remote control port}
You can start the daemon with a password secured control port to modify the behavior of a running daemon.\\

First set the password please. Use a password with at least 10 characters (upper and lower case) and numbers. Only strong passwords will be accepted. Stop \textit{jondodaemon} first, if it was running!
\begin{verbatim}
  $ jondodaemon passwd
  Please enter a password to protect the daemon or 'break' to cancel.
  Use at least 10 characters: letters, numbers, upper and lower case.
  JonDoConsole#password>
  Please type your daemon password a second time.
  JonDoConsole#password>
  Exiting...
\end{verbatim} 

Afterwards edit the configuration file \textit{/etc/jondo/jondodaemon.conf} or\\ \textit{\$HOME/.jondoconsole/jondodaemon.conf} (overrules the global configuration) with a text editor and enable the remote control port:
\begin{verbatim}
   ENABLE_CONTROL_PORT="yes"
   CONTROL_LISTEN_ADDRESS=localhost
   CONTROL_LISTEN_PORT=4004
\end{verbatim} 

Now you can start the daemon again.


\section{Run JonDoDaemon automatically}
You may start the \textit{jondodaemon} at boot time or if a network was connected. In these cases only the configuration files in \textit{/etc/jondo} are used.

\subsubsection*{Run JonDoDaemon at boot time}
This is done by using the sys-V-init script. Enable the start script:
\begin{verbatim}
  $ sudo insserv jondodaemon
\end{verbatim} 

Remove the start script from all runlevels:
\begin{verbatim}
  $ sudo insserv -r jondodaemon
\end{verbatim} 

\subsubsection*{Run JonDoDaemon with network connection established}
For laptops and netbooks it is not a good solution to start the daemon at boot time. Time by time you may be not connected to network. JonDoDaemon tries and tries and tries... to connect to the mix cascades and will reduce your battery operation time. You can start JonDoDaemon if a network connection was established by a shell script \textit{jondodaemon} in \textit{/etc/network/if-up.d/}
\begin{verbatim}
      #!/bin/sh
      set -e
      [ "$IFACE" != "lo" ] || exit 0
      /etc/init.d/jondodaemon start
\end{verbatim}

And stop the Daemon with by a shell script in \textit{/etc/network/if-down.d/}
\begin{verbatim}
      #!/bin/sh
      set -e
      /etc/init.d/jondodaemon stop
\end{verbatim}

Make both scripts executable:
\begin{verbatim}
      $ sudo chmod +x /etc/network/if-up.d/jondodaemon
      $ sudo chmod +x /etc/network/if-down.d/jondodaemon
 \end{verbatim}

\subsubsection*{Using Premium cascades}
For using premium cascades, you have to stop the \textit{jondodaemon}, run \textit{jondoconsole} with root permissions and \textbf{import} a backup of your premium accounts or use a \textbf{coupon} code. Afterwards you start \textit{jondodaemon} again and it will connect to premium services.
\begin{verbatim}
  $ sudo invoke-rc.d jondodaemon stop
  $ sudo jondoconsole
  JonDoConsole> import
  ...
  JonDoConsole> quit
  $ sudo invoke-rc.d jondodaemon start
\end{verbatim} 

Alternatively you may use the remote control interface to connect to the running daemon and use the commands \textbf{import} or\textbf{ coupon}.

\subsubsection*{Enable remote control port}
You can start the daemon with a password secured control port to modify the behavior of a running daemon.\\

First set the password please. Use a password with at least 10 characters (upper and lower case) and numbers. Only strong passwords will be accepted. Stop \textit{jondodaemon} first, if it was running!
  \begin{verbatim}
   $ sudo invoke-rc.d jondodaemon stop  (if it was running)
   $ sudo invoke-rc.d jondodaemon passwd
   Please enter a password to protect the daemon or 'break' to cancel.
   Use at least 10 characters: letters, numbers, upper and lower case.
   JonDoConsole#password>
   Please type your daemon password a second time.
   JonDoConsole#password>
   Exiting...
 \end{verbatim}

Afterwards edit the global configuration file \textit{/etc/jondo/jondodaemon.conf} and enable the remote control port:
  \begin{verbatim}
   ENABLE_CONTROL_PORT="yes"
   CONTROL_LISTEN_ADDRESS=localhost
   CONTROL_LISTEN_PORT=4004
 \end{verbatim}


Now you can start the daemon again.
\begin{verbatim}
   $ sudo invoke-rc.d jondodaemon start
 \end{verbatim}



\section{Remote control of a running daemon}
If the daemon is running with remote control enabled, you can connect it via telnet to log in with your password and you can interact like JonDoConsole. A suitable telnet client is part of JonDoConsole. You can start it simple with:
  \begin{verbatim}
   $ jondodaemon control
   Please enter the daemon password or type 'break' to cancel.
   JonDoConsole#password> *******
   You are logged in...
   JonDoConsole>
 \end{verbatim}

Because the remote control interface is a simple telnet interface, you may connect with \textit{telnet} too. In this case the password is not hidden by *****.
 \begin{verbatim}
 $ telnet localhost 4004
 Connected to localhost.
 Escape character is '^]'.
 Type 'login' to log into JonDoConsole.
 
 JonDoConsole> login
 Received login request! Please wait for the authentication request...
 Please enter the daemon password or type 'break' to cancel.
 JonDoConsole#password> <passwort>
 You are logged in...
 
 JonDoConsole> status
 State:CONNECTED, AutoSwitch:ON, ServiceFilter:'Default Filter', HTTPFilter:ON
 ...
 JonDoConsole> exit 
 \end{verbatim}

\section{More Features}

\subsubsection*{Enable anti-censorship forwarder}
China and other countries enforce their Internet censorship. The JonDo program has a built-in function for circumventing some of these blockades. Those who run an anti-censorship server themselves may help to forward affected Internet surfers to JonDonym cascades.\\

Enable anti-censorship forwarder by edit \textit{/etc/jondo/jondodaemon.conf} or \textit{\$HOME/.jondoconsole/jondodaemon.conf} (overrules the global configuration)
 \begin{verbatim}
   ENABLE_FORWARDER="yes"
   FORWARDER_LISTEN_PORT=4005
 \end{verbatim}

Make sure, your forwarder listen port is reachable from the Internet. Sometimes you have to set port forwarding on your router.\\

If you want to run only an anti-censorship forwarder and no JonDonym proxy for local access, you can disable the local proxy in \textit{jondodaemon.conf}.
 \begin{verbatim}
   ENABLE_JONDONYM="no"
 \end{verbatim}

\subsubsection*{Enable proxy usage for outgoing traffic}
If it is necessary for you to use a proxy for outgoing traffic, you can edit ''/etc/jondo/jondodaemon.conf'':
\begin{verbatim}
      USE_PROXY="yes"
      PROXY_HOST=server.tld
      PROXY_PORT=8080                                                                                                                                                                                                                                                                    
\end{verbatim}

Authentication can be set by:
\begin{verbatim}
      USE_PROXY_AUTH="yes"
      PROXY_USER="username"
      PROXY_PASS="password"
\end{verbatim}

\end{document}
