diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-14 18:27:16 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-14 18:27:16 +0100 |
commit | 4a519078e803c8ff042833a2200c5b6a0297fbe7 (patch) | |
tree | e25c5ef53af137b949acaa6411f0d2917f0a3418 /src/auditor | |
parent | 45926ec067d82a1e4c2b28b5680baddc1e8dae0b (diff) |
update generator scripts to use new -offline tools (WiP)
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/generate-auditor-basedb.conf | 2 | ||||
-rwxr-xr-x | src/auditor/generate-auditor-basedb.sh | 66 | ||||
-rwxr-xr-x | src/auditor/generate-revoke-basedb.sh | 81 |
3 files changed, 107 insertions, 42 deletions
diff --git a/src/auditor/generate-auditor-basedb.conf b/src/auditor/generate-auditor-basedb.conf index a130aebec..a7a4e7c35 100644 --- a/src/auditor/generate-auditor-basedb.conf +++ b/src/auditor/generate-auditor-basedb.conf @@ -10,6 +10,7 @@ UNIXPATH_MODE = 660 PORT = 8081 BASE_URL = http://localhost:8081/ SIGNKEY_DURATION = 4 weeks +SIGNKEY_LEGAL_DURATION = 4 weeks LEGAL_DURATION = 2 years LOOKAHEAD_SIGN = 32 weeks 1 day LOOKAHEAD_PROVIDE = 4 weeks 1 day @@ -45,6 +46,7 @@ UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http UNIXPATH_MODE = 660 PORT = 8083 AUDITOR_URL = http://localhost:8083/ +BASE_URL = http://localhost:8083/ TINY_AMOUNT = TESTKUDOS:0.01 [PATHS] diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh index c41d4a982..b934785f5 100755 --- a/src/auditor/generate-auditor-basedb.sh +++ b/src/auditor/generate-auditor-basedb.sh @@ -98,27 +98,18 @@ taler-config -c $CONF -s bank -o database -V postgres:///$TARGET_DB # setup exchange echo "Setting up exchange" taler-exchange-dbinit -c $CONF -taler-exchange-wire -c $CONF 2> taler-exchange-wire.log -taler-exchange-keyup -L INFO -c $CONF -o e2a.dat 2> taler-exchange-keyup.log # setup auditor echo "Setting up auditor" taler-auditor-dbinit -c $CONF taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL -taler-auditor-sign -c $CONF -u $AUDITOR_URL -r e2a.dat -o a2e.dat -m $MASTER_PUB -rm -f e2a.dat - -# provide auditor's signature to exchange -ABD=`taler-config -c $CONF -s EXCHANGEDB -o AUDITOR_BASE_DIR -f` -mkdir -p $ABD -mv a2e.dat $ABD # Launch services echo "Launching services" -taler-bank-manage-testing $CONF postgres:///$TARGET_DB serve & +taler-bank-manage-testing $CONF postgres:///$TARGET_DB serve &> taler-bank.log & TFN=`which taler-exchange-httpd` TBINPFX=`dirname $TFN` -TLIBEXEC=${BINPFX}/../lib/libexec/taler/ +TLIBEXEC=${TBINPFX}/../lib/taler/libexec/ $TLIBEXEC/taler-helper-crypto-eddsa -c $CONF 2> taler-helper-crypto-eddsa.log & $TLIBEXEC/taler-helper-crypto-rsa -c $CONF 2> taler-helper-crypto-rsa.log & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & @@ -126,6 +117,23 @@ taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & taler-auditor-httpd -c $CONF 2> taler-auditor-httpd.log & +# Wait for all bank to be available (usually the slowest) +for n in `seq 1 50` +do + echo -n "." + sleep 0.2 + OK=0 + # bank + wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || continue + OK=1 + break +done + +if [ 1 != $OK ] +then + exit_skip "Failed to launch services" +fi + # Wait for all services to be available for n in `seq 1 50` do @@ -133,11 +141,9 @@ do sleep 0.1 OK=0 # exchange - wget http://localhost:8081/ -o /dev/null -O /dev/null >/dev/null || continue + wget http://localhost:8081/seed -o /dev/null -O /dev/null >/dev/null || continue # merchant wget http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || continue - # bank - wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || continue # Auditor wget http://localhost:8083/ -o /dev/null -O /dev/null >/dev/null || continue OK=1 @@ -148,9 +154,41 @@ if [ 1 != $OK ] then exit_skip "Failed to launch services" fi +echo " DONE" + +echo -n "Setting up keys" +taler-exchange-offline -c $CONF \ + download sign \ + enable-account payto://x-taler-bank/localhost/2 \ + wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 \ + upload &> taler-exchange-offline.log + +echo -n "." + +for n in `seq 1 2` +do + echo -n "." + OK=0 + # bank + wget --timeout=1 http://localhost:8081/keys -o /dev/null -O /dev/null >/dev/null || continue + OK=1 + break +done + +if [ 1 != $OK ] +then + exit_skip "Failed to setup keys" +fi + +taler-auditor-offline -c $CONF \ + download sign upload &> taler-auditor-offline.log + +echo " DONE" # Setup merchant +echo -n "Setting up merchant" + curl -H "Content-Type: application/json" -X POST -d '{"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' http://localhost:9966/private/instances diff --git a/src/auditor/generate-revoke-basedb.sh b/src/auditor/generate-revoke-basedb.sh index 3874e349b..cb48f524d 100755 --- a/src/auditor/generate-revoke-basedb.sh +++ b/src/auditor/generate-revoke-basedb.sh @@ -86,27 +86,17 @@ taler-config -c $CONF -s exchange -o REVOCATION_DIR -V "${TMP_DIR}/revdir/" # setup exchange echo "Setting up exchange" taler-exchange-dbinit -c $CONF -taler-exchange-wire -c $CONF 2> taler-exchange-wire.log -taler-exchange-keyup -L INFO -c $CONF -o e2a.dat 2> taler-exchange-keyup.log # setup auditor echo "Setting up auditor" taler-auditor-dbinit -c $CONF -taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL -taler-auditor-sign -c $CONF -u $AUDITOR_URL -r e2a.dat -o a2e.dat -m $MASTER_PUB -rm -f e2a.dat - -# provide auditor's signature to exchange -ABD=`taler-config -c $CONF -s EXCHANGEDB -o AUDITOR_BASE_DIR -f` -mkdir -p $ABD -mv a2e.dat $ABD # Launch services echo "Launching services" taler-bank-manage-testing $CONF postgres:///$TARGET_DB serve &> revocation-bank.log & TFN=`which taler-exchange-httpd` TBINPFX=`dirname $TFN` -TLIBEXEC=${BINPFX}/../lib/libexec/taler/ +TLIBEXEC=${TBINPFX}/../lib/taler/libexec/ $TLIBEXEC/taler-helper-crypto-eddsa -c $CONF 2> taler-helper-crypto-eddsa.log & $TLIBEXEC/taler-helper-crypto-rsa -c $CONF 2> taler-helper-crypto-rsa.log & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & @@ -127,6 +117,12 @@ do OK=1 break done + +if [ 1 != $OK ] +then + exit_skip "Failed to launch services" +fi + # Wait for all other services to be available for n in `seq 1 50` do @@ -134,7 +130,7 @@ do sleep 0.1 OK=0 # exchange - wget http://localhost:8081/ -o /dev/null -O /dev/null >/dev/null || continue + wget http://localhost:8081/seed -o /dev/null -O /dev/null >/dev/null || continue # merchant wget http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || continue # Auditor @@ -143,7 +139,6 @@ do break done - if [ 1 != $OK ] then cleanup @@ -151,7 +146,39 @@ then fi echo " DONE" +echo -n "Setting up keys" + +taler-exchange-offline -c $CONF \ + download sign \ + enable-account payto://x-taler-bank/localhost/2 \ + wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 \ + upload &> taler-exchange-offline.log + +echo -n "." + +for n in `seq 1 2` +do + echo -n "." + OK=0 + # bank + wget --timeout=1 http://localhost:8081/keys -o /dev/null -O /dev/null >/dev/null || continue + OK=1 + break +done + +if [ 1 != $OK ] +then + exit_skip "Failed to setup keys" +fi + + +taler-auditor-offline -c $CONF \ + download sign upload &> taler-auditor-offline.log + +echo " DONE" + # Setup merchant +echo -n "Setting up merchant" curl -H "Content-Type: application/json" -X POST -d '{"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' http://localhost:9966/private/instances @@ -186,15 +213,14 @@ echo "Revoking denomination ${rd} (to affect coin ${rc})" export susp=$(echo "$coins" | jq --arg rc "$rc" '[.coins[] | select(.coin_pub != $rc) | .coin_pub]') # Do the revocation -taler-exchange-keyup -o e2a2.dat -c $CONF -r $rd -taler-auditor-sign -c $CONF -u $AUDITOR_URL -r e2a2.dat -o a2e2.dat -m $MASTER_PUB -rm -f e2a2.dat -mv a2e2.dat $ABD +taler-exchange-offline -c $CONF \ + revoke-denomination "${rd}" upload &> taler-exchange-offline-revoke.log + +sleep 1 # Give exchange time to create replacmenent key -# Restart the exchange... -kill -SIGUSR1 $EXCHANGE_PID -sleep 1 # Give exchange time to re-scan data -echo "Restarted the exchange post revocation" +# Re-sign replacment keys +taler-auditor-offline -c $CONF \ + download sign upload &> taler-auditor-offline.log # Now we suspend the other coins, so later we will pay with the recouped coin taler-wallet-cli --wallet-db=$WALLET_DB advanced suspend-coins "$susp" @@ -280,15 +306,14 @@ export susp=$(echo "$coins" | jq --arg freshc "$freshc" '[.coins[] | select(.coi # Do the revocation of freshc echo "Revoking ${fresh_denom} (to affect coin ${freshc})" -taler-exchange-keyup -c $CONF -o e2a3.dat -r $fresh_denom -taler-auditor-sign -c $CONF -u $AUDITOR_URL -r e2a3.dat -o a2e3.dat -m $MASTER_PUB -rm -f e2a3.dat -mv a2e3.dat $ABD +taler-exchange-offline -c $CONF \ + revoke-denomination "${fresh_denom}" upload &> taler-exchange-offline-revoke-2.log -# Restart the exchange... -kill -SIGUSR1 $EXCHANGE_PID -sleep 1 # give exchange time to re-scan data +sleep 1 # Give exchange time to create replacmenent key +# Re-sign replacment keys +taler-auditor-offline -c $CONF \ + download sign upload &> taler-auditor-offline.log # Now we suspend the other coins, so later we will pay with the recouped coin taler-wallet-cli $TIMETRAVEL --wallet-db=$WALLET_DB advanced suspend-coins "$susp" |