我已經在一台機器上成功設定和使用 whonix 閘道和工作站。但我想將它們設置在不同的主機上,以分散記憶體和 CPU 要求。
我還沒有找到如何讓虛擬機器在不同主機上時相互通訊。網關似乎運作正常,就像在同一台電腦上與工作站一起運作時一樣。現在工作站在不同的主機上啟動,如何讓工作站(或其執行的主機)知道必須聯絡不同主機上的網關?
兩台主機都運行 Linux Mint 17
答案1
首先是一些註釋;我達到了 StackExchange 字元限制,所以這是一個簡短的答案;明智地使用;-)
私人網橋 Tor ~=~ 網關 Whonix
代理客戶端 Tor ~=~ 工作站 Whonix
這些術語可以互換使用,而這些類型的設定還有其他術語,我將盡可能嘗試在以下大部分內容中使用 Whonix 術語。
您可能正在尋找的內容稱為中間盒或者私人橋用於您的網關設備和用戶端 ( trans-proxy
) 設定。這樹莓派Adafruit 團隊主辦了一份相當完善的指南,介紹如何使用自訂torrc
配置和iptables
魔法設定物理隔離。對網關的要求是它有兩個網路接口,可以是eth0
andeth1
或usb0
or ppp0
,並且您的工作站(客戶端)應該只有一個實體網路接口;最好eth0
或usb0
盡量避免wlan0
,因為它很誘人,您將使自己面臨更本地化的攻擊和監控,而這些攻擊和監控不容易緩解且易於攻擊。這些指南也以「Tor WiFi 熱點」為名,因此也許可以將您的搜尋查詢擴展到 Linux,特別是 Tor。雖然我不建議使用 WiFi,但是可以透過在網關和工作站上進行交易wlan0
來輕鬆修改涵蓋該主題的指南。eth1
wlan0
eth0
我一直在為這個場合寫一個腳本包,你的幸運日,因為我剛剛發布了腳本包的初稿,完成後也將允許審核您的設定安全性。瀏覽 GitHub 上的原始程式碼並查看/functions/tor/torrc_writers/torrc_bridge_configs.sh
檔案以了解各種可用的配置。如果底部有一個沒有明確文件的腳本/函數,請提出一個問題,我將嘗試讓下一次推送包含更多資訊。我將在接下來的幾天內添加功能和調試,但如果您想測試它,這裡有一個簡單的變數檔案範例可以加載。
_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"
然後使用上面的變數檔案呼叫腳本,如下所示
bash /home/${USER}/Downloads/Perinoid_Linux_Project/sandcastle.sh --var-file="/path/to/bridge_variables.sh"
如果它有效(大多數魔法如果您想知道,它應該在/functions/shared/arg_checker.sh
功能中執行)它應該像您希望的那樣配置網關,並使用它自己的單獨的啟動/停止腳本,在網關設備上啟動橋接服務應該像下面一樣簡單
sudo /etc/init.d/tor-bridge restart
對於工作站來說,應該可以在網關設備上使用網關的網橋。防火牆尚未編寫腳本,但我已經在您可能想要查看的目錄iptables
中提供了過濾和轉發的起始位置。/firewall
修改後的程式碼用於回答所提出的具體問題
這是一個修改後的版本(只是從上面連結的程式碼中提取了相關部分並對其進行了修改,以顯示該程式碼的重新用途是多麼容易),可以在任何基於Debian 的chroot 監獄或虛擬化監獄中使用。它將sudo
在內部運行,因此會提示輸入密碼,這是正常的,並且此版本預計 Tor 已安裝。
用於bash
運行此版本,即使bash bridge_tor_script.sh
變數和函數正常工作。以下代碼僅適用於網關設備,您仍需要設定橋接網路並轉送至工作站設備並鎖定工作站,使其僅使用網關提供的 IP。
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
上面的內容應該會讓你更接近你的目標,就像之前所說的那樣,我將在月底之前調試主腳本包並添加功能,因此請隨時透過 GitHub 的追蹤系統提出請求(提供健康和時間)我將為Whonix 添加安裝程序,但需要幫助測試,因為我的所有系統似乎都在安裝KVM
和VMWare
先決條件方面與我作鬥爭。