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