1Mail::SpamAssassin::PluUgsienr::CAoSnNt(r3i)buted Perl DMoaciulm:e:nStpaatmiAosnsassin::Plugin::ASN(3)
2
3
4

NAME

6       Mail::SpamAssassin::Plugin::ASN - SpamAssassin plugin to look up the
7       Autonomous System Number (ASN) of the connecting IP address.
8

SYNOPSIS

10        loadplugin Mail::SpamAssassin::Plugin::ASN
11
12        # Default / recommended settings
13        asn_use_geodb 1
14        asn_use_dns 1
15        asn_prefer_geodb 1
16
17        # Do lookups and add tags / X-Spam-ASN header
18        asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
19        asn_lookup_ipv6 origin6.asn.cymru.com _ASN_ _ASNCIDR_
20        add_header all ASN _ASN_ _ASNCIDR_
21
22        # Rules to test ASN or Organization
23        # NOTE: Do not use rules that check metadata X-ASN header,
24        # only check_asn() eval function works correctly.
25        # Rule argument is full regexp to match.
26
27        # ASN Number: GeoIP ASN or DNS
28        # Matched string includes asn_prefix if defined, and normally
29        # looks like "AS1234" (DNS) or "AS1234 Google LLC" (GeoIP)
30        header AS_1234 eval:check_asn('/^AS1234\b/')
31
32        # ASN Organisation: GeoIP ASN has, DNS lists might not have
33        # Note the second parameter which checks MYASN tag (default is ASN)
34        asn_lookup myview.example.com _MYASN_ _MYASNCIDR_
35        header AS_GOOGLE eval:check_asn('/\bGoogle\b/i', 'MYASN')
36

DESCRIPTION

38       This plugin uses DNS lookups to the services of an external DNS zone
39       such as at "http://www.routeviews.org/" to do the actual work. Please
40       make sure that your use of the plugin does not overload their
41       infrastructure - this generally means that you should not use this
42       plugin in a high-volume environment or that you should use a local
43       mirror of the zone (see "ftp://ftp.routeviews.org/dnszones/").  Other
44       similar zones may also be used.
45
46       GeoDB (GeoIP ASN) database lookups are supported since SpamAssassin 4.0
47       and it's recommended to use them instead of DNS queries, unless
48       "_ASNCIDR_" is needed.
49

TEMPLATE TAGS

51       This plugin allows you to create template tags containing the
52       connecting IP's AS number and route info for that AS number.
53
54       If you use add_header as documented in the example before, a header
55       field is added that looks like this:
56
57        X-Spam-ASN: AS24940 213.239.192.0/18
58
59       where "24940" is the ASN and "213.239.192.0/18" is the route announced
60       by that ASN where the connecting IP address came from.  If the AS
61       announces multiple networks (more/less specific), they will all be
62       added to the "_ASNCIDR_" tag, separated by spaces, eg:
63
64        X-Spam-ASN: AS1680 89.138.0.0/15 89.139.0.0/16
65
66       Note that the literal "AS" before the ASN in the _ASN_ tag is
67       configurable through the asn_prefix directive and may be set to an
68       empty string.
69
70       "_ASNCIDR_" is not available with local GeoDB ASN lookups.
71

BAYES

73       The bayes tokenizer will use ASN data for bayes calculations, and thus
74       affect which BAYES_* rule will trigger for a particular message.  No
75       in-depth analysis of the usefulness of bayes tokenization of ASN data
76       has been performed.
77

SEE ALSO

79       http://www.routeviews.org/ - all data regarding routing, ASNs, etc....
80

ADMINISTRATOR SETTINGS

82       asn_lookup asn-zone.example.com [ _ASNTAG_ _ASNCIDRTAG_ ]
83           Use this to lookup the ASN info in the specified zone for the first
84           external IPv4 address and add the AS number to the first specified
85           tag and routing info to the second specified tag.
86
87           If no tags are specified the AS number will be added to the _ASN_
88           tag and the routing info will be added to the _ASNCIDR_ tag.  You
89           must specify either none or both of the tag names.  Tag names must
90           start and end with an underscore.
91
92           If two or more asn_lookups use the same set of template tags, the
93           results of their lookups will be appended to each other in the
94           template tag values in no particular order.  Duplicate results will
95           be omitted when combining results.  In a similar fashion, you can
96           also use the same template tag for both the AS number tag and the
97           routing info tag.
98
99           Examples:
100
101             asn_lookup asn.routeviews.org
102
103             asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
104             asn_lookup myview.example.com _MYASN_ _MYASNCIDR_
105
106             asn_lookup asn.routeviews.org _COMBINEDASN_ _COMBINEDASNCIDR_
107             asn_lookup myview.example.com _COMBINEDASN_ _COMBINEDASNCIDR_
108
109             asn_lookup in1tag.example.net _ASNDATA_ _ASNDATA_
110
111       asn_lookup_ipv6 asn-zone6.example.com [_ASN_ _ASNCIDR_]
112           Use specified zone for lookups of IPv6 addresses.  If zone supports
113           both IPv4 and IPv6 queries, use both asn_lookup and asn_lookup_ipv6
114           for the same zone.
115
116       clear_asn_lookups
117           Removes any previously declared asn_lookup entries from a list of
118           queries.
119
120       asn_prefix 'prefix_string'       (default: 'AS')
121           The string specified in the argument is prepended to each ASN when
122           storing it as a tag. This prefix is rather redundant, but its
123           default value 'AS' is kept for backward compatibility with versions
124           of SpamAssassin earlier than 3.4.0. A sensible setting is an empty
125           string. The argument may be (but need not be) enclosed in single or
126           double quotes for clarity.
127
128       asn_use_geodb ( 0 / 1 )          (default: 1)
129           Use Mail::SpamAssassin::GeoDB module to lookup ASN numbers.  You
130           need suitable supported module like GeoIP2 or GeoIP with ISP or ASN
131           database installed (for example, add EditionIDs GeoLite2-ASN in
132           GeoIP.conf for geoipupdate program).
133
134           GeoDB can only set _ASN_ tag, it has no data for _ASNCIDR_.  If you
135           need both, then set asn_prefer_geodb 0 so DNS rules are tried.
136
137       asn_prefer_geodb ( 0 / 1 )       (default: 1)
138           If set, DNS lookups (asn_lookup rules) will not be run if GeoDB
139           successfully finds ASN. Set this to 0 to get _ASNCIDR_ even if
140           GeoDB finds _ASN_.
141
142       asn_use_dns ( 0 / 1 )            (default: 1)
143           Set to 0 to never allow DNS queries.
144
145
146
147perl v5.36.0                      2023-01-21Mail::SpamAssassin::Plugin::ASN(3)
Impressum