10 printf >&2 "%s\n" "modrelays-probe: error: $1"
15 # implicitly uses newsgroup, id, domain
16 # caller must "local td", which will be set
19 probeid="$domain,${probeid//[^-=.,_0-9A-Za-z]/%/},$id"
21 .*|*/*) fail "yikes, sanitisation bug!" ;;
24 td="probes/probes/$probeid"
33 record-probing "$probeid"
34 printf "%s\n" >"$td"/"$outcome" "$message"
37 record-success () { record-outcome "$1" ok ''; }
38 record-tempfail () { record-outcome "$1" tempfail "$2"; }
39 record-permfail () { record-outcome "$1" permfail "$2"; }
46 record-probing "mx=$mx,addr=$addr"
49 swaks --to "${GROUP//./-/}@$domain" \
51 --tls-optional-strict \
52 --header 'Subject: test modrelays probe test' \
54 "X-WebSTUMP-Relay-Probe: $GROUP $id $domain $mx $addr" \
55 -n >$td/swaks.log 2>$td/swaks.err
60 0) return ;; # record-success done by receiver
66 local expect_no_5xx='initial connection'
68 while read prefix rhs; do
73 if [ "x$expect_no_5xx" != x ] && \
74 [ "x$permfail" = x ]; then
75 permfail="$rhs ($expect_no_5xx)"
82 EHLO*|STARTTLS*) expect_no_5xx='' ;;
83 *) expect_no_5xx="after $rhs" ;;
90 if [ "x$permfail" = x ]; then
91 record-tempfail "mx=$mx,addr=$addr" "see swaks.log / swaks.err"
93 record-permfail "mx=$mx,addr=$addr" "$permfail"
103 adnshost -Fi -Tn +Do +Dt -t mx $domain >$td/dns
109 # have a list of MX's
115 while read pref mx statustype statustypenum rhs; do
116 case $statustypenum in
118 # have a list of relays
122 record-permfail "mx=$mx" \
132 INET|INET6) continue ;;
139 record-tempfail "mx=$mx" \
140 "dns $rc $statustype $rhs"
144 record-permfail "mx=$mx" \
145 "dns $rc $statustype $rhs"
155 adnshost -Fi -Tn +Do +Dt -t a $domain >$td/dns
163 # have a list of A's (dealt with MXs above)
167 probe-addr 'NONE' $addr
175 record-tempfail dns "dns <no-mx> $emsg"
180 record-permfail dns "dns <no-mx> $emsg"
188 *) fail "no arguments to $mode allowed" ;;
194 for domain in $MODRELAYS; do
201 xxx do something to cause sleeping
206 for domain in "$@"; do