Toen ik Professional Software Engineering kietelde, kwam er dit uit:
to traverse the Received headers to the first NON
BACKUP MX for our own host, so that we can get an acurrate picture of
the relay mailhost. At best,
this would be tedious within procmail, and would involve multiple
external program invocations.
I have used this for a while:
#===========================================================
# Create X-IP-CHAIN
#-----------------------------------------------------------
QUAD1="0*([1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
QUADn="0*([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
IP=$QUAD1[.]$QUADn[.]$QUADn[.]$QUADn
# unset XIP
XIP
REGEXP="Received:"
MATEXP=$REGEXP".*[^0-9.]\[\/$IP"
:0
* $ ^\/$REGEXP(.+$)*$REGEXP.+$
{
HEADERLINES = $MATCH
INCLUDERC = $HOME/XIP.rc
}
### XIP.rc
:0
* HEADERLINES ?? $ ^$MATEXP
{
:0 # IPs to skip (change them to yours)
* ! MATCH ?? ^^194\.109\.(6|127)\.
* ! MATCH ?? ^^194\.109\.13\.140^^
* ! MATCH ?? ^^24\.132\.0\.158^^
{
:0
* ! MATCH ?? ^^10\.
* ! MATCH ?? ^^127\.0\.0\.1^^
####* ! MATCH ?? ^^169\.254\.
* ! MATCH ?? ^^172\.(1[6-9]|2[0-9]|3[01])\.
* ! MATCH ?? ^^192\.168\.
* ! XIP ?? $ ^.*\[$MATCH]
{ XIP=$XIP[$MATCH] }
}
:0
* HEADERLINES ?? $ ^$REGEXP(.*$)*\/$REGEXP(.*$)*
{
HEADERLINES = $MATCH
INCLUDERC = $_
}
}
# 10.0.0.0/24 = IP private-address range
# 127.0.0.1 = localhost
# 169.254.0.0/16 = Microsoft AutoAddress range (DHCP)
# 172.16.0.0/20 = IP private-address range
# 192.168.0.0/16 = IP private-address range
--
Affijn, Ruud
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail