public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob e6a6c2add857a5376f42100586d936b3192873f0 3923 bytes (raw)
$ git show HEAD:lib/PublicInbox/SaPlugin/ListMirror.pod	# shows this blob on the CLI

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
=head1 NAME

PublicInbox::SaPlugin::ListMirror - SpamAssassin plugin for mailing list mirrors

=head1 SYNOPSIS

  loadplugin PublicInbox::SaPlugin::ListMirror

Declare some mailing lists based on the expected List-ID value,
expected servers, and mailing list address:

  list_mirror List-ID <foo.example.com> *.example.com foo@example.com
  list_mirror List-ID <bar.example.com> *.example.com bar@example.com

Bump the score for messages which come from unexpected servers:

  header LIST_MIRROR_RECEIVED eval:check_list_mirror_received()
  describe LIST_MIRROR_RECEIVED Received does not match expected
  score LIST_MIRROR_RECEIVED 10

Bump the score for messages which Bcc the list:

  header LIST_MIRROR_BCC eval:check_list_mirror_bcc()
  describe LIST_MIRROR_BCC Mailing list was Bcc-ed
  score LIST_MIRROR_BCC 5

=head1 DESCRIPTION

This plugin contains common functions to provide accurate, ongoing
mirrors of existing mailing lists.  It may be used independently of the
rest of public-inbox, it does not depend on any public-inbox code, only
SpamAssassin.

=head1 ADMINISTRATOR SETTINGS

This plugin has no administrator settings, aside from the need
to load it via C<loadplugin> and enabling user rules
C<allow_user_rules 1>

=head1 USER SETTINGS

=over 4

=item list_mirror HEADER HEADER_VALUE HOSTNAME_GLOB [LIST_ADDRESS]

Declare a list based on an expected C<HEADER> matching C<HEADER_VALUE>
coming from C<HOSTNAME_GLOB>.  C<LIST_ADDRESS> is optional,
but may specify the address of the mailing list being mirrored.

C<List-ID> is the recommended value of C<HEADER> as most
mailing lists support it.

An example of C<HEADER_VALUE> is C<E<lt>foo.example.orgE<gt>>
if C<HEADER> is C<List-ID>.

As of public-inbox 2.0, using C<List-ID> as the C<HEADER> and a
C<HEADER_VALUE> contained by angle brackets (E<lt>list-idE<gt>),
matching is done in accordance with
L<RFC 2919|https://tools.ietf.org/html/rfc2919>.  That is,
C<HEADER_VALUE> will be a case-insensitive substring match
and ignore the optional description C<phrase> as documented
in RFC 2919.

All other C<HEADER> values use exact matches for backwards-compatibility.

C<HOSTNAME_GLOB> may be a wildcard match for machines where mail can
come from or an exact match.

C<LIST_ADDRESS> is only required if using the L</check_list_mirror_bcc>
eval rule

C<list_mirror> may be specified multiple times.

=back

=head1 EVAL FUNCTIONS

=over 4

=item header LIST_MIRROR_RECEIVED eval:check_list_mirror_received()

The C<check_list_mirror_received> function implements C<Received:>
header checking based on L</list_mirror> configuration values.

This rule can be used to score and prevent messages from being injected
directly into your mirror without going through the expected mailing
list servers:

  ifplugin PublicInbox::SaPlugin::ListMirror
    header LIST_MIRROR_RECEIVED eval:check_list_mirror_received()
    describe LIST_MIRROR_RECEIVED Received does not match expected
  endif

=item header LIST_MIRROR_BCC eval:check_list_mirror_bcc()

The C<check_list_mirror_bcc> function checks for Bcc to mailing lists
declared with a C<LIST_ADDRESS> via L</list_mirror>

Spammers will often Bcc mailing lists; while it's uncommon and
strange for valid messages to be Bcc-ed to any public mailing list.
This rule allows users to assign a score to Bcc-ed messages

  ifplugin PublicInbox::SaPlugin::ListMirror
    header LIST_MIRROR_BCC eval:check_list_mirror_bcc()
    describe LIST_MIRROR_BCC Mailing list was Bcc-ed
  endif

=back

=head1 CONTACT

Feedback welcome via plain-text mail to L<mailto:meta@public-inbox.org>

The mail archives are hosted at L<https://public-inbox.org/meta/>
and L<http://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/meta/>

=head1 COPYRIGHT

Copyright (C) all contributors L<mailto:meta@public-inbox.org>

License: AGPL-3.0+ L<http://www.gnu.org/licenses/agpl-3.0.txt>

=head1 SEE ALSO

L<Mail::SpamAssassin::Conf>

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git