-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnanas.conf.example
408 lines (276 loc) · 11.5 KB
/
nanas.conf.example
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
###############################################################################
### news.admin.net-abuse.sightings Moderation 'Bot, with News::Verimod ###
### Copyright 1996-2008, Tim Skirvin. Redistribution terms are below. ###
###############################################################################
use vars qw( $VERSION $CLASS %GROUP );
$VERSION = '$Id: nanas.conf,v 1.3 2008-01-18 19:38:39 tskirvin Exp $';
## Name of the class below that we will be loading from our ModBot programs.
$CLASS = "News::Verimod::NANAS";
## Group variables
%GROUP = %News::Verimod::NANAS::GROUP;
###############################################################################
### News::Verimod::NANAS Variables ############################################
###############################################################################
package News::Verimod::NANAS;
use vars qw( @FIXES @SCORES @CMDS %GROUP %REPORT %REASON );
$VERSION = "1.99.90";
## Primary group information
BEGIN { use vars qw ( %REPORT %GROUP %OPTS );
## Basic News::Verimod object information - must be filled out!
%GROUP = (
## What is the name of the newsgroup we are moderating?
'NEWSGROUP' => 'news.admin.net-abuse.sightings',
## What is the submission address for this group?
'SUBMIT' => '[email protected]',
## What is the contact address for this group?
'CONTACT' => '[email protected]',
## What are we calling the actual moderation 'bot?
'BOTNAME' => "Bob the NANAS ModBot",
## Who is the maintainer of the moderation 'bot?
'MAINTAINER'=> '[email protected]',
## What is the mailing list for all of the moderators?
'MODLIST' => '[email protected]',
## Is there a filename that contains a signature to attach to admin
## documents and such?
'SIGNATURE' => '~/.verimod/nanas/nanas.sig',
## Where should we leave logging information?
'LOGDIR' => '~/.verimod/nanas',
## Where should queued messages go?
'QUEUEDIR' => "~/.verimod/nanas/queue",
);
## Options to pass into process(), used to customize behavior. Should
## document all of these options somewhere.
%OPTS = (
'nouserconfirm' => 0, # Don't send user confirmations
'nouserreject' => 0, # Don't send user rejections
'nomodconfirm' => 0, # Don't send moderator notices
);
}
## Modules to load to fix and lethally test the article
@FIXES = (
'xtrace',
'mailpath',
'mailtonews' => [ $GROUP{'NEWSGROUP'} ],
'newsgroups' => [ $GROUP{'NEWSGROUP'} ],
'header',
'bodyheaders',
'modbot' => [ 'News::Verimod::NANAS' ],
'nanas',
'crosspost',
'blacklist',
'noconfirm',
'noreject',
'anykeyword',
'clean',
'signature',
# 'spamheader', # Drop spam headers
'mailtonews2', # Additional header drops
);
## Modules to score the article, so that we can decide what to do with it.
@SCORES = (
'always', # Sample, mostly; lets us set a default
);
###############################################################################
### main() ####################################################################
###############################################################################
use strict;
use News::Verimod;
use News::Verimod::Sample qw( process_approve_by_default );
use vars qw( @ISA );
@ISA = qw( News::Verimod News::Verimod::Sample );
###############################################################################
### Functions and Documentation ###############################################
###############################################################################
=head1 NAME
News::Verimod::NANAS - Verimod framework for news.admin.net-abuse.sightings
=head1 SYNOPSIS
See News::Verimod; invoked through battloid.
=head1 DESCRIPTION
This package offers a centralized framework for managing the newsgroup
news.admin.net-abuse.sightings. Messages are run through this script, and are
either approved or rejected; there is no scoring, and because the group is
fairly simple, there aren't too many checks to worry about.
=head2 Verimod Article Checks/Fixes
=over 4
=item Fixes
The following fixes are applied to all articles.
=over 2
=item mailtonews
Remove/edit lots of mail headers to make a useful news article header set.
=item modbot
Adds X-Submissions-To and X-ModBot headers.
=item spamheader
Parses and deletes X-Spam headers, added by spam filters along the way.
=item header
Allows for headers to be modified; in this case, sets the following
headers:
Newsgroups: news.admin.net-abuse.sightings
Followup-to: comp.std.misc
X-Moderation-Software: http://www.killfile.org/~tskirvin/software/verimod/
X-Group-Homepage: http://www.killfile.org/~nanas/
=item clean
Clean the headers so that they are RFC-compliant and consistent, tossing
out those that can't be saved.
=item mailtonews2
Additional header drops.
=back
=item Scores
No scoring is actually implemented, though it is still enabled for debugging
purposes.
=item Processing
Messages are enqueued by default.
=back
=head1 USAGE
The following functions and variables are defined by this module.
=head2 News::Verimod Functions
=over 4
=head2 News::Verimod Functions
=over 4
=item fixes ( )
=item commands ( )
=item score_list ( )
=item score_cmds ( )
Internal functions used by battloid to decide how to fix/score the message.
=cut
sub fixes { @FIXES }
sub commands { if (scalar @CMDS) { return @CMDS }
else { push @CMDS, <DATA>; chomp @CMDS; ( @CMDS ) } }
sub score_list { @SCORES }
sub score_cmds { commands(@_) }
=item groupinfo ( )
Returns a hashref containing all of the basic information used to create the
group - ie, offers convenient access to the main variables.
=cut
sub groupinfo { \%GROUP }
=item groupopts ( )
Returns the information regarding the %OPTS hash. If invoked as a scalar,
returns a hashref; returns the hash itself otherwise. Returns an empty
hashref/array if %OPTS is not set, for some reason.
=cut
sub groupopts { \%OPTS ? wantarray ? %OPTS : \%OPTS
: wantarray ? () : {} }
=item approve ( OPTIONS )
Taken from B<News::Verimod::Sample>'s approve().
=cut
=item reject ( OPTIONS )
Taken from B<News::Verimod::Sample>'s reject().
=cut
=item enqueue ( OPTIONS )
Taken from B<News::Verimod::Sample>'s enqueue().
=cut
sub approve { News::Verimod::Sample::approve(@_) }
sub reject { News::Verimod::Sample::reject(@_) }
sub enqueue { News::Verimod::Sample::enqueue(@_) }
=item process ( OPTIONS )
Approves messages by default. Will not send confirmations at all if the
user doesn't want them (normally, we'd mail them to the moderator).
=cut
sub process {
my ($self, %options) = @_;
my $article = $options{'article'} || $$self->article or return 'no article';
$options{'nouserconfirm'} = "yes" if $article->header('x-no-confirm');
$options{'nouserreject'} = "yes" if $article->header('x-no-reject');
$self->process_approve_by_default(%options)
}
=back
=cut
#########################################################################
### News::Gateway Additional Configuration ##############################
#########################################################################
package News::Gateway;
use strict; use vars qw( %HOOKS %REPORT );
=item nanas_mesg ()
A News::Gateway post modification that does two things: if followups are set
to news.admin.net-abuse.email or .usenet, then we will add a subject tag of
[email] or [usenet] as appropriate; if not, and there is a subject tag that
tips us in the right direction, then we'll set followups.
=cut
sub nanas_mesg {
my ($self) = @_;
my $article = $self->article;
return "No article" unless $article;
my $subj = $article->header('subject');
return "No subject" unless $subj;
my $follow = $article->header('followup-to') || "";
if ( $follow ) {
if ($follow =~ /news.admin.net-abuse.email/) {
$subj = "[email] $subj" unless $subj =~ /\[email\] /;
} elsif ($follow =~ /news.admin.net-abuse.usenet/) {
$subj = "[usenet] $subj" unless $subj =~ /\[usenet\] /;
}
$article->set_headers('subject', $subj);
} else {
my @keywords = $self->keywords($subj);
my %set;
foreach my $word (@keywords) {
if ($word =~ /(e?[- ]?mail|phish|worm)/i) {
$set{'news.admin.net-abuse.email'}++;
} elsif ($word =~ /news|usenet/i) {
$set{'news.admin.net-abuse.usenet'}++;
} elsif ($word =~ /icq|chat|irc|misc|virus|relay|proxy|ssh|aim|scam/i) {
$set{'news.admin.net-abuse.misc'}++;
}
}
if (scalar keys %set) {
$article->set_headers('followup-to', join(',', keys %set))
}
}
$article->set_headers('x-no-reject', 'auto-nanas')
unless $article->header('followup-to');
return undef;
}
$REPORT{'nanas'} = join("\n", <<ENDL);
Followups and/or subject keyword not set to appropriate group.
ENDL
$News::Gateway::HOOKS{'nanas'} = [];
1;
=head1 NOTES
Documentation is still dodgy, but at least the group works now.
=head1 REQUIREMENTS
B<News::Verimod>, B<News::Gateway>
=head1 SEE ALSO
B<News::Verimod>, B<News::Gateway>, B<News::Article>
=head1 TODO
Actually distribute the code.
=head1 AUTHOR
Tim Skirvin <[email protected]>
=head1 HOMEPAGE
B<http://www.killfile.org/~tskirvin/nana/>
B<http://www.killfile.org/~tskirvin/software/verimod/>
=head1 LICENSE
This code may be redistributed under the same terms as Perl itself.
=head1 COPYRIGHT
Copyright 1995-2007 by Tim Skirvin <[email protected]>
=cut
package News::Verimod::NANAS;
1;
###############################################################################
##### Version History #########################################################
###############################################################################
# 1.99.50 Fri 09 Mar 09:23:36 CST 2007 tskirvin
### Updating config file for use as an example for other 'bots.
# 1.99.90 Fri 18 Jan 11:37:26 PST 2008 tskirvin
### Should pretty much replace the old configuration now.
__DATA__
###############################################################################
### news.admin.net-abuse.sightings configuration directives ###################
###############################################################################
## Header adjustments that aren't taken care of by other modules.
header ifempty x-group-homepage "http://www.example.com/~user/directory/"
header ifempty x-moderation-software "http://www.killfile.org/~tskirvin/software/verimod/"
bodyheaders "x-no-archive" "x-no-confirm" "x-no-reject"
clean maxrefs 10
clean hostname news.example.com
clean mid_prefix nanas.
newsgroups accept ~/.verimod/nanas/newsgroups /.*/
newsgroups group news.admin.net-abuse.sightings
crosspost crosspost max 1
crosspost followups max 1
crosspost newsgroups accept ~/.verimod/nanas/newsgroups /.*/
crosspost followups accept ~/.verimod/nanas/followups /.*/
crosspost followups restrict 3 news.admin.net-abuse.sightings
blacklist blacklist_from ~/.verimod/nanas/blacklist-from
blacklist blacklist_subject ~/.verimod/nanas/blacklist-subject
noconfirm ~/.verimod/nanas/noconfirm
noreject ~/.verimod/nanas/noreject
signature ~/.verimod/nanas/nanas.sig