次の記事はパート4です CentOS 6 VPSでPostfixとDovecotを使用して、仮想ユーザーとドメインでメールサーバーをセットアップした後、パート2 LinuxvpsサーバーにRoundcubeウェブメールインターフェースをインストールして設定する方法を説明してから、パート3 これは、SSL証明書を使用してPostfix、Dovecot、ApacheでSSL暗号化接続を設定する方法に関するものです。
このチュートリアルでは、 SpamAssassinを設定します CentOS 6の1つで Linux仮想サーバーをPostfixメールサーバーのセットアップに統合して、スパムとして検出された電子メールをスキャンしてマークできるようにします。
SpamAssassinとは何ですか?
これは、コンテンツマッチングルールに基づく電子メールスパムフィルタリングに使用されるApacheLicense2.0の下でリリースされたプログラムです。
システムを更新する
いつものように、 CentOS 6を確認してください linux vpsは、以下を実行することで完全に最新の状態になります。
## screen -U -S spamc-screen ## yum update
SPAMASSASSINをインストール
yum
を使用してSpamAssassinパッケージをインストールします 実行することにより:
## yum install spamassassin
セットアップユーザー
spamfilter
を作成します spamassassin
を実行するユーザーに使用されるグループ サービス
## groupadd spamfilter
新しいユーザーspamfilter
を作成します /usr/local/spamassassin
のホームディレクトリ それをspamfilter
に追加します 作成したグループ
## useradd -g spamfilter -s /bin/false -d /usr/local/spamassassin spamfilter ## chown spamfilter: /usr/local/spamassassin
SPAMASSASSINの設定
次に、spamassassin
を設定します /etc/mail/spamassassin/local.cf
を編集して 以下を追加/設定します
## vim /etc/mail/spamassassin/local.cf ## Required_hits: This determines the filter balance; the lower the score the more aggressive the filter. # A setting of 5.0 is generally effective for a small organisation or a single user. # Adjust the strictness score to your organization's needs - a large medical organisation might want to let email items # through that are trying to sell pharmaceuticals, so we might increase the level to a more modest 8.0. required_hits 5 ## Report_safe: This line determines whether to delete the item or to move the item to the inbox whilst appending # a spam notice to the subject line. The levels for this line are set to either a 1 or 0. A score of 1 will delete the spam item, # whereas a score of 0 will send the item to the inbox and rewrite the subject line. report_safe 0 rewrite_header Subject [**SPAM**] ## Required_score: This line sets the spam score for all email allowed through to your domain, with levels of certainty set from 0 to 5. # Zero would be classified as a legitimate email item, whereas 5 would be an definite 'SPAM' item. If we set the score to 3 we would catch a # lot of unsolicited emails but quite a few false positives would still get through. For our example email server we will use the score of 5, # but you can of course set this value according to your preference. required_score 5.0
spamassassin
の起動に進む前に サービスについては、新しく作成したspamfilter
で実行されることを確認する必要があります /etc/sysconfig/spamassassin
を編集してユーザー 以下を設定します:
## vim /etc/sysconfig/spamassassin # Options to spamd SAHOME="/usr/local/spamassassin" SPID_DIR="/var/run/spamassassin" SUSER="spamfilter" SPAMDOPTIONS="-d -c -m5 --username ${SUSER} -H ${SAHOME} -s ${SAHOME}/spamfilter.log"
これで、spamassassin
を起動して有効にする準備が整いました。 以下を使用したシステム起動時のサービス:
## service spamassassin start ## chkconfig spamassassin on
CONFIGURE POSTFIX
次に行う必要があるのは、実際にspamassassin
を統合することです。 postfix
に そのため、スパムとして検出された電子メールをスキャンしてマークを付けることができます。これを実現するには、postfix設定ファイルを編集する必要があります。 master.cf
を編集します :
## vim /etc/postfix/master.cf
次の行を追加/編集します:
smtp inet n - n - - smtpd -o content_filter=spamassassin spamassassin unix - n n - - pipe user=spamfilter argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
次に、変更を有効にするためにpostfixを再起動します
## service postfix restart
セットアップをテストする
SpamAssassinが実際に機能するかどうかをテストするには、件名が XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
のメールを送信するだけです。 一部のメールアカウントに送信し、メールを受信したら、ヘッダーを確認すると、次のようになります。
X-Spam-Flag: YES X-Spam-Level: ************************************************** X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,RCVD_IN_DNSWL_NONE, TVD_SPACE_RATIO autolearn=no version=3.3.1 ....
これは、SpamAssassinがその仕事をしていることを意味します。
SpamAssassinの実装 PostfixとDovecotを使用して仮想ユーザーとドメインでメールサーバーを設定すると、メールサーバーの設定にもう1つの優れた機能が追加されます。
ただし、opendkimを使用したデジタル署名、dovecot sieveフィルタールール、フル機能のメールサーバーのウイルススキャンなど、他にも欠落している部分があります。次のいくつかの関連記事では、セットアップに機能を追加する予定ですので、ご期待ください。
更新:パート5 –CentOS6VPSにOpenDKIMをインストールしてPostfixと統合する方法
更新:パート6 – CentOS6VPSでDovecotSieveとRoundcubeを使用してサーバー側の電子メールフィルタリングを設定する方法
もちろん、Linux VPS Hostingをご利用の場合は、これを行う必要はありません。管理者に質問し、座ってリラックスしてください。管理者がすぐにこれを設定します。
PS。 この投稿が気に入った場合は、左側のボタンを使用してソーシャルネットワーク上の友達と共有するか、下に返信を残してください。ありがとう。