anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit 5d74e3ee42c908cb190543c4c5b32930025bfc04
parent 5f65dc323c823e41412d1e802224adf7d18b2441
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  8 Aug 2026 23:39:05 +0200

-remove authorization scripts now in taler-challenger-helpers

Diffstat:
Mdebian/changelog | 6++++++
Mdebian/control | 3++-
Dsrc/authorization/anastasis-authorization-email.sh | 3---
Dsrc/authorization/anastasis-authorization-post.sh | 127-------------------------------------------------------------------------------
Dsrc/authorization/anastasis-authorization-sms-clicksend.sh | 142-------------------------------------------------------------------------------
Dsrc/authorization/anastasis-authorization-sms-telesign.sh | 159-------------------------------------------------------------------------------
Dsrc/authorization/anastasis-authorization-sms.sh | 37-------------------------------------
Msrc/authorization/authorization-email.conf | 2+-
Msrc/authorization/meson.build | 7-------
9 files changed, 9 insertions(+), 477 deletions(-)

diff --git a/debian/changelog b/debian/changelog @@ -1,3 +1,9 @@ +anastasis (0.8.1) unstable; urgency=low + + * Release 0.8.1. + + -- Christian Grothoff <christian@grothoff.org> Fri, 07 Aug 2026 23:25:15 +0200 + anastasis (0.8.0) unstable; urgency=low * Release 0.8.0. diff --git a/debian/control b/debian/control @@ -54,7 +54,8 @@ Depends: ${shlibs:Depends} Recommends: apache2 | nginx | httpd, - postgresql (>=15.0) + postgresql (>=15.0), + taler-challenger-helpers Description: GNU's key escrow provider. . GNU Anastasis allows users to make backups of their diff --git a/src/authorization/anastasis-authorization-email.sh b/src/authorization/anastasis-authorization-email.sh @@ -1,3 +0,0 @@ -#!/bin/sh -# This file is in the public domain. -exec mail -s "Anastasis" -r noreply "$1" diff --git a/src/authorization/anastasis-authorization-post.sh b/src/authorization/anastasis-authorization-post.sh @@ -1,127 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -set -eu - -# You need to provide these: -# CLIENT_ID= -# CLIENT_SECRET= -# ORG_ID= -# Check shared secrets -if [ -x "$PINGEN_CLIENT_ID" ] -then - echo "PINGEN_CLIENT_ID not sent in environment" - exit 1 -fi -if [ -x "$PINGEN_CLIENT_SECRET" ] -then - echo "PINGEN_CLIENT_SECRET not sent in environment" - exit 1 -fi -if [ -x "$PINGEN_ORG_ID" ] -then - echo "PINGEN_ORG_ID not sent in environment" - exit 1 -fi - -ENDPOINT="https://api.pingen.com" -LOGS="$PWD/authorization-post.log" - -MESSAGE=$(cat -) -ADDR="$1" -NAME=$(echo "$ADDR" | jq -r .full_name) -STREET=$(echo "$ADDR" | jq -r .street) -CITY=$(echo "$ADDR" | jq -r .city) -POSTCODE=$(echo "$ADDR" | jq -r .postcode) -COUNTRY=$(echo "$ADDR" | jq -r .country) - -MYDIR=$(mktemp -d /tmp/authorization-post-XXXXXX) -cd "$MYDIR" -cat - | sed -e "s/%NAME%/$NAME/g" \ - -e "s/%STREET%/$STREET/g" \ - -e "s/%POSTCODE%/$POSTCODE/g" \ - -e "s/%CITY%/$CITY/g" \ - -e "s/%COUNTRY%/$COUNTRY/g" > input.tex <<EOF -\NeedsTeXFormat{LaTeX2e} -\documentclass[fontsize=11pt,a4paper]{scrlttr2} -\makeatletter -\KOMAoptions{foldmarks=off} -\makeatother -\setkomavar{subject}{Anastasis Recovery} -\address{Anastasis SARL \\\\ 7 rue de Mondorf \\\\ 5431 Erpeldange} -\setkomavar{signature}{Anastasis SARL} -\date{\today} -\begin{document} -\begin{letter}{\ \ %NAME% \\\\ \ \ %STREET% \\\\ \ \ %POSTCODE% %CITY% \\\\ \ \ %COUNTRY% } -\opening{To whom it may concern,} -EOF -echo "$MESSAGE" >> input.tex -cat - >> input.tex <<EOF -\closing{Best regards} -\end{letter} -\end{document} -EOF -pdflatex input.tex > "$MYDIR/pdflatex.out" 2> "$MYDIR/pdflatex.err" - -REPLY=$(curl \ - -s \ - -X POST \ - -H "Content-Type: application/x-www-form-urlencoded" \ - --data-urlencode "grant_type=client_credentials" \ - --data-urlencode "client_id=$CLIENT_ID" \ - --data-urlencode "client_secret=$CLIENT_SECRET" \ - --data-urlencode "scope=letter" \ - https://identity.pingen.com/auth/access-tokens) - -ACCESS_TOKEN=$(echo "$REPLY" | jq -r .access_token) - -REPLY=$(curl -s \ - -X GET "$ENDPOINT/file-upload" \ - -H "Authorization: Bearer $ACCESS_TOKEN") -ATTRS=$(echo "$REPLY" | jq .data.attributes) -UPLOAD_URL=$(echo "$ATTRS" | jq -r .url) -URL_SIG=$(echo "$ATTRS" | jq -r .url_signature) - -curl -s \ - -X PUT \ - -T input.pdf \ - "$UPLOAD_URL" - -REQUEST="$(jq -n ' - { data: { - type: "letters", - attributes: { - file_original_name: "input.pdf", - file_url: $UPLOAD_URL, - file_url_signature: $URL_SIG, - address_position: "left", - delivery_product: "cheap", - print_mode: "duplex", - auto_send: true, - print_spectrum: "grayscale" - } } - }' \ - --arg UPLOAD_URL "$UPLOAD_URL" \ - --arg URL_SIG "$URL_SIG" \ - )" - -STATUS=$(curl -s \ - --request POST \ - --url "$ENDPOINT/organisations/${ORG_ID}/letters" \ - --header "Content-Type: application/vnd.api+json" \ - --header "Authorization: Bearer $ACCESS_TOKEN" \ - -d "$REQUEST" \ - -o "$MYDIR/final-reply.txt" \ - -w "%{http_code}" -s) -cat "$MYDIR/final-reply.txt" >> "$LOGS" -case "$STATUS" in - 201) - ;; - *) - echo "Failed to add letter: $STATUS" >> "$LOGS" - echo "$REPLY" - exit 1; - ;; -esac - -rm -r "$MYDIR" -exit 0 diff --git a/src/authorization/anastasis-authorization-sms-clicksend.sh b/src/authorization/anastasis-authorization-sms-clicksend.sh @@ -1,142 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# Send an SMS using ClickSend API - -set -eu - -# Check shared secrets -if [ -x "$CLICKSEND_USERNAME" ] -then - echo "CLICKSEND_USERNAME not set in environment" - exit 1 -fi -if [ -x "$CLICKSEND_API_KEY" ] -then - echo "CLICKSEND_API_KEY not set in environment" - exit 1 -fi - -if [ $# -ne 1 ] -then - echo "Usage: $0 <phone_number>" 1>&2 - exit 1 -fi - -PHONE_NUMBER="$1" -MESSAGE=$(cat -) - -TMPFILE=$(mktemp /tmp/clicksend-sms-logging-XXXXXX) - -RESPONSE=$(curl --silent --show-error --fail \ - --url https://rest.clicksend.com/v3/sms/send \ - --request POST \ - --header 'Content-Type: application/json' \ - --user "$CLICKSEND_USERNAME:$CLICKSEND_API_KEY" \ - --data "{ - \"messages\": [{ - \"source\": \"bash-script\", - \"to\": \"$PHONE_NUMBER\", - \"body\": \"$MESSAGE\" - }] - }") - -echo "$RESPONSE" > "$TMPFILE" - -RESPONSE_CODE=$(echo "$RESPONSE" | jq -r '.response_code') - -if [ "$RESPONSE_CODE" != "SUCCESS" ]; -then - echo "Clicksend: failed to send SMS to $PHONE_NUMBER, got response code $RESPONSE_CODE." 1>&2 - exit 2 -fi - -MESSAGE_ID=$(echo "$RESPONSE" | jq -r '.data.messages[0].message_id') - -if [ "$MESSAGE_ID" == "null" ]; -then - echo "Clicksend: failed to retrieve message ID for message to $PHONE_NUMBER." 1>&2 - echo "$RESPONSE" 1>&2 - exit 3 -fi - -MESSAGE_STATUS=$(echo "$RESPONSE" | jq -r '.data.messages[0].status') - -if [ "$MESSAGE_STATUS" == "SUCCESS" ]; -then - echo "Clicksend: message delivered successfully to $PHONE_NUMBER." 1>&2 - exit 0 -fi - -MAX_ITERATIONS=12 - -# Poll message status -echo "Polling message status (message_id: $MESSAGE_ID)..." 1>&2 -for N in $(seq 1 "$MAX_ITERATIONS") -do - STATUS_RESPONSE=$(curl --silent --show-error --fail \ - --url "https://rest.clicksend.com/v3/sms/receipts/$MESSAGE_ID" \ - --user "$CLICKSEND_USERNAME:$CLICKSEND_API_KEY") - - echo "$STATUS_RESPONSE" >> "$TMPFILE" - - RESPONSE_CODE=$(echo "$RESPONSE" | jq -r '.response_code') - - if [ "$RESPONSE_CODE" != "SUCCESS" ]; - then - echo "Clicksend: failed to get status for message to $PHONE_NUMBER, assuming failure." 1>&2 - echo "$RESPONSE" 1>&2 - exit 4 - fi - - STATUS_CODE=$(echo "$STATUS_RESPONSE" | jq -r '.data.status_code') - STATUS_TEXT=$(echo "$STATUS_RESPONSE" | jq -r '.data.status_text') - STATUS=$(echo "$STATUS_TEXT" | awk --field-separator ':' '{print $1}') - - case "$STATUS_CODE" in - "200") - case "$STATUS" in - "Success"|"Sent") - # Message sent to the network for delivery, wait a bit - sleep 1 - ;; - "Queued"|"Scheduled") - # queued for delivery, sleep a bit longer - sleep 10 - ;; - "WaitApproval") - # Human in the loop (strange), sleep even longer - sleep 120 - ;; - *) - # Unexpected status, keep trying - sleep 5 - ;; - esac - ;; - "201") - # Message delivered to the handset - echo "Clicksend: message delivered successfully to $PHONE_NUMBER." 1>&2 - exit 0 - ;; - "300") - # Temporary network error, clicksend will retry automatically, sleep a bit - sleep 20 - ;; - "301") - # Delivery failed - echo "Clicksend: message delivery to $PHONE_NUMBER failed: $DESCRIPTION" 1>&2 - exit 1 - ;; - "FAILED"|"INVALID_RECIPIENT") - echo "Clicksend: message delivery to $PHONE_NUMBER failed: $DESCRIPTION" 1>&2 - exit 6 - ;; - *) - echo "Clicksend: message delivery to $PHONE_NUMBER failed: $DESCRIPTION" 1>&2 - sleep 5 - ;; - esac -done - -echo "Clicksend: unclear message delivery status $STATUS_CODE ($DESCRIPTION) after $MAX_ITERATIONS iterations. Assuming failure." 1>&2 -exit 1 diff --git a/src/authorization/anastasis-authorization-sms-telesign.sh b/src/authorization/anastasis-authorization-sms-telesign.sh @@ -1,159 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# Send an SMS using Telesign API -set -eu - -# Check shared secrets -if [ -x "$TELESIGN_AUTH_TOKEN" ] -then - echo "TELESIGN_AUTH_TOKEN not set in environment" - exit 1 -fi - -if [ $# -ne 1 ]; then - echo "Usage: $0 <phone_number>" 1>&2 - exit 1 -fi - -PHONE_NUMBER="$1" -MESSAGE=$(cat -) - -TMPFILE=$(mktemp /tmp/telesign-sms-logging-XXXXXX) - -RESPONSE=$(curl --silent --show-error --fail \ - --url https://rest-api.telesign.com/v1/messaging \ - --request POST \ - --header "Authorization: Basic $TELESIGN_AUTH_TOKEN" \ - --header "Content-Type: application/x-www-form-urlencoded" \ - --data account_livecycle_event=transact \ - --data "phone_number=$PHONE_NUMBER" \ - --data-urlencode "message=$MESSAGE" \ - --data "message_type=OTP") - -echo "$RESPONSE" > "$TMPFILE" -REFERENCE_ID=$(jq -r '.reference_id' "$TMPFILE") - -if [ "$REFERENCE_ID" == "null" ]; -then - echo "Telesign: failed to retrieve reference ID for message to $PHONE_NUMBER." 1>&2 - echo "$RESPONSE" 1>&2 - exit 1 -fi - -STATUS_CODE=$(echo "$RESPONSE" | jq -r '.status.code') - -case "$STATUS_CODE" in - "200") - # Delivered to headset. Should basically never happen here. - echo "Telesign: message delivered successfully to $PHONE_NUMBER." 1>&2 - exit 0 - ;; - "203"|"292"|"295") - # Delivered to gateway - sleep 2 - ;; - "207"|"211"|"220"|"221"|"222"|"231"|"237"|"238") - # Failure to deliver (hard) - echo "Telesign: could not deliver message to $PHONE_NUMBER: $STATUS_CODE" 1>&2 - exit 1 - ;; - "210") - # Temporary phone error - ;; - "250") - # Final status unknown - echo "Telesign: final status unknown for message to $PHONE_NUMBER, assuming success" 1>&2 - exit 0 - ;; - "290") - # Message in progress, go into loop below - sleep 2 - ;; - "502"|"503"|"504"|"505"|"506"|"507"|"508"|"509"|"510"|"511"|"512"|"513"|"514"|"515"|"517"|"520"|"521") - echo "Telesign: carrier problem ($STATUS_CODE) delivering to $PHONE_NUMBER" 1>&2 - exit 1 - ;; - "10000") - # Internal error at telesign... - echo "Telesign: internal error delivering to $PHONE_NUMBER" 1>&2 - echo "$RESPONSE" 1>&2 - exit 1 - ;; - "10019"|"10020") - # Rate limit exceeded. Treating as hard failure for now. - echo "Telesign: Rate limit exceeded ($STATUS_CODE) delivering to $PHONE_NUMBER" 1>&2 - echo "$RESPONSE" 1>&2 - exit 1 - ;; - *) - # Many possible status codes for failure... - echo "Telesign: Message delivery to $PHONE_NUMBER failed: $STATUS_CODE" 1>&2 - echo "$RESPONSE" 1&>2 - exit 1 - ;; -esac - -MAX_ITERATIONS=12 - -# Poll for message status -echo "Polling message status (reference_id: $REFERENCE_ID)..." 1>&2 -for N in $(seq 1 "$MAX_ITERATIONS") -do - STATUS_RESPONSE=$(curl --silent --show-error --fail \ - --url "https://rest-api.telesign.com/v1/messaging/$REFERENCE_ID" \ - --header "Authorization: Basic $TELESIGN_AUTH_TOKEN") - - echo "$STATUS_RESPONSE" >> "$TMPFILE" - - STATUS_CODE=$(echo "$STATUS_RESPONSE" | jq -r '.status.code') - DESCRIPTION=$(echo "$STATUS_RESPONSE" | jq -r '.status.description') - - case "$STATUS_CODE" in - "200") - # Delivered to headset. Great! - echo "Telesign: message delivered successfully to $PHONE_NUMBER." 1>&2 - exit 0 - ;; - "203"|"290"|"292"|"295") - # Delivered to gateway, wait a bit for an update - sleep 2 - ;; - "210") - # Temporary phone error - sleep 15 - ;; - "207"|"211"|"220"|"221"|"222"|"231"|"237"|"238") - # Failure to deliver (hard) - echo "Telesign: could not deliver message to $PHONE_NUMBER ($STATUS_CODE)" 1>&2 - exit 8 - ;; - "250") - # Final status unknown - echo "Telesign: final status for delivery to $PHONE_NUMBER unknown, assuming success" 1>&2 - exit 0 - ;; - "502"|"503"|"504"|"505"|"506"|"507"|"508"|"509"|"510"|"511"|"512"|"513"|"514"|"515"|"517"|"520"|"521") - echo "Telesign: carrier problem ($STATUS_CODE) for message to $PHONE_NUMBER" 1>&2 - exit 7 - ;; - "10000") - # Internal error at telesign... - echo "Telesign: internal error for message to $PHONE_NUMBER" 1>&2 - exit 9 - ;; - "10019"|"10020") - # Rate limit exceeded. Treating as hard failure for now. - echo "Telesign: rate limit exceeded for message to $PHONE_NUMBER" 1>&2 - exit 10 - ;; - *) - # Many possible status codes for failure... - echo "Telesign: message delivery to $PHONE_NUMBER failed: $STATUS_CODE" 1>&2 - echo "$RESPONSE" 1&>2 - exit 11 - ;; - esac -done - -echo "Telesign: unclear delivery status ${STATUS_CODE:-} (${DESCRIPTION:-}) for message to $PHONE_NUMBER after ${MAX_ITERATIONS:-} iterations. Assuming failure." 1>&2 -exit 12 diff --git a/src/authorization/anastasis-authorization-sms.sh b/src/authorization/anastasis-authorization-sms.sh @@ -1,37 +0,0 @@ -#!/bin/bash -# This file is in the public domain. -# Send an SMS -set -eu - -if [ $# -ne 1 ] -then - echo "Usage: $0 '{\"CONTACT_PHONE\":\"+41712345678\"}'" 1>&2 - exit 1 -fi - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -SCRIPT_NAME=$(basename "$0") -BASE="${SCRIPT_NAME%.sh}" - -PHONE_NUMBER=$(echo "$1" | jq -r .CONTACT_PHONE) -MESSAGE=$(cat -) - -# List of sub-scripts to try. -PROVIDERS="telesign clicksend" - -for PROVIDER in $PROVIDERS -do - SCRIPT_PATH="$SCRIPT_DIR/${BASE}-${PROVIDER}.sh" - if [ -x "$SCRIPT_PATH" ] - then - if echo "$MESSAGE" | "$SCRIPT_PATH" "$PHONE_NUMBER" - then - exit 0 - else - echo "$PROVIDER failed to send to $PHONE_NUMBER." 1>&2 - fi - fi -done - -echo "All SMS providers failed to send to $PHONE_NUMBER." 1>&2 -exit 1 diff --git a/src/authorization/authorization-email.conf b/src/authorization/authorization-email.conf @@ -8,4 +8,4 @@ ENABLED = NO # Feel free to use a different command with equivalent # semantics. -COMMAND = anastasis-authorization-email.sh +COMMAND = challenger-send-email diff --git a/src/authorization/meson.build b/src/authorization/meson.build @@ -16,11 +16,6 @@ install_data( ) install_data( - 'anastasis-authorization-email.sh', - 'anastasis-authorization-sms.sh', - 'anastasis-authorization-sms-clicksend.sh', - 'anastasis-authorization-sms-telesign.sh', - 'anastasis-authorization-post.sh', install_dir: get_option('bindir'), ) @@ -188,5 +183,3 @@ shared_module( install: true, install_dir: plugindir, ) - -