Einrichten von Whonix mit Gateway und Workstation auf zwei separaten Hosts

Einrichten von Whonix mit Gateway und Workstation auf zwei separaten Hosts

Ich habe Whonix Gateway und Workstation erfolgreich auf einer Maschine eingerichtet und verwendet. Ich möchte sie aber gerne auf unterschiedlichen Hosts einrichten, um die Speicher- und CPU-Anforderungen zu verteilen.

Ich habe nicht herausgefunden, wie ich die VMs dazu bringe, miteinander zu kommunizieren, wenn sie sich auf verschiedenen Hosts befinden. Das Gateway scheint einwandfrei zu funktionieren, wie es auch beim Betrieb mit der Workstation auf derselben Maschine der Fall war. Jetzt wird die Workstation auf einem anderen Host gestartet. Wie mache ich die Workstation (oder den Host, auf dem sie läuft) darauf aufmerksam, dass sie ein Gateway auf einem anderen Host kontaktieren muss?

Beide Hosts verwenden Linux Mint 17

Antwort1

Zunächst einige Anmerkungen: Ich habe das Zeichenlimit von StackExchange erreicht, daher handelt es sich hier um eine gekürzte Antwort. Verwenden Sie diese mit Bedacht ;-)

  • private Brücke Tor ~=~ Gateway Whonix

  • Proxy-Client Tor ~=~ Workstation Whonix

Diese Begriffe werden synonym verwendet, und es gibt noch andere Begriffe für diese Art von Setups. Ich werde im Folgenden möglichst die Whonix-Begriffe verwenden.

Was Sie wahrscheinlich suchen, nennt manMittelboxoderprivate Brückefür Ihr Gateway-Gerät und Client ( trans-proxy)-Setup. DieRaspberryPiDas Team bei Adafruit bietet eine recht gut zusammengestellte Anleitung zum Einrichten der physischen Isolation mit benutzerdefinierten torrcKonfigurationen und iptablesZaubertricks. Die Anforderungen an Ihr Gateway sind, dass es über zwei Netzwerkschnittstellen verfügt, dies kann eth0und eth1oder usb0oder sein ppp0, und Ihre Workstation (Client) sollte nur eine physische Netzwerkschnittstelle haben; vorzugsweise eth0oder usb0versuchen Sie, dies zu vermeiden wlan0, da es verlockend ist, denn Sie setzen sich damit lokalen Angriffen und Überwachungen aus, die nicht einfach zu mildern und leicht anzugreifen sind. Diese Anleitungen sind auch unter dem Namen „Tor WiFi Hotspot“ bekannt, also erweitern Sie Ihre Suchanfragen vielleicht auf Linux im Allgemeinen und Tor im Besonderen. Obwohl ich die Verwendung von WiFi nicht empfehlen würde, können die Anleitungen, die das Thema behandeln, leicht geändert werden, indem Sie auf Ihrem Gateway wlan0gegen gegen auf Ihrer Workstation tauschen.eth1wlan0eth0

Ich habe für diesen Anlass ein Skriptpaket geschrieben,Dein Glückstag, weil ich gerade den ersten Entwurf eines Skriptpakets veröffentlicht habe, das, wenn es fertig ist, auch die Prüfung der Sicherheit Ihrer Konfigurationen ermöglicht. Sehen Sie sich den Quellcode auf GitHub an und sehen Sie sich die /functions/tor/torrc_writers/torrc_bridge_configs.shDatei für die verschiedenen verfügbaren Konfigurationen an. Wenn es unten ein Skript/eine Funktion ohne klare Dokumentation gibt, öffnen Sie ein Problem und ich werde versuchen, beim nächsten Push mehr Informationen hinzuzufügen. Ich werde in den nächsten Tagen Funktionen hinzufügen und Fehler beheben, aber hier ist ein einfaches Beispiel für eine Variablendatei zum Laden, falls Sie es ausprobieren möchten.

