时间: 2021-07-31 作者:daque
安置四个载入的软硬件包:
# dpkg -i *.deb
窜改/etc/amavis/amavisd.conf:
@inet_acl = qw( 127/8 1.2.3.4/32 ); # 1.2.3.4 is your external ip .. because want maybe also accept mail from that interface, it's up to you. $warnvirussender = 1; # i want to warn people, who have got virus. $warnvirusrecip = 1; # i want to warn my users about virus send to them. $warn_offsite = 1; # i want to warn senders/recipients, that are not located on my server $mailfrom_notify_admin = 'virusalert@example.com'; # $mailfrom_notify_recip = 'virusalert@example.com'; # change these to the appropriate email-adresses, you wish to use as sender $mailfrom_notify_spamadmin = 'spam.police@example.com'; # for spam and virus warnings $hdrfrom_notify_sender = 'amavis (content filter) <postmaster@example.com>'; $virus_admin = 'virus-admin@example.com'; # $spam_admin = 'spam-admin@example.com'; #
指定运用uvscan:
@av_scanners = (
['nai mcafee antivirus (uvscan)', 'uvscan', '--secure -rv --summary --noboot {}', [0], [13], qr/(?x) found (?: \ the\ (.+)\ (?:virus|trojan) | \ (?:virus|trojan)\ or\ variant\ ([^ ]+) | :\ (.+)\ not\ a\ virus)/ ],
);
找到/etc/postfix/master.cf如次行:
smtp inet n - n - - smtpd
改为如次:
smtp inet n n n - - smtpd -o content_filter=smtp-amavis:[127.0.0.1]:10024 smtp-amavis unix - - n - 2 smtp -o smtp_data_done_timeout=1200 -o disable_dns_lookups=yes 127.0.0.1:10025 inet n - n - - smtpd -o local_recipient_maps= -o smtpd_restriction_classes= -o smtpd_client_restrictions= -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o strict_rfc821_envelopes=yes
重启postfix,如许在收到宏病毒邮件的功夫不妨在日记文献看到如次的消息:
jul 16 15:34:22 xxx amavis[30997]: (30997-09) infected (w32/nimda.gen@mm), (?) -> <xxx@xxx.org>, quarantine virus-20030716-153422-30997-09, message-id: <20030716073414.520d3e5c2f@xxx>
三、防废物邮件局部
废物邮件的提防必需控制好标准,postfix自己供给了header_check、body_check、access、classes等办法来中断邮件,不妨参考如次地方的样例,贯串本人的情景举行窜改也能遏止一局部废物邮件:
http://www.xxxx.com/guides/postfix_uce_header.html http://www.xxxx.com/guides/postfix_uce_body.html http://www.xxxx.com/guides/postfix_uce_access.html http://www.xxxx.com/guides/postfix_uce_class.html
然而之上摆设文献须要处置员按照本人情景细工举行窜改,即使径直沿用的话,那么海内很多邮件你将收不到。 spamassassin和amavis不妨很好的贯串,它不妨帮处置员机动处置少许废物邮件。spamassassin很风趣,它对解码后的邮件举行扫描后打分,即使分数到达用户指定的分数,那么就觉得是废物邮件,并且它再有进修功效,处置员也不妨本人从新设置百般分值或自设置分值。
1、spamassassin的安置
因为仍旧安置了amavis,以是天然就采用了spamassassin。spamassassin不妨经过cpan安置:
# perl -mcpan -e shell install mail::spamassassin
2、spamassassin摆设
创造/var/lib/amavis/.spamassassin/user_prefs文献:
# spamassassin config file for version 2.5x # generated by http://www.yrex.com/spam/spamconfig.php (version 1.01)
# how many hits before a message is considered spam. required_hits 5.0
# whether to change the subject of suspected spam rewrite_subject 1
# text to prepend to subject if rewrite_subject is used subject_tag *****spam*****
# encapsulate spam in an attachment report_safe 1
# use terse version of the spam report use_terse_report 0
# enable the bayes system use_bayes 1
# enable bayes auto-learning auto_learn 1
# enable or disable network checks skip_rbl_checks 1 use_razor2 0 use_dcc 0 use_pyzor 0
# mail using languages used in these country codes will not be marked # as being possibly spam in a foreign language. # - chinese english ok_languages zh en
# mail using locales used in these country codes will not be marked # as being possibly spam in a foreign language. ok_locales en zh