Add simple test skript (unfinished) and list of records to check

This commit is contained in:
Johanna Dorothea Reichmann 2019-04-18 13:55:42 +02:00
commit d1392ebc0b
Signed by untrusted user who does not match committer: transcaffeine
GPG Key ID: 03624C433676E465
2 changed files with 78 additions and 0 deletions

32
records.list Normal file
View File

@ -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

46
test.sh Normal file
View File

@ -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