您好,登錄后才能下訂單哦!
1.postfix搭建根據這個地址自己安裝。
點此進入
2.yum安裝,此安裝包可以通過RPMForge軟件倉庫安裝。
# yum install -y amavisd-new clamav clamav-devel clamd spamassassin
3.查看服務的開機自動啟動狀態
# chkconfig --list | grep "amavisd\|clamd\|spamassassin" amavisd 0:off 1:off 2:on 3:on 4:on 5:on 6:off clamd 0:off 1:off 2:on 3:on 4:on 5:on 6:off spamassassin 0:off 1:off 2:off 3:off 4:off 5:off 6:off
spamassassin這個服務沒有啟動,因為awavis-new直接將spamassassin作為一個模塊使用。
4.修改spamassassin配置
# vi /etc/mail/spamassassin/local.cf required_hits 5 report_safe 0 rewrite_header Subject [SPAM] use_bayes 1 bayes_auto_learn 1 skip_rbl_checks 0 use_razor2 1 use_pyzor 0
5.修改clamav配置
# vim /etc/clamd.conf #利用本地通信 LocalSocket /var/run/clamav/clamd.sock #注釋掉TCP通信端口 #TCPSocket 3310
6.修改amavis配置
# vim /etc/amavisd.conf (1).通過去除以下數行的注釋來停止檢查病毒域垃圾郵件(由于下面數行默認是被注釋掉的,因此病毒及垃圾郵件在預設中默認是被啟動的) @bypass_virus_checks_maps = (1); # controls running of anti-virus code @bypass_spam_checks_maps = (1); # controls running of anti-spam code $bypass_decode_parts = 1; # controls running of decoders&dearchivers (2).接著可以看到下面幾行 $max_servers = 2; # num of pre-forked children (2..30 is common), -m $daemon_user = "amavis"; # (no default; customary: vscan or amavis), -u $daemon_group = "amavis"; # (no default; customary: vscan or amavis), -g $inet_socket_port = 10024; # listen on this local TCP port(s) # $notify_method = 'smtp:[127.0.0.1]:10025'; # $forward_method = 'smtp:[127.0.0.1]:10025'; # set to undef with milter! $max_servers 設定同步執行的Amavisd-new進程數量,而且必須與/etc/postfix/master.cf內的amavisfeed服務的maxproc中相符合 $daemon_user及$daemon_group應該用來匹配Amavisd-new的用戶及群組 $inet_socket_port 定義Amavisd-new將會在哪一個tcp端口接納來自Postfix的連接 $notify_method及$forward_method定義Amavisd-new把郵件重新注入Postfix的途徑 (3).以下是必須修改項 $mydomain = 'meihua.info'; #我這里是free.com域 $MYHOME = '/var/amavis'; $helpers_home = "$MYHOME/var"; $lock_file = "$MYHOME/var/amavisd.lock"; $pid_file = "$MYHOME/var/amavisd.pid"; $myhostname = 'mail.meihua.info'; #我這里是mail.meihua.info主機 (4).下面是SpamAssassin設定來替換預設的SpamAssassin設置 $sa_tag_level_deflt = 2.0; # add spam info headers if at, or above that level $sa_tag2_level_deflt = 6.2; # add 'spam detected' headers at that level $sa_kill_level_deflt = 6.9; # triggers spam evasive actions (e.g. blocks mail) $sa_dsn_cutoff_level = 10; # spam level beyond which a DSN is not sent $sa_crediblefrom_dsn_cutoff_level = 18; # likewise, but for a likely valid From # $sa_quarantine_cutoff_level = 25; # spam level beyond which quarantine is off $penpals_bonus_score = 8; # (no effect without a @storage_sql_dsn database) $penpals_threshold_high = $sa_kill_level_deflt; # don't waste time on hi spam $bounce_killer_score = 100; # spam score points to add for joe-jobbed bounces $sa_mail_body_size_limit = 400*1024; # don't waste time on SA if mail is larger $sa_local_tests_only = 0; # only tests which do not require internet access? 說明,默認不需要修改但你得知道它們和意義,可以方便的幫助我們設置垃圾郵件‘ $sa_tag_level_deflt 指定Amavisd-new由哪一個級別開始寫入X-Spam-Flag、X-Spam-Score、X-Spam-Status等垃圾郵件資訊標頭,假如你想為所有郵件加入資訊標頭,請把此值設為 -999 $sa_tag2_level_deflt 指定由哪一個級別開始在垃圾郵件的標頭上標簽它們 $sa_kill_level_deflt 指定Amavisd-new由哪一個級別開始攔截和扣留郵件。這個用途很大,因為SpamAssassin在預設情況下不會這樣做 $sa_dsn_cutoff_level 指定由哪一個級別開始寄件失敗通告不會被發送給寄件人。由于多數垃圾郵件寄件者的地址都是偽造的,不為明顯的垃圾郵件發送寄件失敗通告是最合理的,要不然你只會加劇反向散寄的問題 $sa_quarantine_cutoff_level 指定哪一個級別開始不必扣留垃圾郵件。這個選項預設是被注釋掉的,意思是所有郵件都會被扣留 (5).下面是發送通告的郵件地址(默認是管理員郵箱,接收垃圾郵件通告的郵箱) $virus_admin = "postmaster\@$mydomain"; # notifications recip. $mailfrom_notify_admin = "postmaster\@$mydomain"; # notifications sender $mailfrom_notify_recip = "postmaster\@$mydomain"; # notifications sender $mailfrom_notify_spamadmin = "postmaster\@$mydomain"; # notifications sender (6).設置ClamAV的部分 # ### http://www.clamav.net/ ['ClamAV-clamd', \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"], qr/\bOK$/m, qr/\bFOUND$/m, qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ], 說明,/var/run/clamav/clamd.sock這個設定必須與我們先前在/etc/clamd.conf內輸入的LocalSocket /var/run/clamav/clamd.sock設定相一致。
7.修改postfix master.cf配置
# vim /etc/postfix/master.cf # ========================================================================== # # service type private unpriv chroot wakeup maxproc command + args # # (yes) (yes) (yes) (never) (100) # # ========================================================================== # # amavisfeed unix - - n - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o smtp_tls_note_starttls_offer=no -o disable_dns_lookups=yes -o max_use=20 說明,請注意在maxproc欄內的數值 2 必須要與/etc/amavisd.conf內的$max_servers設定一致。有關各選項的詳細解釋請參閱Amavisd-new的文檔(vim /usr/share/doc/amavisd-new-2.8.0/README.postfix)。然后我們定義一個專用的服務把郵件重新注入Postfix。我們為此在/etc/postfix/master.cf內加入一個在localhost(127.0.0.1)的tcp 10025端口(/etc/amavisd.conf的預設值)上監聽的smtp服務: # ========================================================================== # # service type private unpriv chroot wakeup maxproc command + args # # (yes) (yes) (yes) (never) (100) # # ========================================================================== 127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -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 smtpd_restriction_classes= -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 receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters,no_address_mappings -o local_header_rewrite_clients= -o smtpd_milters= -o local_recipient_maps=
8.修改postfix main.cf配置
# vim /etc/postfix/main.cf #filter mail content_filter = amavisfeed:[127.0.0.1]:10024
9.重啟postfix,clamd,amavis服務
# service postfix restart Shutting down postfix: [ OK ] Starting postfix: [ OK ] # service clamd start Starting Clam AntiVirus Daemon: LibClamAV Warning: ************************************************** LibClamAV Warning: *** The virus database is older than 7 days! *** LibClamAV Warning: *** Please update it as soon as possible. *** LibClamAV Warning: ************************************************** [ OK ] # service amavisd start Starting Mail Virus Scanner (amavisd): [ OK ]
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。