From f4d9d6e4df863433d3e118409bf5f1a587894276 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 22 Jun 2022 10:23:52 +0100 Subject: [PATCH] Tor: update from Torpoject repo and readd keys #3179 --- home.admin/99updateMenu.sh | 2 +- home.admin/config.scripts/tor.install.sh | 34 ++++++++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/home.admin/99updateMenu.sh b/home.admin/99updateMenu.sh index 7640d743c..8b58ffef7 100755 --- a/home.admin/99updateMenu.sh +++ b/home.admin/99updateMenu.sh @@ -501,7 +501,7 @@ if [ "${mempoolExplorer}" == "on" ]; then fi if [ "${runBehindTor}" == "on" ]; then - OPTIONS+=(TOR "Update Tor from the source code") + OPTIONS+=(TOR "Update Tor from the Torproject repo") fi if [ "${itchysats}" == "on" ]; then diff --git a/home.admin/config.scripts/tor.install.sh b/home.admin/config.scripts/tor.install.sh index 043b00e21..7320ed03b 100755 --- a/home.admin/config.scripts/tor.install.sh +++ b/home.admin/config.scripts/tor.install.sh @@ -42,6 +42,21 @@ architecture=$(dpkg --print-architecture) #### FUNCTIONS #### +add_tor_sources(){ + echo -e "\n*** Adding deb.torproject.org keyring ***" + if ! curl -s -x socks5h://127.0.0.1:9050 --connect-timeout 10 "${tor_deb_repo_clean}/torproject.org/${tor_deb_repo_pgp_fingerprint}.asc" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/torproject.gpg >/dev/null; then + echo "!!! FAIL: Was not able to import deb.torproject.org key"; + exit 1 + fi + echo "- OK key added" + + echo -e "\n*** Adding Tor Sources ***" + echo " +deb [arch=${architecture}] ${tor_deb_repo}/torproject.org ${distribution} main +deb-src [arch=${architecture}] ${tor_deb_repo}/torproject.org ${distribution} main +" | sudo tee /etc/apt/sources.list.d/tor.list + echo "- OK sources added" +} configure_default_torrc(){ echo -e "\n*** updating Tor config ${torrc} ***" @@ -140,19 +155,7 @@ if [ "${action}" = "install" ]; then # shellcheck disable=SC2086 sudo apt install -y ${tor_pkgs} - echo -e "\n*** Adding deb.torproject.org keyring ***" - if ! curl -s -x socks5h://127.0.0.1:9050 --connect-timeout 10 "${tor_deb_repo_clean}/torproject.org/${tor_deb_repo_pgp_fingerprint}.asc" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/torproject.gpg >/dev/null; then - echo "!!! FAIL: Was not able to import deb.torproject.org key"; - exit 1 - fi - echo "- OK key added" - - echo -e "\n*** Adding Tor Sources ***" - echo " -deb [arch=${architecture}] ${tor_deb_repo}/torproject.org ${distribution} main -deb-src [arch=${architecture}] ${tor_deb_repo}/torproject.org ${distribution} main -" | sudo tee /etc/apt/sources.list.d/tor.list - echo "- OK sources added" + add_tor_sources echo -e "\n*** Reinstall ***" sudo apt update -y @@ -286,7 +289,10 @@ if [ "${action}" = "update" ]; then sudo systemctl start tor echo "# Installed $(tor --version)" ;; - *) sudo apt update && sudo apt install tor && sudo systemctl restart tor;; + *) + add_tor_sources + sudo apt update && sudo apt install tor && sudo systemctl restart tor + ;; esac echo exit