summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-02-26 21:29:24 -0600
committerIván Ávalos <avalos@disroot.org>2024-02-26 21:29:24 -0600
commit7bfb0a93c4664d79be8a87c60c7c0f615e1fa045 (patch)
treeb631f35d078f08faaa2352d5b4e3d315bd2309b3
parentcd70aaeaf604f5fda3a38686693430d4c0a7718d (diff)
downloaddeployment-7bfb0a93c4664d79be8a87c60c7c0f615e1fa045.tar.gz
deployment-7bfb0a93c4664d79be8a87c60c7c0f615e1fa045.tar.bz2
deployment-7bfb0a93c4664d79be8a87c60c7c0f615e1fa045.zip
Add exchange ToS/PP to regional currency script
bug 0008512
-rwxr-xr-xregional-currency/ask_questions.py41
-rwxr-xr-xregional-currency/install_packages.sh12
-rwxr-xr-xregional-currency/setup-exchange.sh33
3 files changed, 85 insertions, 1 deletions
diff --git a/regional-currency/ask_questions.py b/regional-currency/ask_questions.py
index 200f779..49a1dd3 100755
--- a/regional-currency/ask_questions.py
+++ b/regional-currency/ask_questions.py
@@ -267,3 +267,44 @@ ask_str(
"8. Enter the admin password for the bank (or press enter to autogenerate password): ",
str(uuid.uuid4()),
)
+
+def ask_tos_file(name: str, msg: str) -> str:
+ "Prompt the user to select a ToS/privacy policy"
+
+ # msg = "9.1. Enter the filename of the ToS. Some available options are:\n"
+ tos_msg = msg
+
+ # Recollect example ToS files
+ tos_path = "/usr/share/taler/terms"
+ for f in os.listdir(tos_path):
+ tos_file = os.path.join(tos_path, f)
+ if os.path.isfile(tos_file) and f.endswith(".rst"):
+ tos_msg += f"- {tos_file}\n"
+
+ tos_msg += "=> "
+
+ return ask_str(
+ name,
+ tos_msg,
+ os.path.join(tos_path, "exchange-tos-v0.rst")
+ )
+
+if ask_yes_no(
+ "DO_EXCHANGE_TERMS",
+ "9. Do you wish to configure terms of service (ToS) for the exchange? (Y/n): ",
+ False,
+):
+ ask_tos_file(
+ "EXCHANGE_TERMS_FILE",
+ "9.1. Enter the filename of the ToS. Some available options are:\n"
+ )
+
+if ask_yes_no(
+ "DO_EXCHANGE_PRIVACY",
+ "10. Do you wish to configure a privacy policy for the exchange? (Y/n): ",
+ False,
+):
+ ask_tos_file(
+ "EXCHANGE_PRIVACY_FILE",
+ "10.1. Enter the filename of the privacy policy. Some available options are:\n"
+ )
diff --git a/regional-currency/install_packages.sh b/regional-currency/install_packages.sh
index 0ef5031..3f1a614 100755
--- a/regional-currency/install_packages.sh
+++ b/regional-currency/install_packages.sh
@@ -30,8 +30,18 @@ apt install uuid-runtime \
postgresql-client-${PG_VERSION} \
dbconfig-pgsql \
certbot \
+ latexmk \
+ texlive-latex-extra \
+ texlive-latex-recommended \
+ tex-gyre \
+ python3-sphinx \
+ python3-pip \
python3-certbot-nginx -y &>> setup.log
+pip3 install --break-system-packages \
+ sphinx-markdown-builder \
+ htmlark
+
## Add GNU Taler deb.taler.net to /etc/apt/sources.list
say "Adding GNU Taler apt repository"
@@ -63,4 +73,4 @@ apt install taler-exchange \
taler-wallet-cli \
taler-exchange-offline \
libeufin-bank \
- libeufin-nexus -y &>> setup.log \ No newline at end of file
+ libeufin-nexus -y &>> setup.log
diff --git a/regional-currency/setup-exchange.sh b/regional-currency/setup-exchange.sh
index 8618f07..ecaa597 100755
--- a/regional-currency/setup-exchange.sh
+++ b/regional-currency/setup-exchange.sh
@@ -100,6 +100,34 @@ systemctl stop taler-exchange.target &>> setup.log
say "Configuring exchange"
+# Generate terms of service (ToS)
+TERMS_ETAG=
+if test ${DO_EXCHANGE_TERMS} == y; then
+ if test -z "${EXCHANGE_TERMS_FILE:-}"; then
+ say "Error: No EXCHANGE_TERMS_FILE set but DO_EXCHANGE_TERMS set to YES"
+ exit 1
+ fi
+
+ TERMS_ETAG="$(basename "$EXCHANGE_TERMS_FILE" .rst)"
+
+ say "Setting up terms of service (ToS)"
+ taler-terms-generator -i "${EXCHANGE_TERMS_FILE}" &>> setup.log
+fi
+
+# Generate privacy policy
+PRIVACY_ETAG=
+if test ${DO_EXCHANGE_PRIVACY} == y; then
+ if test -z "${EXCHANGE_PRIVACY_FILE:-}"; then
+ say "Error: No EXCHANGE_PRIVACY_FILE set but DO_EXCHANGE_PRIVACY set to YES"
+ exit 1
+ fi
+
+ PRIVACY_ETAG="$(basename "$EXCHANGE_PRIVACY_FILE" .rst)"
+
+ say "Setting up the privacy policy"
+ taler-terms-generator -i "${EXCHANGE_PRIVACY_FILE}" &>> setup.log
+fi
+
export EXCHANGE_BASE_URL="$PROTO://exchange.${DOMAIN_NAME}/"
cat << EOF > /etc/taler/conf.d/setup.conf
@@ -115,6 +143,11 @@ STEFAN_ABS=${CURRENCY}:0
STEFAN_LOG=${CURRENCY}:0
STEFAN_LIN=0
+TERMS_DIR=/var/lib/taler/terms/
+TERMS_ETAG=${TERMS_ETAG}
+PRIVACY_DIR=/var/lib/taler/privacy/
+PRIVACY_ETAG=${PRIVACY_ETAG}
+
[merchant-exchange-${DOMAIN_NAME}]
MASTER_KEY=${MASTER_PUBLIC_KEY}
CURRENCY=${CURRENCY}