# CHECKLOCALRCVD.RC # # Function to check IPs extracted from a single Received: header # and determine whether the header was added locally, added # remotely, or is the header that shows the "handoff" between # the remote system and your local system. That header is # the most important of the headers. CHKLOCAL=no # Check to see if the email is from a local IP. # :0 * ! LOCALIP ?? ^000\.000\.000\.000$ * ? ${TEST} -f ${LOCALHOSTFILE} { :0 * LOCALHOSTCHECKING ?? STRICT * ? ${GREP} -i -x "${LOCALIP}" ${LOCALHOSTFILE} { CHKLOCAL=yes } :0 * LOCALHOSTCHECKING ?? RELAXED * ? ${EGREP} -e "^${LOCAL24}.[0-9][0-9]?[0-9]?$" ${LOCALHOSTFILE} { CHKLOCAL=yes } } # Check to see if the email is from a local sender. # :0 * CHKLOCAL ?? no * ! LOCALSENDER ?? ^host\.example\.com$ * ? ${TEST} -f ${LOCALHOSTFILE} { :0 * LOCALHOSTCHECKING ?? STRICT * ? ${GREP} -i -x "${LOCALSENDER}" ${LOCALHOSTFILE} { CHKLOCAL=yes } :0 * LOCALHOSTCHECKING ?? RELAXED * ? ${GREP} -i "${LOCALSENDER}$" ${LOCALHOSTFILE} { CHKLOCAL=yes } } :0 * CHKLOCAL ?? no * ! DOMAIN ?? UNSET * $ LOCALSENDER ?? ${DOMAIN}$ { CHKLOCAL=yes } :0 * CHKLOCAL ?? no * ! THISISP ?? UNSET * $ LOCALSENDER ?? ${THISISP}$ { CHKLOCAL=yes } # Check to ensure that the IP you're looking at is not an ICANN non-routable # IP address. CHKNONROUTABLE=no LT2=no TESTCIDR=${SBDIR}/info/icann-nonroutable-ips.cidr INCLUDERC=${SBDIR}/functions/check-cidr.rc CHKNONROUTABLE=${LT2} :0 * CHKLOCAL ?? no * CHKNONROUTABLE ?? yes { CHKLOCAL=yes }