Zuerst einige Notizen; Ich habe das StackExchange-Charictar-Limit XP erreicht, daher ist dies eine verkürzte Antwort. mit Bedacht einsetzen ;-)
Diese Begriffe werden austauschbar verwendet, und es gibt andere Begriffe, die diese Art von Setups genannt werden. Ich werde versuchen, die Whonix-Begriffe für die meisten der folgenden Begriffe so weit wie möglich zu verwenden.
Was Sie suchen wahrscheinlich als refered wird im mittleren Feld oder Liguster Brücke für die Gateway - Gerät und Client ( trans-proxy
) Einrichtung der Raspberry Pi Team bei Adafruit hosten eine recht gut togeather führen zu setzen , wie die physische Isolation mit benutzerdefinierten einzurichten torrc
configs und iptables
magics . Die Anforderungen für Ihr Gateway bestehen darin, dass es über zwei Netzwerkschnittstellen verfügt. Dies kann sein eth0
und eth1
oder usb0
oder ppp0
und Ihre Workstation (Client) sollte nur eine physische Netzwerkschnittstelle haben. vorzugsweise eth0
oder usb0
versuchen zu vermeidenwlan0
So verlockend es auch ist, Sie lassen sich offen für Angriffe und Motitoring, die nicht einfach zu mildern und leicht anzugreifen sind. Diese Anleitungen werden auch unter dem Namen "Tor WiFi Hot-Spot" geführt. Erweitern Sie Ihre Suchanfragen also möglicherweise auf Linux im Allgemeinen und Tor spicifficly. Obwohl ich die Verwendung von WiFi nicht empfehlen würde, können die Anleitungen, die das Thema behandeln, einfach über den Handel wlan0
für eth1
auf Ihrem Gateway und wlan0
für eth0
auf Ihrer Workstation geändert werden .
Ich habe ein Skriptpaket für diesen Anlass geschrieben, Ihren Glückstag , weil ich gerade den ersten Entwurf eines Skriptpakets veröffentlicht habe, mit dem Sie auch die Sicherheit Ihrer Konfigurationen überprüfen können. Sehen Sie sich den Quellcode auf GitHub an und sehen Sie in der /functions/tor/torrc_writers/torrc_bridge_configs.sh
Datei nach, welche Verias-Konfigurationen verfügbar sind. Wenn es unten ein Skript / eine Funktion ohne klare Dokumentation gibt, öffnen Sie ein Problem und ich werde versuchen, dass der nächste Push weitere Informationen enthält. Ich werde in den nächsten Tagen Funktionen hinzufügen und Fehler beheben, aber hier ist ein einfaches Beispiel für eine variable Datei, das Sie laden können, wenn Sie es testen 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 wie folgt auf
bash /home/${USER}/Downloads/Perinoid_Linux_Project/sandcastle.sh --var-file="/path/to/bridge_variables.sh"
und wenn es funktioniert (die meisten Magics sind in der /functions/shared/arg_checker.sh
Funktion vorgeformt , wenn Sie sich fragen), sollte es das Gateway so konfigurieren, wie Sie es wünschen, und mit seinen eigenen separaten Start / Stopp-Skripten sollte es genauso einfach sein, nur den Brückendienst 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-Brücke auf dem Gateway-Gerät zu verwenden. Die Firewall muss noch mit einem Skript versehen werden, aber ich habe einen Ausgangspunkt für das Filtern und Weiterleiten von iptables in dem /firewall
Verzeichnis bereitgestellt , das Sie möglicherweise auch durchsuchen möchten.
~~~
Modifide-Code zur Beantwortung der gestellten Frage
~~~
Hier ist eine Modifide-Version (einfach die relevanten Bits aus dem oben verlinkten Code herausgezogen und modifiziert, um zu zeigen, wie einfach dieser Code erneut verwendet werden kann), die in jedem Debian-basierten Chroot-Gefängnis oder Virtulisierungs-Gefängnis verwendet werden kann. Es wird sudo
intern ausgeführt, sodass Sie zur Eingabe eines Kennworts aufgefordert werden. Das ist normal, und diese Version erwartet, dass Tor bereits installiert wurde.
Verwenden Sie bash
diese Option , um diese Version auszuführen bash bridge_tor_script.sh
, damit Variablen und Funktionen ordnungsgemäß funktionieren. Der folgende Code ist nur für das Gateway-Gerät vorgesehen. Sie müssen weiterhin ein Bridge-Netzwerk einrichten und an das Workstation-Gerät weiterleiten und die Workstation so sperren, dass nur die vom Gateway bereitgestellte IP-Adresse verwendet wird.
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
~~~
Beispiel für das Ende des Skripts
~~~
Das oben Genannte sollte Sie näher an Ihre Ziele bringen, wie bereits erwähnt. Ich werde das Hauptskriptpaket entfernen und Funktionen hinzufügen. Sie können also bis Ende des Monats Anfragen über das Tracking-System von GitHub stellen (Gesundheit und Zeit). Ich werde Installationsprogramme für Whonix hinzufügen, aber ich werde Ihnen beim Testen helfen, da alle meine Systeme mit meinen Installations- KVM
und Voranforderungen zu kämpfen scheinen VMWare
.