CentOS 7 clamav與spam @ 工作雜記 :: 隨意窩 Xuite日誌
  • 關鍵字
  • 201612091154CentOS 7 clamav與spam

    先裝好epel
    yum install -y clamav*

    /usr/bin/freshclam
    若出現
    ERROR: Please edit the example config file /etc/freshclam.conf
    vi /etc/freshclam.conf
    # Comment or remove the line below.
    #Example 把這行mark掉

    抓出/home底下被感染的檔案
    clamscan -r --infected /home

    執行全域掃描抓出有問題的檔案,並記錄log檔 (注意:執行時間會很久,若是新機裝好就不必跑了)
    clamscan -r -l /var/log/clamscan.log --infected /
    若是跑mail主機,/home目錄可能會存放一堆使用者email垃圾感染信,

    每天更新病毒碼
    20 4 * * * root /usr/bin/freshclam

     

    垃圾信的部份:

    安裝 perl-Razor-Agent
    官網:
    http://rpmfind.net/linux/rpm2html/search.php?query=perl-Razor-Agent
    CentOS 7 可選Extras Packages for Enterprise Linux 7 for x86_64
    wget ftp://rpmfind.net/linux/epel/7/x86_64/p/perl-Razor-Agent-2.85-15.el7.x86_64.rpm
    rpm -ivh perl-Razor-Agent-2.85-15.el7.x86_64.rpm
    vi /etc/mail/spamassassin/local.cf
    新增use_ razor2 1

     

    安裝 Pyzor
    官網下載 http://pyzor.sourceforge.net/

    tar jxvf pyzor-0.7.0.tar.bz2
    python setup.py build
    python setup.py install

    若message或maillog一直出現pyzor相關異常(epel0.5.0版本怪怪的,用官網新版的)
    mkdir /var/spool/postfix/.pyzor
    vi /var/spool/postfix/.pyzor/inform-servers-0-3-x
    public.pyzor.org:24441

    vi /etc/mail/spamassassin/local.cf
    新增
    use_pyzor 1

    執行
    pyzor discover
    pyzor --homedir /etc/mail/spamassassin discover


    安裝DCC和unrar
    DCC 和 unrar 可用yam安裝
    yum install unrar DCC

    DCC開啟使用:
    vi /etc/mail/spamassassin/v310.pre
    loadplugin Mail::SpamAssassin::Plugin::DCC (#mark拿掉)


    vi /etc/mail/spamassassin/local.cf
    新增
    use_dcc 1
    dcc_home /var/dcc 

    安裝 spamassassin
    yum install spamassassin
    local.cf產生器
    https://hostineer.com/features/spamassassin-configuration-wizard
    貼到/etc/mail/spamassassin/local.cf 的最下面
    sa-learn --sync (產生bayes資料庫,先裝好Mailscanner再回頭作)
    spamassassin --lint --config-file=/etc/MailScanner/spamassassin.conf -D  (測試設定檔,先裝好Mailscanner再回頭作)
    useradd spam
    useradd nospam
    sa-learn --prefs-file=/etc/MailScanner/spamassassin.conf --showdots --spam /home/spam/Maildir/new
    sa-learn --prefs-file=/etc/MailScanner/spamassassin.conf --showdots --ham /home/nospam/Maildir/new
    加入每日排程
    vi /etc/crontab 把上面那兩行加進來,記得要加root


    垃圾信就寄給spam,正常信寄給nospam
    sa-learn --dump magic
    可以看到學習的狀況

     

     

    CentOS 7 fail2ban安裝|日誌首頁|CentOS 7 MailScanner安裝上一篇CentOS 7 fail2ban安裝下一篇CentOS 7 MailScanner安裝
    回應