forked from scVENUS/PeekabooAV-amavisd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RELEASE_NOTES
16981 lines (13326 loc) · 802 KB
/
RELEASE_NOTES
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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---------------------------------------------------------------------------
April 26, 2016
amavisd-new-2.11.0 release notes
Contents:
DEPRECATION NOTICE
COMPATIBILITY
BUG FIXES
NEW FEATURES
OTHER
SUPERVISED PROCESS NOTES
DEPRECATION NOTICE
- The old DomainKey signatures (a predecessor to DKIM) has been published
as a historic document RFC 4870 and obsoleted by RFC 4871 in May 2007;
Support for DomainKey signatures is likely to be removed with a next
version of amavisd.
- It is expected that the next release of amavisd will start using some
of the features made available with perl 5.10.0 (such as a defined-or
operator, or a possessive quantifier in regular expressions), so
consider running amavisd under perl 5.8.9 or earlier as unsupported.
In practice, using such old version of perl is problematic even now,
as their support for Unicode / UTF-8 is incomplete and unreliable.
COMPATIBILITY
There are some minor incompatibilities between versions 2.10.1 and 2.11.0:
- During startup more detailed testing is performed for taint bugs of
a module Encode and the function utf8::is_utf8(), which may produce
warnings on old versions of perl with its old core module Encode,
or may exit on detecting more sinister bugs in these modules.
Note that the module Encode may be upgraded independently of perl,
if desired;
- with MySQL: changed character set 'utf8' to 'utf8mb4' for fields
msgs.subject and msgs.from_addr, as previously some of the UTF-8
characters could not be stored in a database;
- when logging to stderr a timestamp prefix to each message is only
still inserted if $DEBUG is true. When $DEBUG is false each message
is prefixed with a syslog log level in angle brackets, and a timestamp
is omitted (for compatibility with systemd);
- a perl module Digest::SHA is now a required module. It is a perl core
module since perl 5.10, so it shouldn't introduce a new dependency,
and it was a de-facto required module even previously, as it was needed
for DKIM processing;
BUG FIXES
- delivery method was undefined when always_bcc was used;
reported by Marieke Janssen;
- avoid warnings issued by perl 5.21.7 and later:
Negative repeat count does nothing at ./amavisd line 16408
and similarly in amavisd-status;
- releasing from an SQL quarantine failed to provide the original
envelope sender address to a released message;
reported, and a fix suggested by Tom Johnson and Tobias;
- remove a stale database file __db.nanny.db on a reload or restart,
as it can prevent a successful start when a previous start failed
for some reason; a patch by Trent Lloyd;
NEW FEATURES
- Polished rough corners to facilitate running amavisd as a non-daemonized
supervised process, e.g. under systemd:
* make it possible/easier to disable use of a pid_file;
* send status notifications to systemd when a NOTIFY_SOCKET environment
variable is provided;
* improved logging to stderr when $do_syslog and $logfile are undefined
(although logging through syslog might still be preferred, as writing
to a shared pipe from multiple child processes only guarantees atomicity
of writes shorter than PIPE_BUF, which is typically 512 bytes on *BSD,
and 4096 bytes on Linux systems);
See below for a sample amavisd.service file.
- A log template macro 'report_json' can now take arguments, which can
include or exclude fields (key/values) from the JSON report object.
Arguments to a macro are either field names (keys) to be included
in a report, or are field names to be excluded, each prefixed with
an exclamation mark, to produce a report with all but excluded fields.
Field names are case-sensitive. The order of fields in a serialized
JSON object is unaffected by the order of field names in a filter.
Unknown or non-present field names in a filter are silently ignored.
Example:
[:report_json|mail_id|action|content_type|queued_as|mail_from|size]
or:
[:report_json|!recipients|!elapsed|!os_fp|!subject|!subject_rot13]
For better clarity, instead of listing field names as individual
arguments to a macro, it is also possible to provide a single argument
to a macro, in which field names are separated by whitespace:
[:report_json|mail_id action content_type queued_as mail_from size]
or:
[:report_json| !message !recipients !to_addr !elapsed !os_fp
!subject !subject_rot13 !user_agent !tests !tests_ham !tests_spam]
As an example, a setting in a config file may look like:
$log_templ = '[:report_json|mail_id action queued_as mail_from]';
If at least one field name has an exclamation mark (i.e. is to be
excluded), all but excluded fields are implied, so any field names
without an exclamation mark are redundant.
Currently this is a simple filter where subfields of a structured
object cannot be selectively filtered (e.g. elapsed.SpamCheck).
For finer control on JSON content use some external JSON-processing
utility. Based on a patch by Markus Benning.
- Two new configuration settings are added: %smtpd_tls_server_options
and %smtp_tls_client_options. These two associative arrays are passed
to IO::Socket::SSL->start_SSL when establishing a server-side or a
client-side TLS session with an MTA, and provide more control over
a TLS session - like providing certificates and restricting ciphers.
See documentation of a perl module IO::Socket::SSL for a list of
all options with their descriptions and their defaults.
When TLS is in use, it is recommended to stick to fresh versions
of the module IO::Socket::SSL and the underlying ssl library,
as it can provide a safer set of defaults (e.g. excluded SSLv2).
Existing config options $smtpd_tls_cert_file and $smtpd_tls_key_file
are now deprecated in favour of a more generic %smtpd_tls_server_options.
Preferably set fields 'SSL_key_file' and 'SSL_cert_file' directly in
%smtpd_tls_server_options instead. For compatibility with 2.10 the
values of $smtpd_tls_cert_file and $smtpd_tls_key_file are fed into
the associative array %smtpd_tls_server_options if fields 'SSL_key_file'
and 'SSL_cert_file' are not provided (do not exist) there.
Example:
%smtp_tls_client_options = (
SSL_verifycn_scheme => 'smtp',
SSL_version => '!SSLv2,!SSLv3',
SSL_cipher_list => 'HIGH:!MD5:!DSS:!aNULL',
# SSL_client_ca_file => ... ,
);
%smtpd_tls_server_options = (
SSL_verifycn_scheme => 'smtp',
SSL_session_cache => 2,
SSL_key_file => "$MYHOME/cert/amavisd-key.pem",
SSL_cert_file => "$MYHOME/cert/amavisd-cert.pem",
SSL_dh_file => "$MYHOME/cert/amavisd-dh.dat",
# SSL_ca_file => ... ,
SSL_version => '!SSLv2,!SSLv3',
SSL_cipher_list => 'HIGH:!MD5:!DSS:!aNULL',
);
Or just to change some field and leave the rest at their default:
$smtp_tls_client_options{SSL_verify_mode} = 0; # SSL_VERIFY_NONE
Suggested by Marc Grooz and Patrick Ben Koetter, based on a patch
by Markus Benning.
- Supports receiving SMTP/LMTP connections through a HAProxy,
recognizing 'PROXY protocol Version 1' data on the first line read,
after a connection from HAProxy to amavisd has been established.
Connection data (IP addresses and ports) received via this protocol
end up replacing such data in the the Amavis::In::Connection object
($conn). Set configuration variable $haproxy_target_enabled (also
a member of policy banks) to true in order to enable this protocol.
- redis: allow a scoped / link-local IP address specification
(avoiding current limitation in IO::Socket::IP [rt.cpan.org #89608]);
- the Amavis::Unpackers::Part::digest method now holds a digest (SHA1,
hex) of a decoded (base64 or quoted-printable) MIME part contents,
followed by a colon and a lowercased Content-Type of the MIME part.
Canonical line endings CRLF in decoded textual parts are normalized
to a native newline (\n) before feeding them to a digest algorithm.
These digests are passed to SpamAssassin through a 'mimepart_digests'
supplementary attribute, and are available to custom hooks. As of
version SpamAssassin 3.4.1, these are used as additional tokens in
a Bayes plugin. Even though SpamAssassin is capable of computing
the same or similar digests on its own, the advantage of computing
them in amavisd is that they reflect all and completely unmodified
and untruncated MIME parts of a mail message, including non-textual
attachments.
For debugging, search the log for "mimepart digest: ", logged at
log level 5, and ".* Content-Type: .*, size:" at log level 2.
Based on a suggestion by Andreas Schulze back in 2014.
A configuration setting $mail_part_digest_algorithm was added, which
chooses an algorithm name for generating digests of decoded MIME
parts of a message. The value is an algorithm name as accepted by
Digest::SHA->new(), e.g. 'sha1' or 'SHA-1' or 'SHA-256' or 'sha256',
or a string 'MD5' (case-insensitive) which chooses the MD5 algorithm
as implemented by a module Digest::MD5. An undefined value disables
generating digests of MIME parts. The $mail_part_digest_algorithm
setting is a dynamic setting, i.e. it is a member of policy banks.
For compatibility with SpamAssassin the chosen algorithm should be
SHA1 (which is a default), otherwise bayes tokens won't match those
generated by sa-learn (which is typically used for off-line learning).
Bayes auto-learning in SpamAssassin is unaffected by a mismatch of
the algorithm, as it believes digests received from amavisd.
- Policy bank names in a @client_ipaddr_policy setting can now accept
a comma-separated list of policy names to be loaded on a match
(for loading of policy banks based on an IP address of a SMTP client).
Whitespace around each policy name is allowed and is stripped.
Previously only a single policy bank name was allowed in each entry
of @client_ipaddr_policy.
This makes it consistent with loading of policy banks based on a
DKIM-based setting @author_to_policy_bank_maps, and on virus checker
results via the @virus_name_to_policy_bank_maps setting.
- Experimental feature: IP lookups (as implemented by lookup_ip_acl()
and used by @client_ipaddr_policy) can now also do DNS-based lookups,
in addition to array- and hash- based lookups.
Suggested by Patrick Ben Koetter and loosely based on his patch.
DNS lookups follow RFC 5782 conventions (DNS Blacklists and Whitelists:
DNSBL, DNSWL, collectively known as DNSxL). A DNS query of a type 'A'
is performed on a reversed IP address prepended to a specified domain
name (zone name). RFC 5782 suggests that only type-A resource records
of a DNS reply in an address range 127.0.0.0/8 may be considered.
For example, given a zone name 'rbl.example.org' and a SMTP client's
IP address 198.51.100.12, a DNS type-A query for a domain name
"12.100.51.198.rbl.example.org" would be sent to a specified or to a
default DNS resolver or server. Similarly, an IP address 2001:db8::2:f
would produce a DNS type-A query for a domain name "f.0.0.0.2.0.0.0.0.
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.rbl.example.org" .
The setting @client_ipaddr_policy contains a list of pairs, each pair
consisting of a lookup object (arrayref or hashref, or now also an
Amavis::Lookup::DNSxL object), followed by a policy bank name (which
is a string: one or more policy bank names, comma-separated).
The object constructor Amavis::Lookup::DNSxL->new accepts as its
arguments: a dns zone name, expected result(s) for a match, and a
resolver object. Only the first argument (a DNSxL zone name) is
required, the remaining two arguments are optional. A default
expected result is '127.0.0.2', and a default Net::DNS::Resolver
persistent object is provided implicitly if not provided by a caller
(it reads a DNS resolver's IP address from /etc/resolv.conf).
The "expected result(s) for a match" argument (the second argument)
is compared to the address found in a DNS reply (in a 127.0.0.0/8 range).
It can be:
a) an integer between 0 and 255 (or a string representing such
integer), which is used to match the last byte on the 127.0.0.x quad;
b) a string in a dotted-quad form of an IPv4 address in a 127.0.0.0/8
range, where leading bytes may be omitted (e.g. '1.8' == '127.0.1.8');
c) a reference to an array consisting of entries in an (a) or (b) form,
where a match with any of the array elements suffices for a match;
d) a perl regular expression object (e.g. qr{^127\.[3-8]\.0\.\d*$} ).
If an IP address in a DNS reply matches the provided "expected result"
argument, the policy banks associated with that entry are loaded,
and a search through a @client_ipaddr_policy list stops.
As a shorthand a subroutine Amavis::Conf::q_dns_a() is provided,
which is just a convenient wrapper for Amavis::Lookup::DNSxL->new().
Example:
@client_ipaddr_policy = (
[qw( 0.0.0.0/8 127.0.0.0/8 [::] [::1] )] => 'MYNETS, LOCALHOST',
[qw( 169.254.0.0/16 [fe80::]/10 )] => 'MYNETS, LINKLOCAL',
[qw( 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 )] => 'MYNETS, PRIVATENET',
\@mynetworks => 'MYNETS',
q_dns_a('rbl.example.org') => 'MY-CUSTOMER-A', # 127.0.0.2
q_dns_a('rbl.example.org', 3) => 'MYNETS,MY-CUSTOMER-B', # 127.0.0.3
q_dns_a('rbl.example.org', '0.2.99') => 'MY-CUSTOMER-C', # 127.0.2.99
q_dns_a('rbl.example.org', '127.0.0.7') => 'MY-CUSTOMER-D', # 127.0.0.7
q_dns_a('rbl.example.org', qr/^127\.1\.\d+\.2\d*\z/) =>'X', # 127.1.*.2*
q_dns_a('rbl.example.org', '192.0.2.0.2')=>'never matches', # not in 127/8
);
Below is an example of an amavisd.conf section with an explicitly
provided Net::DNS::Resolver object, which offers finer control over
its settings:
use Net::DNS;
my $dnsxl_res = Net::DNS::Resolver->new(
config_file => '/etc/resolv.conf',
port => 5333, retry => 1, persistent_udp => 1,
tcp_timeout => 2, udp_timeout => 2, retrans => 1,
);
$dnsxl_res or die "Module Net::DNS not available for DNSxL usage";
$dnsxl_res->udppacketsize(1220);
my $myrbl = 'rbl.example.org';
@client_ipaddr_policy = (
\@mynetworks => 'MYNETS',
q_dns_a($myrbl, 2, $dnsxl_res) => 'MY-CUSTOMER-A', # 127.0.0.2
q_dns_a($myrbl, [3,4,5], $dnsxl_res) => 'MY-CUSTOMER-B', # 127.0.0.{3,4,5}
);
This DNS-lookup feature is considered experimental in a sense that
its API may change in future versions. As it is currently implemented,
each q_dns_a() entry in a @client_ipaddr_policy results in its own
DNS query, which is quite inefficient with more that one or two such
entries. It would make more sense to do a single DNS lookup and provide
some mapping between results returned and policy bank names to be
loaded. Note also that DNS lookups are performed synchronously and
sequentially (one at a time, one after another), so a slowly responding
DNS server combined with multisecond timeouts and retries could severely
bog down the amavisd response time, easily to exceed the time a MTA or
a SMTP client is willing to wait for a response. YOU HAVE BEEN WARNED!
OTHER
- Relax a check on a PID number found in a pid file, considering
that amavisd may run as PID #1 under Docker; reported by Imre Rad.
- Relax a check on $pid_file being configured or provided by a command
line option -P. Amavisd can now run without checking or providing a
PID file of a running master process, which is appropriate for running
non-daemonized amavisd as a supervised process (e.g. under supervision
suites such as systemd, s6, nosh, runit, launchd or similar). Also,
specifying a command line option -P '' (i.e. giving it an empty name
of a pid_file) overrides a configuration option $pid_file and is a
quick way to disable usage of a pid_file.
A default value of $pid_file is now only provided if a global
setting $daemonize is true (which is a default, unless running
with 'foreground' or 'debug' command line options).
A non-daemonized amavisd leaves $pid_file undefined as a default,
which facilitates running amavisd as a supervised process, e.g.
$daemonize = $pid_file = $daemon_user = undef;
When a pid_file is disabled and running under systemd, amavisd obtains
a PID of a master process from systemd through environment variable
MAINPID, which allows operations like 'amavisd reload' and 'amavisd stop'
from a .service file (ExecReload and ExecStop in systemd.exec(5)).
Btw, a command line argument 'foreground' is a quick way to override
a configuration setting $daemonize - it sets its value to 0.
To let amavisd provide and use a PID file even when not daemonized,
configure a PID file explicitly, e.g.: $pid_file = "$MYHOME/amavisd.pid";
- provide sensible diagnostics when $daemon_user is undefined and
starting as root;
- 'sanitize_nul' function is now enabled by default (this is currently
not configurable). Null octets found in a message are replaced by a
pair of octets \xC0 \x80, which is a "Modified UTF-8" encoding of a
NUL. This is done to avoid a mailbox server (like Cyrus) or a mail
client on choking on such mail. The downside is that such sanitation
can invalidate a DKIM signature - but non-encoded NUL octets are not
allowed in mail anyway, so not much harm is done;
- overhauled a client side of the ClamAV clamd protocol;
- updated decoder for 7z archives to improve handling of encrypted
content; based on a patch by Markus Benning;
- recognize and handle completely encrypted zip archives by 7z
(in do_7zip); a patch provided by Thomas Jarosch;
- adjusted log levels of some log/debug messages;
- reject a message with an 8BITMIME body type if a back-end MTA does
not announce 8bit-MIMEtransport capability in its EHLO response
( 550 5.6.3 Conversion to 7BIT required but not supported );
- replaced calls to Encode::is_utf8() by utf8::is_utf8() - less buggy
in old versions of perl, but requires perl 5.8.1 or later;
- replaced calls to Encode::encode_utf8() by utf8::encode() - is
much faster, and is less buggy in old versions of perl;
- more detailed testing for taint bugs of a module Encode and in
utf8::is_utf8() during startup;
- decode a supposedly (or guessably) character set ISO-8859-1 as
Windows-1252, which is a proper superset of ISO-8859-1 and often
mistaken for ISO-8859-1; (this follows advice of HTML5);
- with MySQL: changed character set 'utf8' to 'utf8mb4' for fields
msgs.subject and msgs.from_addr;
- in case the Net::Server receives a connection over a Unix socket
(e.g. from amavisd-release) but is unable to determine a socket name,
supply a dummy socket name 'UNKNOWN' so that a policy bank 'SOCK'
can still be loaded;
- the setting $mail_digest_algorithm is now a dynamic setting, i.e.
can be configured per policy bank. The change makes it consistent
with a new setting $mail_part_digest_algorithm, which is also dynamic;
- updated the @av_scanners Avast entry ( http://www.avast.com/ )
in the sample config file amavisd.conf to a new version
of their scanner:
['avast! Antivirus', '/bin/scan', '{}', [0], [1], qr/\t(.+)/m]
Thanks to Martin Tůma from Avast for the new entry;
- updated a default @$map_full_type_to_short_type_re to distinguish
encrypted PGP/GnuPG files from other PGP/GnuPG containers like
a detached signature, exported public key files, etc., if a
newer version of a file(1) utility is in use (5.20?);
- relaxed the /\bscript\b.* text executable\b/ regexp entry in the
default @$map_full_type_to_short_type_re list so that a mail part
such as qualified by a file(1) utility as:
Python script, Non-ISO extended-ASCII text executable
does not qualify as an executable; reported by Tilman Schmidt;
- updated a default @$map_full_type_to_short_type_re to recognize
a Microsoft Word document as type doc; thanks to Jörg Backschues;
- added PhishTank.Phishing to a default @virus_name_to_spam_score_maps;
- reworded some notification texts;
SUPERVISED PROCESS NOTES
Socket activation (running under a superserver with fd-holding) is
currently not available. Note that 'amavisd reload' does fd-holding
and socket passing to a new incarnation of amavisd server on its own,
which means that a client (an MTA) does not see a disruption on a
reload (= warm restart), unlike in case of restarting amavisd.
As a reminder: a full restart is only necessary when changing the set
of listening sockets in a configuration file. For all other needs
(like changing other settings, updating SpamAssassin rules, upgrading
the amavisd program, or perl modules, or perl itself) a reload suffices.
Here is a sample file amavisd.service for use under systemd
(indented for clarity). Lightly tested on Debian 8.0 (Jessie)
on a Raspberry Pi.
/lib/systemd/system/amavisd.service
[Unit]
Description=amavisd-new mail filter
Before=shutdown.target
After=systemd-journald-dev-log.socket network-online.target local-fs.target
Wants=network-online.target
Conflicts=shutdown.target
[Service]
Type=notify
NotifyAccess=main
KillMode=mixed
TimeoutStartSec=1min
TimeoutStopSec=3min
User=amavis
Group=amavis
WorkingDirectory=/var/lib/amavis/tmp
StandardOutput=syslog
SyslogFacility=mail
SyslogIdentifier=amavis
ProtectSystem=full
ProtectHome=yes
NoNewPrivileges=yes
ExecStart = /usr/sbin/amavisd-new -P '' foreground
ExecReload = /usr/sbin/amavisd-new -P '' reload
ExecStop = /usr/sbin/amavisd-new -P '' stop
[Install]
WantedBy = multi-user.target
Consider the following amavisd.conf settings when running as a
supervised process:
$pid_file = ''; # can be overridden by a command line option -P ''
$daemonize = 0; # also implied by a command line argument 'foreground'
$do_syslog = 0; # or set it to 1 to log to syslog instead of stderr
---------------------------------------------------------------------------
October 25, 2014
amavisd-new-2.10.1 release notes
Contents:
COMPATIBILITY
BUG FIXES
OTHER
COMPATIBILITY
There are no incompatibilities between versions 2.10.0 and 2.10.1.
BUG FIXES
- fixed a missing import of mail_addr_idn_to_ascii() and idn_to_utf8()
when SQL is in use, resulting in:
Undefined subroutine &Amavis::Out::SQL::Log::mail_addr_idn_to_ascii
Undefined subroutine &Amavis::Out::SQL::Log::idn_to_utf8
reported by Jim Knuth;
OTHER
- avoid warnings issued by perl 5.21.5:
Negative repeat count does nothing at ./amavisd line 17218
Missing argument in sprintf at ./amavisd line 3678
- updated documentation in 2.10.0 release notes (new macros);
---------------------------------------------------------------------------
October 22, 2014
amavisd-new-2.10.0 release notes
Contents:
COMPATIBILITY
BUG FIXES
NEW FEATURES
OTHER
COMPATIBILITY
- New requirement: perl module Net::LibIDN needs to be installed.
- Uses a perl module File::LibMagic if installed, instead of spawning
a file(1) utility.
- Support for international email relies heavily on perl to do the
right thing in its support of Unicode, so using a reasonably recent
version of perl is recommended. Amavisd was tested with perl 5.18
and 5.20.1. Versions of perl older than 5.12 may cause problems
with handling, encoding, and decoding of Unicode characters.
It is reasonable to expect that versions 5.14 and 5.16 are fine too,
but have not been tested extensively.
- Default log templates and notification templates have changed
in details (like in decoding of international e-mail addresses), so
if locally customized templates are in use these will benefit from
updating - otherwise expect some mojibake in log and notifications.
- International domain names (IDN) encoded in ASCII-compatible encoding
found in e-mail addresses and in Message-ID header field will be decoded
to Unicode for presentation purposes (syslog, JSON structured log,
notifications). This decoding does not affect a mail message itself.
- Logging via syslog expects that syslogd (or equivalent) will not
clobber UTF-8 octets. It may be necessary to tell syslogd to accept
C1 control characters unchanged, e.g. by adding a command line option
"-8" to syslogd. Failing to do so may leave logged entries (like
sender and recipient address, From, Subject) in international mail
garbled or poorly readable in syslog.
On FreeBSD one should add: syslogd_flags="-8" to /etc/rc.conf.
- Third party log parsers may need updating to accept logs with Unicode
characters in UTF-8 encoding.
- A SMTP response to an EHLO command will now announce SMTPUTF8 capability
by default.
BUG FIXES
- releasing a message from an SQL quarantine was broken in version
2.9.1 due to introduction of parent_mail_id(); patches provided by
Stef Simoens and Gionatan Danti;
- if checking of a message was aborted prematurely (like due to a
timeout or some fatal error), JSON log could receive a copy of a
previous log entry;
- prevent non-ASCII non-UTF-8 octets from reaching a JSON log/report
(which produced an invalid JSON object and Elasticsearch complaining);
- allow SMTP commands MAIL FROM and RCPT TO to accept options without
values, as allowed by the RFC 5321 syntax;
- in delivery status notification (DSN) the field Received-From-MTA
specified 'smtp' as mta-name-type, instead of a 'dns' as prescribed
in RFC 3464;
- releasing from a quarantine left envelope sender address as '<>'
instead of using the address found in a Return-Path header field
of a quarantined message, while also logging a warning:
Quarantine release $QID: missing X-Envelope-From or Return-Path
reported by Pascal Volk;
- avoid failure in os_fingerprint or in smtp forwarding in certain cases
where the $os_fingerprint_method or $forward_method or $notify_method
uses an asterisk in place of a host IP address or port number.
The reported error in os_fingerprint (reported by -ben) was:
os_fingerprint FAILED: Insecure dependency in socket
while running with -T switch
at /usr/lib/perl/5.18/IO/Socket.pm line 80
and in SMTP forwarding or notification (reported by Dennis Boone):
(!)connect to *:10025 attempt #1:
Insecure dependency in socket while running with -T switch
at /usr/lib/perl/5.18/IO/Socket.pm line 80.
- files LDAP.ldif and LDAP.schema: added a missing attribute
amavisDisclaimerOptions to objectClass; reported by Quanah Gibson-Mount;
NEW FEATURES
- added support for Internationalized Email:
* RFC 6530 - Overview and Framework for Internationalized Email
* RFC 6531 - SMTP Extension for Internationalized Email (SMTPUTF8)
* RFC 6532 - Internationalized Email Headers
* RFC 6533 - Internationalized Delivery Status Notifications
This supports UTF-8 (EAI) in SMTP/LMTP sender addresses, recipient
addresses, and message header section. Feature parity with Postfix
version 2.12 (support introduced in development snapshot 20140715).
The SMTPUTF8 extension is supported by Gmail since 2014-08-05:
http://googleblog.blogspot.com/2014/08/a-first-step-toward-more-global-email.html
- added support for Internationalized Domain Names (IDN) according
to IDNA (RFC 5890, RFC 5891; RFC 3490);
* A-labels in ASCII-compatible encoding of domain names are converted
to U-labels for presentation/logging purposed;
* U-labels are converted to A-labels when feeding a mail message
to an MTA which does not announce support for SMTPUTF8 extension
(instead of rejecting them as invalid mail address);
* For lookup purposes an international domain name is converted to
ASCII-compatible encoding when used as a query key in DNS lookups
and in lookups into hash, list, SQL and LDAP lookup tables (but not
in regexp table lookups). These tables are expected to contain domain
names in their ASCII representation (ACE). For convenience of config
files subroutines idn_to_ascii() and mail_idn_to_ascii() are available,
which encode a Unicode domain name to ACE (like ToASCII in RFC 3490);
* Many configuration settings may have their domain names in UTF-8.
These will be converted to ACE automatically where necessary
(e.g. when creating a Received and Authentication-Results header
fields, DKIM signatures, mail addresses in notifications, ...).
These settings include:
$myhostname, $localhost_name, $myauthservid, $mydomain,
notification sender and recipient mail addresses
($mailfrom_notify_*, $hdrfrom_notify_*, @*_admin_maps),
domain names and selectors in DKIM signing keys (in calls
to dkim_key() );
- delivery notifications and admin notifications now show the following
information encoded as UTF-8 (which is a default $bdy_encoding) in the
plain text part of the message: IDN domain names in sender and recipient
mail addresses and Message-ID are first decoded to Unicode, Subject and
author display names are MIME-decoded;
- 'amavisd showkeys' and 'amavisd testkeys' can now deal with IDN
(international domain names): domain names in DNS zone comments
end up as UTF-8, DNS labels are in ASCII (A-labels); domain names in
calls to dkim_key() may be specified either as UTF-8 or in ASCII (ACE);
- new macro 'mail_addr_decode' takes an e-mail address as a string of
octets, where a local part may be encoded as UTF-8, and the domain part
may be an international domain name (IDN) consisting either of U-labels
or A-labels or NR-LDH labels. Decodes A-labels to U-labels in domain
name. Returns a string of logical characters (Unicode), suitable for
notification templates. If the mail address is not a valid UTF-8 string,
it is interpreted as ISO-8859-1 (Latin-1).
- new macro 'mail_addr_decode_octets' is like 'mail_addr_decode', except
that the result is a string of octets, only valid as UTF-8 if the
provided address was a valid UTF-8 (garbage-in/garbage-out);
- new macro 'header_field_octets' is like 'header_field', except that
a result is a string of octets in UTF-8 encoding, suitable for a log
template;
- new macro 'ip_proto_trace_all' expands into a list of information
items from a Received header trace; each item consists of a protocol
name (the WITH clause) and an IP address, optionally followed by a
source port number if known;
Example:
ESMTP://[2001:db8::143:1]:39141 < ESMTP://2001:db8::25 <
esmtps://203.0.113.172 < ESMTPSA://192.168.9.9
or:
UTF8SMTP://[203.0.113.172]:51208 < UTF8SMTPSA://192.168.9.9
- new macro 'ip_proto_trace_public' is like ip_proto_trace_all, except
that entries with non-public IP address are excluded from the list;
'Received' trace information in $log_verbose_templ and in notifications
now include results from this macro call;
- new macro 'protocol' evaluates to a protocol name by which a message
was received by amavisd, according to RFC 3848 ("Transmission Types
Registration") and "Mail Transmission Types" / "WITH protocol types"
IANA registration
http://www.iana.org/assignments/mail-parameters/mail-parameters.xhtml
e.g.: SMTP, ESMTP, ESMTPA, ESMTPS, ESMTPSA, LMTP, LMTPA, LMTPS, LMTPSA,
UTF8SMTP, UTF8SMTPA, UTF8SMTPS, UTF8SMTPSA,
UTF8LMTP, UTF8LMTPA, UTF8LMTPS, UTF8LMTPSA, ...
- new macro 'client_protocol' expands into a protocol name by which
a message was received from a client by MTA; the information is passed
from MTA to amavisd through XFORWARD PROTO SMTP protocol extension or
through AM.PDP (milter); typical values are 'ESMTP' or 'SMTP';
- use a perl module File::LibMagic when available, instead of spawning
a file(1) utility for classifying contents of mail parts.
By using a direct interface to a libmagic library the startup cost
of spawning an external process is avoided. Benchmarking shows that
using libmagic is significantly faster especially for checking a small
number of files - takes 4 ms for checking one file with libmagic
vs. 27 ms with a spawned file(1); based on a patch by Markus Benning;
OTHER
- RFC 6533: recognize a MIME type 'message/global' as similar
to 'message/rfc822', and 'message/global-headers' as similar
to 'text/rfc822-headers' where appropriate (e.g. in bounce killer);
- header validity check now distinguishes 'non-ASCII and invalid UTF-8'
from 'non-ASCII but valid UTF-8' characters in a mail header section.
By default valid UTF-8 strings in a mail header section are not treated
as error even if mail is not flagged as international mail (SMTPUTF8),
as these are quite common in practice. To treat non- MIME-encoded UTF-8
in a header section as error the test can be enabled by:
$allowed_header_tests{'utf8'} = 1;
- ORCPT attribute in SMTP 'RCPT TO' command now accepts the original
recipient mail address in any of these encodings: utf-8-address,
utf-8-addr-unitext, utf-8-addr-xtext, or as a legacy xtext,
as required by RFC 6533;
- updated do_cabextract (extraction of Microsoft cabinet .cab archives)
to recognize a slightly changed output of cabextract version 1.2;
patch by Thomas Jarosch;
- adjusted some timeouts to leave more reserve for later stages of
mail processing and forwarding;
- prefer sanitizing/protecting control characters as hex code (like \x7F)
instead of octal (like \177) (e.g. in logging and DSN);
---------------------------------------------------------------------------
June 27, 2014
amavisd-new-2.9.1 release notes
Contents:
COMPATIBILITY
BUG FIXES
OTHER
COMPATIBILITY
There are no known incompatibilities between versions 2.9.0 and 2.9.1.
BUG FIXES
- when a $final_bad_header_destiny is set to D_BOUNCE and a mail
message was a DSN or coming from a mailing list, spam checks were
inappropriately skipped (logged as: "bypassing of spam checks,
message will be blocked anyway", which was not true as the blocking
was overruled at a later stage); reported by Bruce Pennypacker;
- perl 5.20.0 may occasionally report:
"Malformed UTF-8 character (unexpected end of string)"
due to a bug in perl [perl #122148]. Treat this error as non-fatal
and only log a warning in two such cases: when SpamAssassin is called
as a spawned subprocess ($sa_spawned=1) and is returning a result
to a parent process, or when constructing a structured report.
OTHER
- updated decoding of RAR archives to recognize a changed format in output
of 'unrar' utility version 5; based on a patch by amavis17(at)iotti.biz
- avoid tempfailing a message if a redis server is down, just log the
error and carry on;
- some minor logging changes to facilitate troubleshooting;
---------------------------------------------------------------------------
May 9, 2014
amavisd-new-2.9.0 release notes
Contents:
COMPATIBILITY
NEW FEATURES SUMMARY
RELAXED LICENSE
BUG FIXES
NEW FEATURES
OTHER
WHY REDIS?
COMPATIBILITY
This version drops dependency on a Perl module Redis, and makes
dependencies on modules Convert::TNEF and Convert::UUlib truly optional.
The following change may affect third-party log parsers:
To facilitate forensic log analysis and troubleshooting, log entries
'FWD from' and 'SEND from' at level 1 now carry one additional
prefixed information field which is the unique internal mail_id of
the message, possibly followed by a parent_mail_id in parenthesis,
e.g.:
(00525-02) XE9xnQYjrWyd FWD from <...> -> <...>, ...
(00495-02) v1pyIOMQkUYD(CIcqao-vCDO9) SEND from <...> -> <...>, ...
No other incompatibilities with a previous version 2.8.1 are expected.
NEW FEATURES SUMMARY
- structured log/reporting to a Redis server in JSON format;
- IP address reputation (uses a Redis server);
- added two minor content categories to the major ccat CC_UNCHECKED
(encrypted (=1) and over-limits/mail-bomb (=2) );
- introduced a by-recipient setting %final_destiny_maps_by_ccat.
RELAXED LICENSE
Some utility / auxiliary programs that were previously released under a
3-clause BSD license, are now available under a more relaxed 2-clause BSD
license (also known as a "Simplified BSD License" or a "FreeBSD License").
Affected programs are: amavis-mc, amavis-services, amavisd-status,
amavisd-snmp-subagent-zmq, amavisd-release, amavisd-submit, p0f-analyzer.pl,
amavisd-nanny, amavisd-agent, amavisd-snmp-subagent, amavisd-signer,
JpegTester.pm, and TinyRedis.pm.
Note that TinyRedis.pm is provided in the package as a separate file
and includes a documentation section. Its copy is also included in
the file amavisd, so that the separate file is not needed for Amavis
operation. The separate copy is provided under a 2-clause BSD license
so that it may be useful for third parties if desired. Eventually it
could be moved to CPAN as an independent module.
A license of the main program 'amavisd' remains unchanged GPLv2.
BUG FIXES
- fixed "Insecure dependency in sprintf" in Sophos SAVI av-scanner,
reported by Maciej Uhlig;
- fixed the interface code to virus scanners Sophie, Trophie and fpscand,
where a time-out on a long-running virus scan would leave a connection
to the virus scanner open and a late response from a scanner to a
previous request could be interpreted as a result of the current scan;
reported by David Schweikert;
- fixed a bug in transforming an IPv6 alternative form IP address into
a preferred form. One effect of this bug was declaring an IPv4-mapped
IPv6 address as syntactically incorrect; reported by Patrick Domack;
- if SQL logging was disabled a pen pals feature was non-functional even
when a Redis storage back-end was available and collecting data; now
pen pals is fully functional with a Redis database back-end and no SQL;
- provided our own Redis client code, avoiding Redis CPAN module bugs,
its slowness and non-support for IPv6.
The noteworthy Redis CPAN module bug is the #38 (failing to re-select
a non-zero-index database after an automatic re-connect to a server).
See: https://github.com/melo/perl-redis/issues/38
https://github.com/melo/perl-redis/issues/28
- fixed a regexp in parsing wildcarded signing domain in a DKIM key
declaration and in a wildcarded sender pattern of signing options
(this feature is rarely used, exists for compatibility with dkim_milter);
- dropped hard-coded dependency on modules Convert::TNEF and Convert::UUlib.
The Convert::TNEF was made optional in amavisd-new-2.8.0, but the
program still failed if the module could not be loaded at startup.
Both of these modules are now loaded at run time when first used, if
specified in the @decoders setting. The use of module Convert::UUlib
(the do_ascii entry) is disabled in a default setting of @decoders,
and the module Convert::TNEF (the do_tnef entry) is not used
if an external TNEF decoder (the do_tnef_ext entry) is available,
or if disabled in the @decoders list;
- import a missing do_log_safe() in Amavis::LDAP::Connection to avoid
a warning: _WARN: \t(in cleanup)
Undefined subroutine &Amavis::LDAP::Connection::do_log_safe
called at (eval 101) line 76 during global destruction;
a patch by Quanah Gibson-Mount;
- at startup amavis may try to find a decoder for 7z and zip extensions
twice; a fix by Quanah Gibson-Mount;
- fixed the amavisd-new-courier.patch which resulted in two instances
of sub post_bind_hook(). Only tested for syntax. Thanks to Eray Aslan.
NEW FEATURES
- Structured logging/reporting in JSON format is now available through
a redis server.
Each processed mail message and each generated mail message (e.g.
a delivery status notification) generates a structured data object
(internally a perl associative array). Its fields carry information
on most attributes of a mail message and its processing, similar
to what is available for logging via macros. Unlike a plain text
log which can be difficult to parse and inconsistent due to user
configurability of the log template, the data object contains
information in a structured form as key/value pairs, where each
value can be a scalar or a list or an associative array.
This internal data object is then serialized to a JSON format and
sent to a redis server, where it is appended to a list under a key
(arbitrary string) configured by $redis_logging_key setting. This
list serves as a queue of log events, which may be pulled from the
queue by some third party application, e.g. by a logstash utility
or by some home-grown program. Redis server is quite handy for this
purpose as it offers blocking requests for pulling events from a
queue, which makes it easy to interface with an event processing
program. The queue also allows for independent and asynchronous
operation between amavisd child processes filling the queue, and
a log analyzer pulling entries from the queue.
The structured logging to redis is enabled when @storage_redis_dsn
is configured (see below at the 'IP address reputation' section)
and the setting $redis_logging_key is set to some nonempty and
nonzero string, and the $redis_logging_queue_size_limit is set
to some positive integer value (corresponding to a maximal number
of entries allowed in a queue).
Both the $redis_logging_key and $redis_logging_queue_size_limit are
undefined by default, so structured logging to redis is disabled
by default even if @storage_redis_dsn is configured.
The string in $redis_logging_key determines the key in a redis
database where the event queue (a redis list) will be maintained.
Semantically it is a name of the queue. This setting is a component
of policy banks, so log entries can be fed into different redis
queues depending on a policy bank loaded for each mail message.
To prevent a queue in the redis server from growing out of bounds,
e.g. when an event-pulling program is temporarily nonfunctional or
its processing is falling behind, the $redis_logging_queue_size_limit
setting imposes a maximal number of events that amavisd may push into
the queue, i.e. the maximal queue size. If the queue size limit is
reached, new log events from amavisd are discarded as long as the
queue size is at the limit. As a redis database is kept in memory, it
makes sense to choose the value of $redis_logging_queue_size_limit low
enough so that it does not use too much memory if the log processing
program goes down, but also high enough so that short outages of
the log processing program do not lose any log events. The setting
$redis_logging_queue_size_limit is global (not a component of policy
banks).
And example setting:
@storage_redis_dsn = ( { server => '[::1]:6379', db_id => 1 } );
$redis_logging_queue_size_limit = 300000;
# takes about 250 MB of redis memory per 100000 log entries
$redis_logging_key = 'amavis-log';
$policy_bank{'MYNETS'} = {
originating => 1,
redis_logging_key => 'amavis-log-myusers', # overrides global setting
}
The oldest event may be pulled from listed queues by the redis command:
BLPOP amavis-log amavis-log-myusers 0
so from a command line this may look like:
$ redis-cli -h ::1 -p 6379 -n 1
BLPOP amavis-log 0