Skip to content

Commit

Permalink
v6.27
Browse files Browse the repository at this point in the history
+ DietPi-Software | Tor: Remove deprecated entries from config file
+ DietPi-Software | Tor: Leave/move logs in/to journal (stdout of systemd unit)
+ DietPi-Software | Tor: Remove obsolete sysvinit service and config
  • Loading branch information
MichaIng authored Dec 12, 2019
1 parent 3cc5220 commit 79a1f9d
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -1271,16 +1271,16 @@ DietPi-Software will decrypt and use it for software installs. You can change it

aSOFTWARE_NAME[$software_id]='WiFi Hotspot'
aSOFTWARE_DESC[$software_id]='turn your device into a wifi hotspot'
aSOFTWARE_CATEGORY_INDEX[$software_id]=8
aSOFTWARE_TYPE[$software_id]=0
aSOFTWARE_CATEGORY_INDEX[$software_id]=8
aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1207#p1207'
#------------------
software_id=61

aSOFTWARE_NAME[$software_id]='Tor Hotspot'
aSOFTWARE_DESC[$software_id]='optional: route hotspot traffic through tor'
aSOFTWARE_CATEGORY_INDEX[$software_id]=8
aSOFTWARE_TYPE[$software_id]=0
aSOFTWARE_CATEGORY_INDEX[$software_id]=8
aSOFTWARE_ONLINEDOC_URL[$software_id]='p=1529#p1529'

# System stats
Expand Down Expand Up @@ -9717,37 +9717,35 @@ _EOF_

Banner_Configuration

# - Tor config
# Remove obsolete sysvinit service and config
[[ -f '/etc/init.d/tor' ]] && rm /etc/init.d/tor
update-rc.d -f tor remove
[[ -f '/etc/default/tor' ]] && rm /etc/default/tor

# Tor config
cat << _EOF_ > /etc/tor/torrc
Log notice file /var/log/tor/notices.log
Log notice stdout
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 192.168.42.1
DNSPort 53
DNSListenAddress 192.168.42.1
TransPort 192.168.42.1:9040
DNSPort 192.168.42.1:53
_EOF_

# - Flush IP tables
# Flush IP tables
iptables -F
iptables -t nat -F

# - Generate tor prerouting tables
local wifi_index=$(sed -n 2p /DietPi/dietpi/.network)
# Generate tor prerouting tables
local wifi_index=$(mawk 'NR==2' /DietPi/dietpi/.network)
iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --dport 22 -j REDIRECT --to-ports 22
iptables -t nat -A PREROUTING -i wlan$wifi_index -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --syn -j REDIRECT --to-ports 9040

# - Save
# Save IP tables
iptables-save > /etc/iptables.ipv4.nat

# - Generate Logfile
mkdir -p /var/log/tor
> /var/log/tor/notices.log
chown -R debian-tor:nogroup /var/log/tor/notices.log

# - User: Test tor is functional.
# User: Test tor is functional
#https://check.torproject.org

fi
Expand Down Expand Up @@ -13494,17 +13492,19 @@ _EOF_
if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then

Banner_Uninstalling
rm -R /root/wiringPi* &> /dev/null
rm -Rf /root/wiringPi*

fi

software_id=61
software_id=61 # Tor Hotspot
if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then

Banner_Uninstalling
G_AGP tor

# - uninstall WIFIHOTSPOT ALSO. Due to IPtables needing reset.
[[ -d '/var/log/tor' ]] && rm -R /var/log/tor # pre-v6.27

# Uninstall WIFIHOTSPOT ALSO. Due to IPtables needing reset
aSOFTWARE_INSTALL_STATE[60]=-1

fi
Expand Down

0 comments on commit 79a1f9d

Please sign in to comment.