_application_list="tor"
_enable_ipv6="no"
#_external_ipv4=""
#_external_ipv6=""
_install_method="safe"
#_nat_ipv4=""
#_nat_ipv6=""
_temp_dir="/tmp"
_tor_user="debian-tor"
_tor_directory="/etc"
_bridge_types="private"
_tor_or_port="443"

Rufen Sie dann das Skript mit der obigen Variablendatei mit folgendem

bash /home/${USER}/Downloads/Perinoid_Linux_Project/sandcastle.sh --var-file="/path/to/bridge_variables.sh"

und wenn es funktioniert (die meistenMagiesind in /functions/shared/arg_checker.shder Funktion vorgefertigt, wenn Sie sich fragen) es sollte das Gateway so konfigurieren, wie Sie es wünschen und mit seinen eigenen separaten Start-/Stopp-Skripten sollte es so einfach sein, nur den Bridge-Dienst auf dem Gateway-Gerät zu starten wie

sudo /etc/init.d/tor-bridge restart

Für die Workstation sollte es möglich sein, die Gateway-Bridge auf dem Gateway-Gerät zu verwenden. Die Firewall muss noch geskriptet werden, aber ich habe einen Ausgangspunkt zum iptablesFiltern und Weiterleiten im /firewallVerzeichnis bereitgestellt, das Sie möglicherweise auch durchsuchen möchten.

Modifizierter Code zur Beantwortung der spezifischen Frage

Hier ist eine modifizierte Version (ich habe einfach die relevanten Teile aus dem oben verlinkten Code herausgezogen und sie modifiziert, um zu zeigen, wie einfach dieser Code umfunktioniert werden kann), die auf jedem Debian-basierten Chroot-Jail oder Virtualisierungs-Jail verwendet werden kann. Sie wird sudointern ausgeführt, sodass Sie zur Eingabe eines Passworts aufgefordert werden, was normal ist, und diese Version geht davon aus, dass Tor bereits installiert wurde.

Verwenden Sie es bash, um diese Version auszuführen, d. h., bash bridge_tor_script.shdamit Variablen und Funktionen richtig funktionieren. Der folgende Code ist nur für das Gateway-Gerät vorgesehen. Sie müssen noch eine Bridge-Vernetzung und Weiterleitung zum Workstation-Gerät einrichten und die Workstation so sperren, dass sie nur die vom Gateway bereitgestellte IP verwendet.

