HelloZeroNet / Documentation

ZeroNet Documentation
https://zeronet.readthedocs.org/
GNU General Public License v2.0
74 stars 105 forks source link

Zeronet with Tor on Linux - more universal and work instructions #168

Open slrslr opened 3 years ago

slrslr commented 3 years ago

Hello,

instructions on how to setup Zeronet with Tor on Linux: https://github.com/HelloZeroNet/Documentation/blob/a6f0aff9277ba0abab59fff1dd323d904ce77ca2/docs/en/faq.md#how-to-make-zeronet-work-with-tor-under-linuxmacos

but these instructions may not be sufficing to make it working, per this comment: https://github.com/HelloZeroNet/ZeroNet/issues/1440#issuecomment-395031649

so how to change the instructions to be more universal and simple?

Can the command like the following be more efficient for various Linux distributions?

I know it means more things to fail, but i still think that it would mean higher chances people get Tor working.

  1. sudo su
  2. toruser="$(ls -l /var/lib/tor|tail -n1|awk '{print $3}')" && for var in CacheDirectoryGroupReadable CookieAuthFileGroupReadable DataDirectoryGroupReadable ExtORPortCookieAuthFileGroupReadable;do if [ "$(grep -v \"#\" /etc/tor/torrc)" != *"$var 1"* ];then sed -i "/$var/d" /etc/tor/torrc && echo "$var 1" >> /etc/tor/torrc;fi;done;sed -i "/User /d" /etc/tor/torrc && echo "User $toruser" >> /etc/tor/torrc;sudo sed -i "s|#ControlPort|ControlPort|g" /etc/tor/torrc;sudo sed -i "s|#CookieAuthentication|CookieAuthentication|g" /etc/tor/torrc;exit

More readable format:

toruser="$(ls -l /var/lib/tor|tail -n1|awk '{print $3}')"
for var in CacheDirectoryGroupReadable CookieAuthFileGroupReadable DataDirectoryGroupReadable ExtORPortCookieAuthFileGroupReadable;do
 if [ "$(grep -v \"#\" /etc/tor/torrc)" != *"$var 1"* ];then
  sed -i "/$var/d" /etc/tor/torrc && echo "$var 1" >> /etc/tor/torrc;
 fi
done
sed -i "/User /d" /etc/tor/torrc && echo "User $toruser" >> /etc/tor/torrc
sudo sed -i "s|#ControlPort|ControlPort|g" /etc/tor/torrc;sudo sed -i "s|#CookieAuthentication|CookieAuthentication|g" /etc/tor/torrc
exit

Description: It gets the Tor username checks torrc for 4 enabled variables that may be needed for the things to work (per the issue linked above) If not enabled, it will enable these It will add Tor username into the torrc (i have found on my Linux that this was necessary for the Tor to work) Then uncomment two necessary variabled in torrc

Or can some installation wizard script be part of the zeronet or the command like above would be put into github script and people just instructed to run the script ( wget --no-check-certificate https://github/script.sh -O - | sh ). I do not like sudo part in it, but to modify Torrc is needed?