commit 830b87a45c0f6d91d766f37f753af5ead19bfc9b parent 550dbfae973c21271cdc6b71a55f6f6c6d382424 Author: Christian Grothoff <christian@grothoff.org> Date: Sun, 5 Mar 2023 00:37:41 +0100 have switch to enable online/offline key management Diffstat:
| M | netzbon/main.sh | | | 13 | +++++++++++++ |
| M | netzbon/setup-exchange.sh | | | 34 | ++++++++++++++++++++++++---------- |
2 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/netzbon/main.sh b/netzbon/main.sh @@ -33,6 +33,19 @@ then read -p "Use TLS? (y/n): " ENABLE_TLS echo "ENABLE_TLS=${ENABLE_TLS}" >> config/user.conf fi +if test -z "${DO_OFFLINE:-}" +then + read -p "Run taler-exchange-offline? (y/n): " DO_OFFLINE + echo "DO_OFFLINE=${DO_OFFLINE}" >> config/user.conf +fi +if test -z "${MASTER_PUBLIC_KEY:-}" +then + if test ${DO_OFFLINE:-y} == n + then + read -p "Enter the exchange-offline master public key: " MASTER_PUBLIC_KEY + echo "MASTER_PUBLIC_KEY=${MASTER_PUBLIC_KEY}" >> config/user.conf + fi +fi if test -z "${SANDBOX_ADMIN_PASSWORD:-}" then read -s -p "Enter the admin password for the bank: " SANDBOX_ADMIN_PASSWORD diff --git a/netzbon/setup-exchange.sh b/netzbon/setup-exchange.sh @@ -47,14 +47,25 @@ export MASTER_PRIV_DIR=.local/share/taler/exchange/offline-keys export MASTER_PRIV_FILE=${MASTER_PRIV_DIR}/master.priv if test -z ${MASTER_PUBLIC_KEY:-} then + if test ${DO_OFFLINE:-y} == n + then + say "Error: No MASTER_PUBLIC_KEY but DO_OFFLINE set to NO" + exit 1 + fi say "Setting up offline key" sudo -i -u taler-exchange-offline mkdir -p ${MASTER_PRIV_DIR} sudo -i -u taler-exchange-offline gnunet-ecc -g1 ${MASTER_PRIV_FILE} MASTER_PUBLIC_KEY=`sudo -i -u taler-exchange-offline gnunet-ecc -p ${MASTER_PRIV_FILE}` + echo "MASTER_PUBLIC_KEY=\"${MASTER_PUBLIC_KEY}\"" >> config/user.conf + if test -z ${DO_OFFLINE:-} + then + # Set 'DO_OFFLINE' + DO_OFFLINE=y + echo "DO_OFFLINE=y" >> config/user.conf + fi fi export MASTER_PUBLIC_KEY -echo "MASTER_PUBLIC_KEY=\"${MASTER_PUBLIC_KEY}\"" >> config/taler-internal.conf say "Setting up exchange database" @@ -161,15 +172,18 @@ echo "DONE" say "Offline interaction..." -taler-exchange-offline \ - -c /etc/taler/taler.conf \ - download \ - sign \ - enable-account ${EXCHANGE_PAYTO} \ - wire-fee now iban ${CURRENCY}:0 ${CURRENCY}:0 \ - global-fee now ${CURRENCY}:0 ${CURRENCY}:0 ${CURRENCY}:0 1h 6y 0 \ - upload - +if test ${DO_OFFLINE} == y +then + sudo -i -u taler-exchange-offline \ + taler-exchange-offline \ + -c /etc/taler/taler.conf \ + download \ + sign \ + enable-account ${EXCHANGE_PAYTO} \ + wire-fee now iban ${CURRENCY}:0 ${CURRENCY}:0 \ + global-fee now ${CURRENCY}:0 ${CURRENCY}:0 ${CURRENCY}:0 1h 6y 0 \ + upload +fi echo -n "Waiting for exchange /keys..." curl --max-time 2 \