Write_tor_bridge_configs(){
    ## Modify the stuff between quotes if non-standerd installation paths where used
    Activate_torrc_nonclient "debian-tor" "bridge"
    Write_tor_init_nonclient "/etc" "debian-tor" "bridge" "bridge" "/etc"
    Torrc_bridge_configs "/etc" "bridge" "debian-tor" "443" "192.168.1.3"
}
Torrc_bridge_configs(){
    _tor_dir="${1:-/etc}/tor"
    _tor_node_name="${2:-bridge}"
    _tor_user="${3:-debian-tor}"
    _tor_or_port="${4:-443}"
    _bridge_type="${5:-private}"
    _nat_ipv4="${6:?Error no local NAT IP passed to Torrc_bridge_configs function}"
    _external_ipv4="${7:?Error no external IP passed to Torrc_bridge_configs function}
    echo "## Attention [Torrc_bridge_configs] function writing general configuration lines to [${_tor_dir}/torrc-bridge] file"
    echo "User ${_tor_user}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo 'RunAsDaemon 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "DataDirectory /var/lib/tor_${_tor_node_name}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "PidFile /var/run/tor_${_tor_node_name}.pid" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo 'AvoidDiskWrites 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo 'BridgeRelay 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "RelayBandwidthRate 100 Kbytes" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "RelayBandwidthBurst 200 Kbytes" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "BandwidthRate 300 Kbytes" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "BandwidthBurst 350 Kbytes" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo 'AccountingStart month 1 00:00' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "AccountingMax 80 GB" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "ORPort ${_tor_or_port:-443}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo 'ClientOnly 0' | sudo tee -a ${_torrc_dir}/torrc-${_tor_node_name}
    echo 'ExcludeSingleHopRelays 1' | sudo tee -a ${_torrc_dir}/torrc-${_tor_node_name}
    echo 'Exitpolicy reject *:*' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "## Only uncomment next line if geoip support is confermed" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "#GeoIPFile ${_tor_dir}/geoip" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
    echo "## Notice [Torrc_bridge_configs] function writing spicific configuration lines to [${_tor_dir}/torrc-bridge] file"
    echo "# based on arguments passed via [-T] and [-B] and [-vf] arguments."
    for _node_type in ${_bridge_type//,/ }; do
        case $_node_type in
            private)
                echo 'PublishServerDescriptor 0' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "Address ${_nat_ipv4}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "ORListenAddress ${_nat_ipv4}:${_tor_or_port:-443}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'VirtualAddrNetwork 10.192.0.0/10' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'AutomapHostsOnResolve 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'TransPort 9040' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'DNSPort 9053' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "TransListenAddress ${_nat_ipv4}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "DNSPort 9053" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "DNSListenAddress ${_nat_ipv4}" | sudo tee -a ${_torrc_dir}/torrc-${_tor_node_name}
            ;;
            public)
                echo 'PublishServerDescriptor 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "Address ${_external_ipv4}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "OutboundBindAddress ${_external_ipv4}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo "ORListenAddress ${_external_ipv4}:${_tor_or_port:-443}" | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'SocksPort 0' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
            ;;
            authoritative)
                echo 'AuthoritativeDirectory 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
                echo 'BridgeAuthoritativeDir 1' | sudo tee -a ${_tor_dir}/torrc-${_tor_node_name}
            ;;
        esac
    done
}
Write_tor_init_nonclient(){
    _tor_dir="${1:-/etc}"
    _tor_node_user="${2:-debian-tor}"
    _tor_node_nickname="${3:?}"
    _tor_node_type="${4:?}"
    _init_dir="${5:-/etc}/init.d"
    echo "## Attention [Write_tor_init] function now writing init script with assigned variables"
    echo "# to [${_init_dir}/tor_${_tor_node_type}] file for node [${_tor_node_nickname}] nickname..."
    echo '#!/bin/bash' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '### BEGIN INIT INFO' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "# Provides:       tor ${_tor_node_nickname}" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Required-Start:     $local_fs $remote_fs $network $named $time' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Required-Stop:      $local_fs $remote_fs $network $named $time' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Should-Start:       $syslog' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Should-Stop:        $syslog' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Default-Start:      2 3 4 5' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Default-Stop:       0 1 6' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Short-Description:  Starts The Onion Router daemon processes' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Description:        Starts The Onion Router, a TCP overlay' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '#             network client that provides anonymous' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '#             trasport. See following link for source' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '#             of this script' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '#             https://terminal28.com/anonymity-online-how-to-install-and-configure-squid3-tor-privoxy-debian-ubuntu-linux/' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '### END INIT INFO' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'set -e' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    ## Note if installing from source some of these file path
    #   variables may need changed
    echo 'DAEMON=/usr/sbin/tor' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "NAME=tor" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'DESC="tor daemon"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "CONFDIR=${_tor_dir:-/etc}/tor" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "TORPIDDIR=/var/run/tor_${_tor_node_nickname}" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "TORPID=\$TORPIDDIR/tor_${_tor_node_nickname}" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "DEFAULTSFILE=${_tor_dir:-/etc}/defaults/\$NAME" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'WAITFORDEAMON=60' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "ARGS=\"--quiet -f\"\$CONFDIR/torrc-${_tor_node_nickname}\"" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Set sane defaults' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'if [ -r /proc/sys/fs/file-max ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  system_max=`cat /proc/sys/fs/file-max`' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if [ "$system_max" -gt "80000" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      MAX_FILEDESCRIPTORS=32768' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  elif [ "$system_max" -gt "40000" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      MAX_FILEDESCRIPTORS=16384' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  elif [ "$system_max" -gt "10000" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      MAX_FILEDESCRIPTORS=8192' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      MAX_FILEDESCRIPTORS=1024' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      cat << EOF' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'Warning: Your system has very few filedescriptors available in total' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "Maybe you should try rassing that by adding 'fs.file-max=10000' to your" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '/etc/sysctl.conf file. Feel free to pick any number that you deem appropriate.' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "Then run 'sysctl -p'. See /proc/sys/fs/file-max for the current value, and" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'file-nr in the same directory for how many of those are sed at the moment' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'EOF' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  MAX_FILEDESCRIPTORS=8192' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'NICE=""' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'test -x $DEAMON || exit 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '# Include tor defaults if available' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'if [ -f $DEFAULTSFILE ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  . $DEFAULTSFILE' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'wait_for_deaddaemon () {' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  pid=$1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  sleep 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if test -n "$pid"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if kill -0 $pid 2>/dev/null' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo -n "."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          cnt=0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          while kill -0 $pid 2>/dev/null' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          do' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '              cnt=`expr $cnt + 1`' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '              if [ $cnt -gt $WAITFORDAEMON  ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '                  echo "still running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '                  exit 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '              fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '              sleep 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '              echo -n "."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          done' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  return 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '}' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'check_torpiddir () {' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if test ! -d $TORPIDDIR' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "There is no $TORPIDDIR directory. Creating one for you."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      mkdir -m 02750 "$TORPIDDIR"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "      chown ${_tor_node_user:-debian-tor}:${_tor_node_user:-debian-tor} \"\$TORPIDDIR\"" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if test ! -x $TORPIDDIR' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "Cannot access $TORPIDDIR directory, are you root?" >&2' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      exit 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '}' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'check_config () {' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if ! $DAEMON --verify-config > /dev/null' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "ABORTED: Tor configuration invalid" >&2' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      $DAEMON --verify-config >&2' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      exit 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '}' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'check_torlogdir () {' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if ! [ -d "$TORLOGDIR" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      mkdir -m 02750 "$TORLOGDIR"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "      chown ${_tor_node_user:-debian-tor}:adm \"\$TORLOGDIR\"" | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      ! [ -x /sbin/restorecon ] || /sbin/restorecon \"$TORLOGDIR\"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '}' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'case "$1" in ' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  start)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if [ "$RUN_DAEMON" != "yes" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "Not starting $DESC (Dissabled in $DEFAULTSFILE)."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      exit 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  if [ -n "$MAX_FILEDESCRIPTORS" ]; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo -n "Raising maximum number of filedescriptors (ulimit -n) to $MAX_FILEDESCRIPTORS"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if ulimit -n "$MAX_FILEDESCRIPTORS"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo ": FAILED."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  check_torpiddir' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  check_torlogdir' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  echo "Starting $DESC: $NAME..."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  check_config' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  echo "Starting $DESC: $NAME..."' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    ## Notice 1 : This is where firejail should be added if used,
    #   otherwise try another "Sandbox" utility for keeping unknown
    #   vunerabilities from easily infecting the rest of your system
    ## Notice 2 : This is also one of the places to modify if installing
    #   app-amore from source, if you expect the next [if] statment
    #   to find the app-armor exicutables
    ## Notice 3 : Additionally this is where calls to chroot should
    #   be preformed if running in chroot jail.
    echo '  if start-stop-daemon --stop --signal 0 --quiet --pidfile $TORPID --exec $DAEMON; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "$NAME already running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if [ "$USE_AA_EXEC" = "yes" ] && [ -x /usr/sbin/aa-status ] && [ -x /usr/sbin/aa-exec ] && [ -e /etc/apparmor.d/system_tor ] && /usr/sbin/aa-status --enabled ; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          AA_EXEC="--startas /usr/sbin/aa-exec"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          AA_EXEC_ARGS="--profile=system_tor -- $DAEMON"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          AA_EXEC=""' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          AA_EXEC_ARGS=""' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if start-stop-daemon --start --quiet --pidfile $TORPID $NICE $AA_EXEC --exec $DAEMON -- $AA_EXEC_ARGS $DEFAULT_ARGS $ARGS; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$NAME done"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "Error starting $NAME"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  stop)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo -n "Stopping $DESC: "' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      pid=$(cat $TORPID 2>/dev/null) || true' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if ! test -f $TORPID -o -z "$pid"; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "not running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if start-stop-daemon --stop --signal INT --quite --pidfile $TORPID --exec $DAEMON; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          wait_for_deaddaemon $pid' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      elif kill -0 $pid 2>/dev/null; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "Is $pid not $NAME? Is $DAEMON a different binary now?"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$DAEMON died: process $pid not running; or permission denied"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    ## End of nessisary edits section
    echo '  reload|force-reload)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      check_config' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "Reloading $DESC configuration"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      pid=$(cat $TORPID 2>/dev/null) || true' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if test ! -f $TORPID -o -z "$pid"; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "not running - there is no $TORPID"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if start-stop-daemon --stop --signal 1 --quiet --pidfile $TORPID --exec $DAEMON' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "done"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      elif kill -0 $pid 2>/dev/null; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "Is $pid not $NAME? Is $DAEMON a different binary now?"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$DAEMON died: process $pid not running; or permission denied"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  restart)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      check_config' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      $0 stop' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      sleep 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      $0 start' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  status)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if test ! -r $(dirname $TORPID); then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "cannot read PID file $TORPID"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 4' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      pid=$(cat $TORPID 2>/dev/null) || true' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if test ! -f $TORPID -o -z "$pid"; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$NAME is not running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 3' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      if ps "$pid" >/dev/null 2>&1; then' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$NAME is running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      else' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          echo "$NAME is not running"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '          return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      fi' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  *)' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      echo "Usage: $0 (start|stop|restart|reload|force-reload|status)"' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '      return 1' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo '  ;;' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'esac' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo 'exit 0' | sudo tee -a ${_init_dir}/tor_${_tor_node_type}
    echo "## Attention [Write_tor_init] function finished writing init file for [${_tor_node_type}]]"
    echo "# now providing [${_init_dir}/tor_${_tor_node_type}] exicutable permissions"
    sudo chmod +x ${_init_dir}/tor_${_tor_node_type}
}
Activate_torrc_nonclient(){
    _tor_node_user="${1:-debian-tor}"
    _tor_node_name="${2:?}"
    echo "## Activating configs for [torrc-${_tor_node_name}] now."
    echo "# With lib file path under [/var/lib/tor_${_tor_node_name}]"
    sudo install -o ${_tor_user:-debian-tor} -g ${_tor_user:-debian-tor} -m 700 /var/lib/tor_${_tor_node_name:-service} || Arg_checker --help='Activate_torrc_nonclient' --exit='# [sudo install -o ${_tor_user:-debian-tor} -g ${_tor_user:-debian-tor} -m 700 /var/lib/tor_${_tor_node_name}] # Failed'
}
Write_tor_bridge_configs

Mit den oben genannten Informationen sollten Sie Ihren Zielen näher kommen. Wie bereits erwähnt werde ich das Hauptskriptpaket debuggen und Funktionen hinzufügen. Sie können also gerne Anfragen über das Tracking-System von GitHub stellen. Bis zum Ende des Monats (sofern Zeit und Gesundheit vorhanden sind) werde ich Installationsprogramme für Whonix hinzufügen, brauche aber Hilfe beim Testen, da alle meine Systeme bei der Installation KVMund VMWareden Voraussetzungen Probleme zu haben scheinen.

verwandte Informationen