From: Ian Jackson Date: Tue, 10 Oct 2017 15:22:44 +0000 (+0100) Subject: probes: receive X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-ulm.git;a=commitdiff_plain;h=bbdbda458c7b4c1adae6b2c1c9a8d8d8b9cce376 probes: receive --- diff --git a/forward-slimy.part.INO b/forward-slimy.part.INO index 059e462..6cafafa 100644 --- a/forward-slimy.part.INO +++ b/forward-slimy.part.INO @@ -2,6 +2,10 @@ if $local_part_suffix is +%ABBREV%+%KEYSUBMIT% or $local_part_suffix is +%ABBREV%+test-submission then unseen pipe "mail -s submission %LOGGROUPEMAILPREFIX%+%ABBREV%+log+submissions" + if $header_X-WebSTUMP-Relay-Probe: contains %GROUP% then + pipe "%BASEDIR/probes/modrelays-probe received %BASEDIR%" + finish + endif unseen pipe "%BASEDIR%/xlog/bin/record submission %GROUP%" pipe "%BASEDIR%/stump/etc/modenv stump.pl submission.pl" finish diff --git a/probes/modrelays-probe b/probes/modrelays-probe index ef7c639..a817a85 100755 --- a/probes/modrelays-probe +++ b/probes/modrelays-probe @@ -6,6 +6,14 @@ MODRELAYS=moderators.isc.org PROBE_TIMEOUT=$(( 20 * 60 )) PROBE_EXPIRE=$(( 32 * 86400 )) +case "$1" in +received) + mode="$1" + cd "$2" + shift; shift; set "$mode" "$@" + ;; +esac + . ../global-settings . ./settings @@ -18,8 +26,8 @@ fail () { exit 16 } -record-probing () { - # implicitly uses newsgroup, id, domain +compute-td () { + # implicitly uses GROUP, id, domain # caller must "local td", which will be set local probeid=$1 @@ -29,6 +37,10 @@ record-probing () { esac td="$statedir/$probeid" +} + +record-probing () { + compute-td "$@" mkdir -p $td } @@ -197,7 +209,7 @@ probe-domain () { } no_args () { - case $1 in + case $# in 0) return ;; *) fail "no arguments to $mode allowed" ;; esac @@ -339,6 +351,20 @@ mode_report () { done } +mode_received () { + no_args + + local hn group id domain mx addr + while read hn group id domain mx addr; do + if [ x"$hn" != x"X-WebSTUMP-Relay-Probe:" ]; then continue; fi + if [ x"$group" != x"$GROUP" ]; then continue; fi + local td + compute-td "mx=$mx,addr=$addr" + >"$td/ok" ||: + return + done +} + mode_all () { no_args $# for domain in $MODRELAYS; do