Exim
在 ubuntu 16.04 上使用 Exim 設置 spammassin 和 clamav
我一直在尋找使用 Exim 設置 Spammassassin 和 ClamAV 的幫助(在 ubuntu-16.04 上),但所有指南都已經過時了。有人可以分享他們的設置嗎?
指南可能相當陳舊,但設置過程並沒有真正改變。Exim4 規範包括關於在 ACL 時進行內容掃描的一章,應該可以幫助您入門。我相信您需要安裝
exim4-daemon-heavy
才能進行掃描。這是我的配置的一個摘要。我已經剝離了一些研究功能。
安裝
clamav
後,您需要取消註釋主配置讀取中的行:av_scanner = clamd:/var/run/clamav/clamd.ctl
如果
/etc/exim4/conf.d/main/02_exim4-config_options
您使用的是拆分配置,或者/etc/exim4/exim4.conf.template
您使用的是單個配置文件選項,則會出現此選項。進行掃描的最簡單方法是像這樣創建一個本地數據 acl
/etc/exim4/acls/40_local-config_check-data
。# -------------------------------------------------------------------- # Anti-Virus scanning # This requires an 'av_scanner' setting in the main section. # Defer if we find malware defer malware = */defer_ok retry=60 # --- BEGIN EXISCAN configuration --- # Invoke SpamAssassin to obtain $spam_score and $spam_report. # SA: log messages emulate sa-exim output for eximstats # # If the message is classified as spam, and we have not previously # set $acl_m_sa to indicate that we want to accept it anyway, # reject it. # Add a spam flag warn spam = mail:true add_header = X-Spam-Connect-Host: $sender_fullhost add_header = X-Spam-Mail-From: $sender_address add_header = X-Spam-Recipients: $recipients add_header = X-Spam-Flag: ${if >= {$spam_score_int}{SPAM_LIMIT}{YES}{NO}} add_header = X-Spam-Level: ${tr{$spam_bar}{+}{*}} # Add headers for data we will be reporting warn condition = ${if >= {$spam_score_int}{SPAM_REPORT}} add_header = X-Spam-Report: $spam_report # New Subject for BACN and SPAM warn condition = ${if >= {$spam_score_int}{SPAM_IS_HAM}} add_header = X-Spam-Subject: $h_Subject remove_header = Subject add_header = Subject: ${if < {$spam_score_int}{SPAM_IS_BACN} \ {BACN}{SPAM}} $spam_score: $h_Subject # Blackhole serious Spam discard condition = ${if eq {$acl_m_sa}{canreject}} condition = ${if >= {$spam_score_int}{SPAM_BLACKHOLE}} message = Discard recipients for this message spam $spam_score. logwrite = SA: Action: Blackholed message: score=$spam_score. \ From \<$sender_address\> $sender_fullhost for $recipients # Deny Spam deny condition = ${if eq {$acl_m_sa}{canreject}} condition = ${if >= {$spam_score_int}{SPAM_REJECT}} message = This message looks like spam $spam_score. logwrite = SA: Action: permanently rejected message: score=$spam_score. \ From \<$sender_address\> $sender_fullhost for $recipients
您需要定義垃圾郵件限制值。這些進入
/etc/exim4/conf.d/main/00_local_macros
或/etc/exim4/exim4.conf.localmacros
取決於您使用的配置文件方法。# Spamassassin SPAM_REPORT = -10 SPAM_IS_HAM = 25 SPAM_LIMIT = 35 SPAM_IS_BACN = 50 SPAM_REJECT = 100 SPAM_BLACKHOLE = 200
該變數
acl_m_sa
設置為指示這是郵件管理員/濫用郵件還是發送給使用者。這記錄在sa-exim
包的註釋中。您可能更喜歡使用sa-exim
而不是EXISCAN
上面的 ACL 部分。