From f91d44d9c32e96de7ac06487c7eb96c2390fa4fa Mon Sep 17 00:00:00 2001 From: Phil! Gold Date: Mon, 8 Aug 2016 12:51:37 -0400 Subject: [PATCH] Documentation for SenderBase plugin. --- plugins/senderbase/senderbase | 45 +++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/plugins/senderbase/senderbase b/plugins/senderbase/senderbase index c0079366..cbfdb9a7 100755 --- a/plugins/senderbase/senderbase +++ b/plugins/senderbase/senderbase @@ -1,12 +1,55 @@ #!/bin/sh +: << =cut + +=head1 NAME + +senderbase - Gives the current SenderBase reputation for a mail host. + +=head1 CONFIGURATION + +By default, the script will use the first IP address returned by C. +If that's not the right address to use, set the C environment +variable to the appropriate value. + + [senderbase] + env.ip_address 8.8.8.8 + +=head1 AUTHOR + +Phil! Gold + +=head1 MAGIC MARKERS + + #%# family=auto + #%# capabilities=autoconf + +=cut + real_ip_address=${ip_address:-$(hostname -I | head -1)} +ip_reversed=$(echo $real_ip_address | sed -re 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/\4.\3.\2.\1/') +query_host=${ip_reversed}.rf.senderbase.org + +if [ "$1" = "autoconf" ]; then + if which dig >/dev/null; then + value=$(dig +short $query_host TXT | sed 's/"//g' | head -1) + if [ -n "$value" ]; then + echo 'yes' + else + echo "no (No SenderBase reputation for IP address ${ip_address}.)" + fi + else + echo 'no (No "dig" executable found.)' + fi + exit 0 +fi if [ "$1" = "config" ]; then cat <