請參閱:
http://www.trustix.net/wiki/index.php/Main_Page
http://www.trustix.net/wiki/index.php/Amavisd
-- 以下為網頁內容 --
Amavisd
From TrustixWiki
Jump to: navigation, search
Contents
[hide]
* 1 Amavisd-New
* 2 Install the required packages
* 3 Configure POSTFIX
* 4 Configure ClamAV
* 5 Configure SpamAssassin
* 6 Configure amavisd
* 7 Startup
* 8 Tips and Tricks
[edit]
Amavisd-New
To install amavisd-new , ClamAV & SpamAssassin for TSL 2.2 and 3.0 follow these instructions
[edit]
Install the required packages
swup --install amavisd-new clamav spamassassin
[edit]
Configure POSTFIX
Use text editor to add the following line into /etc/postfix/main.cf
content_filter=smtp-amavis:127.0.0.1:10024
Save the file
Now edit the file /etc/postfix/master.cf and locate the following
anvil unix - - n - 1 anvil
and add the following lines just below it
smtp-amavis unix - - y - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
pre-cleanup unix n - n - 0 cleanup
-o canonical_maps=
-o sender_canonical_maps=
-o recipient_canonical_maps=
-o masquerade_domains=
-o virtual_alias_maps=
The number 2 on the first line controls how many daemons to start. For a busy server, make this a bigger number (say '10') and also change $max_servers in /etc/amavisd.conf to the same number. Then it will be able to handle messages faster but uses more memory.
The above works if postfix and amavisd are on the same server; otherwise leave out '127.0.0.1:' on the next line, change the '-o mynetworks' line to allow access from the machine that runs amavisd, and also make sure that $forward_method = 'smtp:*:10025' in /etc/amavisd.conf on the other server.
Now locate the section with
smtp inet n - n - - smtpd
and turn it into
smtp inet n - n - - smtpd
-o cleanup_service_name=pre-cleanup
and turn
cleanup unix n - n - 0 cleanup
into
cleanup unix n - n - 0 cleanup
-o header_checks=
-o mime_header_checks=
-o nested_header_checks=
-o body_checks=
Save the file
[edit]
Configure ClamAV
ClamAV doesn't need any configuration in this case. If you like you can view the configuration file /etc/clamav.conf (/etc/clamd.conf in TSL 2.2).
[edit]
Configure SpamAssassin
There is no need to change the spamassassin own configuration file. But there are some values you may like to adjust in amavisd.conf. Look for section "SpamAssassin settings" in amavisd.conf. My preferred settings:
$sa_spam_subject_tag = '***SPAM*** ';
$sa_tag_level_deflt = undef;
$sa_tag2_level_deflt = 5.0;
$sa_kill_level_deflt = 10.0;
[edit]
Configure amavisd
Install additional packages to handle on-the-fly uncompression of attachments (This is optional and you need to turn on contrib in /etc/swup/swup.conf)
swup --install arc lha lzo freeze unrar unarj zoo lzop
Edit the file /etc/amavisd.conf
locate '$mydomain =' and add your domain after it
if you have multiple domains find the @local_domain_maps lines and use the most appropriate option, including read a hash file
locate '$warnvirussender' and uncomment it if you want the virus sender get a warning (and annoy inocent admins)
locate '$virus_admin' and set the email that will receive virus warnings
locate '$spam_admin' and set the email that will receive spam warnings
(Please go through the config file and make the changes that fits your needs)
[edit]
Startup
chkconfig amavisd on
chkconfig freshclam on
chkconfig clamd on
service clamd start
service freshclam start
service amavisd start
service postfix restart
[edit]
Tips and Tricks
To only scan certain files using amavis, use a postfix filter in the mime_header_checks file like so:
/name=[^>]*\.exe/ FILTER smtp-amavis:127.0.0.1:10024
and so on.
If your Postfix setup gets mailloops when using the above setup it may be that cleanup is re-reading the *_header_checks files and sending the mail back to the content filter. If this is happening try adding the following line to the :10025 entry:
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
This will instruct postfix/cleanup NOT to place a content check instruction on the email as it passes through.
-- 以上為網頁內容 --
其中, amavisd
預設只開放少數副檔名的檔案能做附件
可經由修改 /etc/amavisd.conf , 找到以下三行, 把第1, 3行前的 # 拿掉, 就可以傳bz2, gz, zip , rar, arc, arj, zoo 之類的副檔名檔案了
--
# [ qr'^\.(Z|gz|bz2)$' => 0 ], # allow any type in Unix-compressed
[ qr'^\.(rpm|cpio|tar)$' => 0 ], # allow any type in Unix archives
# [ qr'^\.(zip|rar|arc|arj|zoo)$'=> 0 ], # allow any type within such archives
--
|