[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-deployment] branch master updated: use token auth
From: |
gnunet |
Subject: |
[taler-deployment] branch master updated: use token auth |
Date: |
Tue, 15 Nov 2022 21:30:38 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository deployment.
The following commit(s) were added to refs/heads/master by this push:
new d966720 use token auth
d966720 is described below
commit d9667202ae292f5796567193ef9666ba800015a9
Author: MS <ms@taler.net>
AuthorDate: Tue Nov 15 21:30:29 2022 +0100
use token auth
---
docker/demo/config/deployment.conf | 2 +-
docker/demo/images/merchant/Dockerfile | 1 +
docker/demo/images/merchant/create_instances.sh | 15 +++++------
docker/demo/images/merchant/startup.sh | 29 ++++++++++++++++++----
.../demo/images/merchant/update_instances_auth.sh | 18 ++++++++++++++
...test-docker-mvp.sh => test-docker-localhost.sh} | 3 ++-
6 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/docker/demo/config/deployment.conf
b/docker/demo/config/deployment.conf
index aed9a06..113e0f0 100644
--- a/docker/demo/config/deployment.conf
+++ b/docker/demo/config/deployment.conf
@@ -1,6 +1,6 @@
[taler-deployment]
currency = EUR
-merchant-apikey = secret
+merchant-apikey = secret-token:salt
merchant-url = http://localhost:5556/
exchange-nexus-username = exchange-at-nexus
exchange-nexus-password = secret-at-nexus
diff --git a/docker/demo/images/merchant/Dockerfile
b/docker/demo/images/merchant/Dockerfile
index 4121177..7618081 100644
--- a/docker/demo/images/merchant/Dockerfile
+++ b/docker/demo/images/merchant/Dockerfile
@@ -3,5 +3,6 @@ FROM taler_local/taler_base
COPY taler.conf /config/taler.conf
COPY startup.sh /
COPY create_instances.sh /
+COPY update_instances_auth.sh /
RUN chmod +x /startup.sh
ENTRYPOINT /startup.sh
diff --git a/docker/demo/images/merchant/create_instances.sh
b/docker/demo/images/merchant/create_instances.sh
index 4053d90..6c0a3b7 100644
--- a/docker/demo/images/merchant/create_instances.sh
+++ b/docker/demo/images/merchant/create_instances.sh
@@ -1,21 +1,22 @@
echo -n "Create default instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$DEFAULT_IBAN'?receiver-name=Merchant43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d
'{"auth":{"method":"token","token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$DEFAULT_IBAN'?receiver-name=Merchant43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1},"default_pay_delay":{"d_us": 360 [...]
echo DONE
echo -n "Create pos instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$POS_IBAN'?receiver-name=PoS"],"id":"pos","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$POS_IBAN'?receiver-name=PoS"],"id":"pos","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000} [...]
echo DONE
echo -n "Create blog instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$BLOG_IBAN'?receiver-name=BlogCompany"],"id":"blog","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$BLOG_IBAN'?receiver-name=BlogCompany"],"id":"blog","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3 [...]
echo DONE
+
echo -n "Create GNUnet instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$GNUNET_IBAN'?receiver-name=GNUnet"],"id":"GNUnet","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$GNUNET_IBAN'?receiver-name=GNUnet"],"id":"GNUnet","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 36 [...]
echo DONE
echo -n "Create Taler instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$TALER_IBAN'?receiver-name=GNUnet"],"id":"Taler","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$TALER_IBAN'?receiver-name=GNUnet"],"id":"Taler","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600 [...]
echo DONE
echo -n "Create Tor instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$TOR_IBAN'?receiver-name=GNUnet"],"id":"Tor","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$TOR_IBAN'?receiver-name=GNUnet"],"id":"Tor","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 36000000 [...]
echo DONE
echo -n "Create survey instance..."
-curl -s -H "Content-Type: application/json" -X POST -d
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/'$SURVEY_IBAN'?receiver-name=GNUnet"],"id":"survey","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 3600000000}}'
http://merchant/management/instances
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"auth":{"method":"token",
"token":"'$BACKEND_APIKEY'"},"payto_uris":["payto://iban/SANDBOXX/'$SURVEY_IBAN'?receiver-name=GNUnet"],"id":"survey","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"'${CURRENCY}':1",
"default_max_deposit_fee":"'${CURRENCY}':1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 1000000},"default_pay_delay":{"d_us": 36 [...]
echo DONE
diff --git a/docker/demo/images/merchant/startup.sh
b/docker/demo/images/merchant/startup.sh
index 90548f0..690680b 100644
--- a/docker/demo/images/merchant/startup.sh
+++ b/docker/demo/images/merchant/startup.sh
@@ -89,15 +89,35 @@ echo "Init database... "
taler-merchant-dbinit -L DEBUG -c /config/taler.conf
echo DONE
echo -n "Launch merchant backend..."
-taler-merchant-httpd -c /config/taler.conf 2>&1 | \
+taler-merchant-httpd -a $BACKEND_APIKEY -c /config/taler.conf 2>&1 | \
rotatelogs -e /logs/taler-merchant-httpd-%Y-%m-%d 86400 &
echo DONE
sleep 1
is_serving "${BACKEND_URL}config"
-source /create_instances.sh
-
+# If the witness instance exists or has wrong auth,
+# then all the others do.
+echo -n "Checking instances existence..."
+INSTANCES_STATUS=$(curl -s -o /dev/null \
+ -w "%{http_code}" \
+ -H "Authorization: Bearer $BACKEND_APIKEY" \
+ "${BACKEND_URL}instances/Taler/private")
+echo "DONE ($INSTANCES_STATUS)"
+
+case $INSTANCES_STATUS in
+ "404")
+ echo "Taler (witness) instance not found, assuming none is."
+ source /create_instances.sh;
+ ;;
+ "401")
+ echo "Taler (witness) instance had wrong auth, assuming API key is new."
+ source /update_instances_auth.sh;
+ ;;
+ *)
+ echo Default instance found, API key correct, do nothing.
+ ;;
+esac
export TALER_ENV_URL_MERCHANT_BLOG=`taler-config -c /config/deployment.conf -s
taler-deployment -o blog-url`
export TALER_ENV_URL_MERCHANT_DONATIONS=`taler-config -c
/config/deployment.conf -s taler-deployment -o donations-url`
export TALER_ENV_URL_MERCHANT_SURVEY=`taler-config -c /config/deployment.conf
-s taler-deployment -o survey-url`
@@ -118,13 +138,12 @@ ${HOME}/.local/bin/taler-merchant-demos -c
/config/taler.conf --http-port 8083 l
echo DONE
echo -n Creating a reserve for tips...
-
PAYTO_RESERVE=$(
taler-merchant-setup-reserve \
--amount ${CURRENCY}:20 \
--exchange-url ${EXCHANGE_URL} \
--merchant-url http://localhost/instances/survey/ \
- --apikey "Bearer {BACKEND_APIKEY}" \
+ --apikey "Bearer ${BACKEND_APIKEY}" \
--wire-method iban
)
diff --git a/docker/demo/images/merchant/update_instances_auth.sh
b/docker/demo/images/merchant/update_instances_auth.sh
new file mode 100644
index 0000000..b1ab8a6
--- /dev/null
+++ b/docker/demo/images/merchant/update_instances_auth.sh
@@ -0,0 +1,18 @@
+echo -n "Change pos auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/pos/auth
+echo DONE
+echo -n "Change blog auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/blog/auth
+echo DONE
+echo -n "Change GNUnet auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/GNUnet/auth
+echo DONE
+echo -n "Change Taler auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/Taler/auth
+echo DONE
+echo -n "Change Tor auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/Tor/auth
+echo DONE
+echo -n "Change survey auth..."
+curl -s -H "Content-Type: application/json" -H "Authorization: Bearer
$BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}'
http://merchant/management/instances/survey/auth
+echo DONE
diff --git a/docker/demo/test-docker-mvp.sh
b/docker/demo/test-docker-localhost.sh
similarity index 70%
rename from docker/demo/test-docker-mvp.sh
rename to docker/demo/test-docker-localhost.sh
index f8b9763..234d840 100755
--- a/docker/demo/test-docker-mvp.sh
+++ b/docker/demo/test-docker-localhost.sh
@@ -5,5 +5,6 @@ taler-wallet-cli --no-throttle api --expect-success
'runIntegrationTest' \
"amountToWithdraw":"EUR:30",
"bankBaseUrl":"http://localhost:15000/demobanks/default/access-api/",
"exchangeBaseUrl":"http://localhost:5555/",
- "merchantBaseUrl":"http://localhost:5556/"
+ "merchantBaseUrl":"http://localhost:5556/",
+ "merchantAuthToken": "'${TALER_DOCKER_APIKEY:-secret-token:salt}'"
}'
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-deployment] branch master updated: use token auth,
gnunet <=