ansible-taler-exchange

Ansible playbook to deploy a production Taler Exchange
Log | Files | Refs | Submodules | README | LICENSE

commit 646a362de00c67d00a294e7803a5c6fca5b05628
parent ef6d29d76deb16d0ecd1aa874baa3f58463115f4
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 21 May 2025 21:44:48 +0200

migrate to converters that are in the exchange package

Diffstat:
Droles/challenger/files/usr/local/bin/jq-email-converter | 42------------------------------------------
Droles/challenger/files/usr/local/bin/jq-postal-converter | 44--------------------------------------------
Droles/challenger/files/usr/local/bin/jq-sms-converter | 41-----------------------------------------
Mroles/challenger/tasks/pre-exchange.yml | 24------------------------
Mroles/challenger/templates/etc/taler-exchange/secrets/challenger-email.secret.conf.j2 | 2+-
Mroles/challenger/templates/etc/taler-exchange/secrets/challenger-postal.secret.conf.j2 | 2+-
Mroles/challenger/templates/etc/taler-exchange/secrets/challenger-sms.secret.conf.j2 | 2+-
7 files changed, 3 insertions(+), 154 deletions(-)

diff --git a/roles/challenger/files/usr/local/bin/jq-email-converter b/roles/challenger/files/usr/local/bin/jq-email-converter @@ -1,42 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# -# Challenger's /info returns the 'id' as a Number, but the -# exchange oauth2 plugin expects it as a String. -# Additionally, we need to check that we got the expected -# "email" address type (and otherwise exit with failure), -# and finally move the .address.phone value to -# the "CONTACT_PHONE" field. -# -# Uses JQ to convert! - -helper=taler-exchange-kyc-challenger-email-converter -echo "DEPRECATED, please use $helper instead" >&2 -if which $helper 2>/dev/null; then - echo "Helper available from taler-exchange, running it instead" >&2 - exec $helper -fi -exec jq 'if .address_type!="email" then halt_error(4) else (. | .id?) |= (. | tostring) | .FORM_ID="challenger-email" | .FORM_VERSION=0 | .CONTACT_EMAIL=.address.email | del(.address) | del(.address_type) end' - -# Example input: -# { -# "id": 1, -# "address": { -# "email": "me@example.com" -# }, -# "address_type": "phone", -# "expires": { -# "t_s": 1775590216 -# } -# } -# -# Example output: -# -# { -# "id": "1", -# "expires": { -# "t_s": 1775590216 -# } -# "CONTACT_EMAIL": "me@example.com" -# } -# diff --git a/roles/challenger/files/usr/local/bin/jq-postal-converter b/roles/challenger/files/usr/local/bin/jq-postal-converter @@ -1,44 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# -# Challenger's /info returns the 'id' as a Number, but the -# exchange oauth2 plugin expects it as a String. -# Additionally, we need to check that we got the expected -# "postal" address type (and otherwise exit with failure), -# and finally move the .address values to -# the "ADDRESS_*" fields. -# -# Uses JQ to convert! -helper=taler-exchange-kyc-challenger-postal-converter -echo "DEPRECATED, please use $helper instead" >&2 -if which $helper 2>/dev/null; then - echo "Helper available from taler-exchange, running it instead" >&2 - exec $helper -fi -exec jq 'if .address_type!="postal" and .address_type !="postal-ch" then halt_error(4) else (. | .id?) |= (. | tostring) | .FORM_ID="challenger-postal" | .FORM_VERSION=0 | .CONTACT_NAME=.address.CONTACT_NAME | .ADDRESS_LINES=.address.ADDRESS_LINES | if .address_type=="postal" then .ADDRESS_COUNTRY=.address.ADDRESS_COUNTRY else .ADDRESS_COUNTRY="CH" end | del(.address) | del(.address_type) end' - -# Example input: -# { -# "id": 1, -# "address": { -# "CONTACT_NAME": "Richard Stallman", -# "ADDRESS_LINES": "Bundesgasse 1\n1234 Bern" -# }, -# "address_type": "postal-ch", -# "expires": { -# "t_s": 1775590216 -# } -# } -# -# Example output: -# -# { -# "id": "1", -# "expires": { -# "t_s": 1775590216 -# } -# "CONTACT_NAME": "Richard Stallman" -# "ADDRESS_LIENS": "Bundesgasse 1\n1234 Bern" -# "ADDRESS_COUNTRY": "CH" -# } -# diff --git a/roles/challenger/files/usr/local/bin/jq-sms-converter b/roles/challenger/files/usr/local/bin/jq-sms-converter @@ -1,41 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# -# Challenger's /info returns the 'id' as a Number, but the -# exchange oauth2 plugin expects it as a String. -# Additionally, we need to check that we got the expected -# "phone" address type (and otherwise exit with failure), -# and finally move the .address.CONTACT_PHONE value to -# the "CONTACT_PHONE" field. -# -# Uses JQ to convert! -helper=taler-exchange-kyc-challenger-sms-converter -echo "DEPRECATED, please use $helper instead" >&2 -if which $helper 2>/dev/null; then - echo "Helper available from taler-exchange, running it instead" >&2 - exec $helper -fi -exec jq 'if .address_type!="phone" then halt_error(4) else (. | .id?) |= (. | tostring) | .CONTACT_PHONE=.address.CONTACT_PHONE | .FORM_ID="challenger-sms" | .FORM_VERSION=0 | del(.address) | del(.address_type) end' - -# Example input: -# { -# "id": 1, -# "address": { -# "CONTACT_PHONE": "+4112345678" -# }, -# "address_type": "phone", -# "expires": { -# "t_s": 1775590216 -# } -# } -# -# Example output: -# -# { -# "id": "1", -# "expires": { -# "t_s": 1775590216 -# } -# "CONTACT_PHONE": "+4112345678" -# } -# diff --git a/roles/challenger/tasks/pre-exchange.yml b/roles/challenger/tasks/pre-exchange.yml @@ -237,30 +237,6 @@ - name: Force ansible to regather fact(s) just created about sms-challenger ansible.builtin.setup: -- name: Place SMS challenger JQ conversion helper program - copy: - src: usr/local/bin/jq-sms-converter - dest: /usr/local/bin/jq-sms-converter - owner: root - group: root - mode: "0755" - -- name: Place Email challenger JQ conversion helper program - copy: - src: usr/local/bin/jq-email-converter - dest: /usr/local/bin/jq-email-converter - owner: root - group: root - mode: "0755" - -- name: Place Postal challenger JQ conversion helper program - copy: - src: usr/local/bin/jq-postal-converter - dest: /usr/local/bin/jq-postal-converter - owner: root - group: root - mode: "0755" - - name: Place sms-challenger systemd service file copy: src: etc/systemd/system/sms-challenger-httpd.service diff --git a/roles/challenger/templates/etc/taler-exchange/secrets/challenger-email.secret.conf.j2 b/roles/challenger/templates/etc/taler-exchange/secrets/challenger-email.secret.conf.j2 @@ -7,6 +7,6 @@ KYC_OAUTH2_INFO_URL = https://email.challenger.{{ DOMAIN_NAME }}/info KYC_OAUTH2_CLIENT_ID = {{ ansible_local['email-challenger-client-id'] }} KYC_OAUTH2_CLIENT_SECRET = {{ ansible_local['email-challenger-client-secret'] }} KYC_OAUTH2_POST_URL = {{ KYC_THANK_YOU_URL }} -KYC_OAUTH2_CONVERTER_HELPER = /usr/local/bin/jq-email-converter +KYC_OAUTH2_CONVERTER_HELPER = /usr/bin/taler-exchange-kyc-challenger-postal-converter # FIXME: change in production? KYC_OAUTH2_DEBUG_MODE = YES diff --git a/roles/challenger/templates/etc/taler-exchange/secrets/challenger-postal.secret.conf.j2 b/roles/challenger/templates/etc/taler-exchange/secrets/challenger-postal.secret.conf.j2 @@ -7,6 +7,6 @@ KYC_OAUTH2_INFO_URL = https://postal.challenger.{{ DOMAIN_NAME }}/info KYC_OAUTH2_CLIENT_ID = {{ ansible_local['postal-challenger-client-id'] }} KYC_OAUTH2_CLIENT_SECRET = {{ ansible_local['postal-challenger-client-secret'] }} KYC_OAUTH2_POST_URL = {{ KYC_THANK_YOU_URL }} -KYC_OAUTH2_CONVERTER_HELPER = /usr/local/bin/jq-postal-converter +KYC_OAUTH2_CONVERTER_HELPER = /usr/bin/taler-exchange-kyc-challenger-postal-converter # FIXME: change in production? KYC_OAUTH2_DEBUG_MODE = YES diff --git a/roles/challenger/templates/etc/taler-exchange/secrets/challenger-sms.secret.conf.j2 b/roles/challenger/templates/etc/taler-exchange/secrets/challenger-sms.secret.conf.j2 @@ -7,6 +7,6 @@ KYC_OAUTH2_INFO_URL = https://sms.challenger.{{ DOMAIN_NAME }}/info KYC_OAUTH2_CLIENT_ID = {{ ansible_local['sms-challenger-client-id'] }} KYC_OAUTH2_CLIENT_SECRET = {{ ansible_local['sms-challenger-client-secret'] }} KYC_OAUTH2_POST_URL = {{ KYC_THANK_YOU_URL }} -KYC_OAUTH2_CONVERTER_HELPER = /usr/local/bin/jq-sms-converter +KYC_OAUTH2_CONVERTER_HELPER = /usr/bin/taler-exchange-kyc-challenger-sms-converter # FIXME: change in production? KYC_OAUTH2_DEBUG_MODE = YES