diff options
Diffstat (limited to 'src/data/proto')
-rwxr-xr-x | src/data/proto/txtrec-del.sh | 64 | ||||
-rwxr-xr-x | src/data/proto/txtrec-enc.sh | 19 | ||||
-rwxr-xr-x | src/data/proto/txtrec-set.sh | 61 |
3 files changed, 0 insertions, 144 deletions
diff --git a/src/data/proto/txtrec-del.sh b/src/data/proto/txtrec-del.sh deleted file mode 100755 index 7ecf253..0000000 --- a/src/data/proto/txtrec-del.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -ARR_HOOKS=" - aws -" - -if [ $# -lt 2 ]; then - echo "Usage: $0 <head rec> <hook> <zone id> -Hooks:" >&2 - for h in $ARR_HOOKS; do - echo -e "\t$h" - done - - exit 2 -fi - -HEAD_REC="$1" -HOOK="$2" -ZONE_ID="$3" - -aws_param () { - cat << EOF -{ - "Changes": [ - { - "Action": "DELETE", - "ResourceRecordSet": $1 - } - ] -} -EOF -} - -hook_aws () { - local tmpfile=`mktemp --tmpdir txtrec-del.XXXXXXXXXX` - - aws route53 list-resource-record-sets\ - --hosted-zone-id "$ZONE_ID" > "$tmpfile" - local nb_rec=`jq ".ResourceRecordSets | length" "$tmpfile"` - local escaped_name=$(echo "$HEAD_REC" | sed -e s/\\./\\\\./g) - - for (( i = 0; i < nb_rec; i += 1 )); do - local rec=$(jq ".ResourceRecordSets[$i]" "$tmpfile") - jq ".ResourceRecordSets[$i].Name" "$tmpfile" | - egrep -i "\"([0-9a-f]+\.)?$escaped_name\.?\"" - if [ $? -eq 0 ]; then - aws route53 change-resource-record-sets\ - --hosted-zone-id "$ZONE_ID"\ - --change-batch "$(aws_param "$rec")" - fi - done - - rm -f "$tmpfile" -} - -"hook_$HOOK" "$HEAD_REC" - -i=0 -while true; do - "hook_$HOOK" $i."$HEAD_REC" - if [ $? -ne 0 ]; then - break - fi - let i=i+1 -done diff --git a/src/data/proto/txtrec-enc.sh b/src/data/proto/txtrec-enc.sh deleted file mode 100755 index 0836f0f..0000000 --- a/src/data/proto/txtrec-enc.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -if [ $# -lt 1 ]; then - echo "Usage: $0 <prefix>" >&2 - exit 2 -fi - -set -e -cnt=0 -while true; do - rec="$(dd bs=189 count=1 status=none | base64 -w0)" - if [ -z "$rec" ]; then - break - fi - - printf "%08X%s %s\n" $cnt "$1" "$rec" - let "cnt += 1" -done - -printf "\n%08x%s\n" $cnt "$1" diff --git a/src/data/proto/txtrec-set.sh b/src/data/proto/txtrec-set.sh deleted file mode 100755 index 50bb07d..0000000 --- a/src/data/proto/txtrec-set.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -set -e - -ARR_HOOKS=" - aws -" - -if [ $# -lt 2 ]; then - echo "Usage: $0 <head rec> <hook> <zone id> [TTL] -Hooks:" >&2 - for h in $ARR_HOOKS; do - echo -e "\t$h" - done - - exit 2 -fi - -HEAD_REC="$1" -HOOK="$2" -ZONE_ID="$3" -if [ -z "$4" ]; then - TTL=3600 -else - TTL="$4" -fi - -aws_param () { - cat << EOF -{ - "Changes": [ - { - "Action": "UPSERT", - "ResourceRecordSet": { - "Name": "$1", - "Type": "TXT", - "TTL": $TTL, - "ResourceRecords": [ - { "Value": "\"$2\"" } - ] - } - } - ] -} -EOF -} - -hook_aws () { - aws route53 change-resource-record-sets\ - --hosted-zone-id "$ZONE_ID"\ - --change-batch "$(aws_param "$1" "$2")" -} - -while read line; do - if [ -z "$line" ]; then - break; - fi - "hook_$HOOK" $line -done - -read line -"hook_$HOOK" "$HEAD_REC" "$line" |