amavisd-newインストールメモ

作業手順

(1) portinstall

% sudo portinstall security/amavisd-new

オプション選択ダイアログで "SASL" や "LDAP" が選択可能であるが,ここではチェックを外したまま(デフォルト)とする.

(2) /usr/local/etc/amavisd.conf編集

$mydomain = 'example.com';

(ToDo)

(3) /etc/mail/aliases編集

virusalert: root
spam.police: root
% newaliases

(4) main.cf

soft_bounce = yes
% sudo postfix reload

(5) amavisd設定

% sudo /usr/local/sbin/amavisd debug
% telnet 127.0.0.1 10024
Trying 127.0.0.1...
Connected to localhost.my.domain.
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
QUIT
221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel
Connection closed by foreign host.

(6) master.cf
末尾に追加

smtp-amavis unix -      -       n     -       2  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

127.0.0.1:10025 inet n  -       n     -       -  smtpd
    -o content_filter=
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_data_restrictions=reject_unauth_pipelining
    -o smtpd_end_of_data_restrictions=
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o smtpd_milters=
    -o local_header_rewrite_clients=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
% sudo postfix reload
postfix/postfix-script: refreshing the Postfix mail system
% telnet 127.0.0.1 10025
Trying 127.0.0.1...
Connected to localhost.my.domain.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
QUIT
221 2.0.0 Bye
Connection closed by foreign host.

(7) main.cf
末尾に追加

content_filter = smtp-amavis:[127.0.0.1]:10024
% sudo postfix reload
postfix/postfix-script: refreshing the Postfix mail system

(8) rc.conf

amavisd_enable="YES"

amavisd debugを終了

% sudo /usr/local/etc/rc.d/amavisd.sh start
Starting amavisd.

(9) procmail無効化
amavis-newは自力でSpamAssassinと連携できるので,procmailの設定を外す.

main.cf

####mailbox_command = /usr/local/bin/procmail
% sudo postfix reload
postfix/postfix-script: refreshing the Postfix mail system
% sudo postconf mailbox_command
mailbox_command =