From 21b6c6158ad44300caa37c92025d7587a2dcf5f4 Mon Sep 17 00:00:00 2001 From: Stephan Oeste Date: Sat, 30 Jul 2022 13:58:41 +0200 Subject: [PATCH 1/3] Fix tor config for FreeBSD on prod installer --- production/install | 39 +++++++++++++++++++++++++++++++-------- production/torrc | 8 -------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/production/install b/production/install index 729ff33e0..4cb37e6af 100755 --- a/production/install +++ b/production/install @@ -178,7 +178,7 @@ case $OS in ROOT_GROUP=wheel ROOT_HOME=/root TOR_HOME=/var/db/tor - TOR_CONFIGURATION=/usr/local/etc/tor/torrc + TOR_CONFIGURATION=/var/db/tor/torrc TOR_RESOURCES=/var/db/tor TOR_PKG=tor TOR_USER=_tor @@ -277,6 +277,8 @@ BISQ_USER=bisq BISQ_GROUP=bisq # bisq home folder, needs about 1GB BISQ_HOME=/bisq +# tor HS folder +BISQ_TOR_HS=bisq # liquid user/group ELEMENTS_USER=elements @@ -287,6 +289,8 @@ ELEMENTS_HOME=/elements ELECTRS_HOME=/electrs # elements electrs source/binaries ELEMENTS_ELECTRS_HOME=${ELEMENTS_HOME}/electrs +# tor HS folder +LIQUID_TOR_HS=liquid # minfee user/group MINFEE_USER=minfee @@ -941,14 +945,33 @@ if [ "${TOR_INSTALL}" = ON ];then echo "[*] Installing Tor base configuration" osSudo "${ROOT_USER}" install -c -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/torrc" "${TOR_HOME}/torrc" + osSudo "${ROOT_USER}" sed -i.orig "s!__TOR_RESOURCES__!${TOR_RESOURCES}!" "${TOR_CONFIGURATION}" - echo "[*] Adding Tor HS configuration" - if ! grep "${MEMPOOL_TOR_HS}" /etc/tor/torrc >/dev/null 2>&1;then - osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceDir ${TOR_RESOURCES}/${MEMPOOL_TOR_HS}/ >> ${TOR_CONFIGURATION}" - osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServicePort 80 127.0.0.1:81 >> ${TOR_CONFIGURATION}" - osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" - else - osSudo "${ROOT_USER}" sed -i.orig "s!__TOR_RESOURCES__!${TOR_RESOURCES}!" "${TOR_CONFIGURATION}" + echo "[*] Adding Tor HS configuration for Mempool" + if [ "${MEMPOOL_ENABLE}" = "ON" ];then + if ! grep "${MEMPOOL_TOR_HS}" "${TOR_CONFIGURATION}" >/dev/null 2>&1;then + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceDir ${TOR_RESOURCES}/${MEMPOOL_TOR_HS}/ >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServicePort 80 127.0.0.1:81 >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" + fi + fi + + echo "[*] Adding Tor HS configuration for Bisq" + if [ "${BISQ_ENABLE}" = "ON" ];then + if ! grep "${BISQ_TOR_HS}" "${TOR_CONFIGURATION}" >/dev/null 2>&1;then + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceDir ${TOR_RESOURCES}/${BISQ_TOR_HS}/ >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServicePort 80 127.0.0.1:82 >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" + fi + fi + + echo "[*] Adding Tor HS configuration for Liquid" + if [ "${LIQUID_ENABLE}" = "ON" ];then + if ! grep "${LIQUID_TOR_HS}" "${TOR_CONFIGURATION}" >/dev/null 2>&1;then + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceDir ${TOR_RESOURCES}/${LIQUID_TOR_HS}/ >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServicePort 80 127.0.0.1:83 >> ${TOR_CONFIGURATION}" + osSudo "${ROOT_USER}" /bin/sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONFIGURATION}" + fi fi case $OS in diff --git a/production/torrc b/production/torrc index 454cafba0..344ebc6e4 100644 --- a/production/torrc +++ b/production/torrc @@ -13,11 +13,3 @@ CookieAuthFileGroupReadable 1 HiddenServiceDir __TOR_RESOURCES__/mempool HiddenServicePort 80 127.0.0.1:81 HiddenServiceVersion 3 - -HiddenServiceDir __TOR_RESOURCES__/bisq -HiddenServicePort 80 127.0.0.1:82 -HiddenServiceVersion 3 - -HiddenServiceDir __TOR_RESOURCES__/liquid -HiddenServicePort 80 127.0.0.1:83 -HiddenServiceVersion 3 From 8f183945c0e7713b24fb4594716c5d60c32fdf2d Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 30 Jul 2022 15:30:55 +0200 Subject: [PATCH 2/3] Fix FreeBSD path for torrc --- production/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/install b/production/install index 44488add4..8612e0f98 100755 --- a/production/install +++ b/production/install @@ -183,7 +183,7 @@ case $OS in ROOT_GROUP=wheel ROOT_HOME=/root TOR_HOME=/var/db/tor - TOR_CONFIGURATION=/var/db/tor/torrc + TOR_CONFIGURATION=/usr/local/etc/tor/torrc TOR_RESOURCES=/var/db/tor TOR_PKG=tor TOR_USER=_tor From 8d1624476f44bbb4b55bbb59df46821291565ad2 Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 30 Jul 2022 15:32:51 +0200 Subject: [PATCH 3/3] Remove TOR_HOME variable in prod/install --- production/install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/production/install b/production/install index 8612e0f98..94c9936bf 100755 --- a/production/install +++ b/production/install @@ -182,7 +182,6 @@ case $OS in ROOT_USER=root ROOT_GROUP=wheel ROOT_HOME=/root - TOR_HOME=/var/db/tor TOR_CONFIGURATION=/usr/local/etc/tor/torrc TOR_RESOURCES=/var/db/tor TOR_PKG=tor @@ -198,7 +197,6 @@ case $OS in ROOT_USER=root ROOT_GROUP=root ROOT_HOME=/root - TOR_HOME=/etc/tor TOR_CONFIGURATION=/etc/tor/torrc TOR_RESOURCES=/var/lib/tor TOR_PKG=tor @@ -985,7 +983,7 @@ if [ "${TOR_INSTALL}" = ON ];then osPackageInstall "${TOR_PKG}" echo "[*] Installing Tor base configuration" - osSudo "${ROOT_USER}" install -c -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/torrc" "${TOR_HOME}/torrc" + osSudo "${ROOT_USER}" install -c -m 644 "${MEMPOOL_HOME}/${MEMPOOL_REPO_NAME}/production/torrc" "${TOR_CONFIGURATION}" osSudo "${ROOT_USER}" sed -i.orig "s!__TOR_RESOURCES__!${TOR_RESOURCES}!" "${TOR_CONFIGURATION}" echo "[*] Adding Tor HS configuration for Mempool"