zeronet.install 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. post_install() {
  2. getent passwd zeronet &>/dev/null || {
  3. echo -n ">>> Creating zeronet user... "
  4. useradd --system --user-group -m --home /var/lib/zeronet zeronet
  5. echo "done"
  6. } # NOTE: we do not autoremove user due to security concerns (Arch policy)
  7. mkdir -p /var/log/zeronet
  8. chown zeronet:zeronet /var/log/zeronet
  9. # This is not usual practice but to editting from web interface
  10. chown zeronet:zeronet /etc/zeronet.conf
  11. # Don't run thesre operations automatically, because they are security-sensitive
  12. echo ">>> Default mode is clearnet+Tor. Give zeronet permissions to configure hidden service:"
  13. echo ">>> sudo usermod -a -G tor zeronet"
  14. echo ">>> Add/edit the following options in /etc/tor/torrc:"
  15. echo ">>> ControlPort 9051"
  16. echo ">>> DataDirectoryGroupReadable 1"
  17. echo ">>> CookieAuthentication 1"
  18. echo ">>> CookieAuthFileGroupReadable 1"
  19. echo ">>> CookieAuthFile /var/lib/tor/control_auth_cookie"
  20. echo ">>> Restart tor (reload not enough):"
  21. echo ">>> sudo systemctl restart tor"
  22. echo ">>> Run daemon and check status and view log:"
  23. echo ">>> sudo systemctl start zeronet"
  24. echo ">>> sudo systemctl status zeronet"
  25. echo ">>> sudo journalctl -u zeronet"
  26. echo ">>> NOTE: all operations including editing zerosite files,"
  27. echo ">>> should be done as user zeronet and config must be passed"
  28. echo ">>> for data directory to be selected to /var/lib/zeronet: "
  29. echo ">>> sudo -u zeronet python zeronet.py --config_file /etc/zeronet.conf ..."
  30. echo ">>> OR"
  31. echo ">>> sudo su - zeronet"
  32. echo ">>> cd /opt/zeronet"
  33. echo ">>> python zeronet.py --config_file /etc/zeronet.conf ..."
  34. }
  35. ## each separate version number must be less than 3 digit wide !
  36. function version { echo "$@" | gawk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; }
  37. post_upgrade() {
  38. chown -R zeronet:zeronet /opt/zeronet
  39. chown zeronet:zeronet /etc/zeronet.conf
  40. }