commit d1392ebc0b3f01c7069c4c161f2c7a421d939752 Author: jreichmann Date: Thu Apr 18 13:55:42 2019 +0200 Add simple test skript (unfinished) and list of records to check diff --git a/records.list b/records.list new file mode 100644 index 0000000..6cfc7e9 --- /dev/null +++ b/records.list @@ -0,0 +1,32 @@ +athena7.eu@A +kalsruhe.athena7.eu@A +vps.athena7.eu@A +vps.athena7.eu@AAAA +financial.athena7.eu@A +financial.athena7.eu@AAAA +finallycoffee.eu@A +karlsruhe.finallycoffee.eu@A +london.finallycoffee.eu@A +london.finallycoffee.eu@AAAA +munich.finallycoffee.eu@A +munich.finallycoffee.eu@AAAA +chat.finallycoffee.eu@A +matrix.finallycoffee.eu@A +dimension.matrix.finallycoffee.eu@A +_matrix._tcp.matrix@SRV +_matrix-identity._tcp.matrix@SRV +cloud.finallycoffee.eu@A +office.cloud.finallycoffee.eu@A +git.finallycoffee.eu@A +ci.finallycoffee.eu@A +ldap.finallycoffee.eu@A +dsl.gateway.finallycoffee.eu@A +docsis.gateway.finallycoffee.eu@A +_ldap._tcp.ldap.finallycoffee.eu@SRV +_minecraft._tcp.dw20.feedthebeast.finallycoffee.eu@SRV +_minecraft._tcp.sevtech-ages.feedthebeast.finallycoffee.eu@SRV +_minecraft._tcp.skyfactory3.feedthebeast.finallycoffee.eu@SRV +_minecraft._tcp.creative.minecraft.finallycoffee.eu@SRV +_minecraft._tcp.survival.minecraft.finallycoffee.eu@SRV +karlsruhe.flauschekatze.space@A +ns1.karlsruhe.flauschekatze.space@A diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..fc6a569 --- /dev/null +++ b/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +nameservers=('ns1.variomedia.de' 'london.finallycoffee.eu' 'munich.finallycoffee.eu') + +red='\e[1;31m' +green='\e[1;32m' +end='\e[0m' + +test_record() { + local name=$1 + local type=$2 + local all_equal=true + local res="" + local all_res="$name@$type:\t" + for ns in "${nameservers[@]}"; do + answer="$(dig +short $type $name @$ns)" + #echo "$answer" + if [[ "$ns" == "$nameservers[0]" ]]; then + res = answer + fi + if [[ "$res" != "$answer" ]]; then + all_equal=false + fi + all_res="$all_res$answer\t" + done + if [[ all_equal ]]; then + echo -e "${green}OK!\t$all_res${end}" + elif [[ !all_equal ]]; then + echo -e "${red}FAIL\t$all_res${end}" + fi +} + +if [[ -n "$1" ]] && [[ -z "$2" ]]; then + test_record "$1" "A" + test_record "$1" "AAAA" +elif [[ -n "$1" ]] && [[ -n "$2" ]]; then + test_record "$1" "$2" +fi + +if [[ -z "$1" ]]; then + while read -r line || [[ -n "$line" ]]; do + type=${line##*@} + name=${line%@$type} + test_record "$name" "$type" + done < records.list +fi