您好,登錄后才能下訂單哦!
1.postfix搭建根據(jù)這個(gè)地址自己安裝。
點(diǎn)此進(jìn)入
2.yum安裝,此安裝包可以通過(guò)RPMForge軟件倉(cāng)庫(kù)安裝。
# yum install -y amavisd-new clamav clamav-devel clamd spamassassin
3.查看服務(wù)的開(kāi)機(jī)自動(dòng)啟動(dòng)狀態(tài)
# 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這個(gè)服務(wù)沒(méi)有啟動(dòng),因?yàn)閍wavis-new直接將spamassassin作為一個(gè)模塊使用。
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).通過(guò)去除以下數(shù)行的注釋來(lái)停止檢查病毒域垃圾郵件(由于下面數(shù)行默認(rèn)是被注釋掉的,因此病毒及垃圾郵件在預(yù)設(shè)中默認(rèn)是被啟動(dòng)的) @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 設(shè)定同步執(zhí)行的Amavisd-new進(jìn)程數(shù)量,而且必須與/etc/postfix/master.cf內(nèi)的amavisfeed服務(wù)的maxproc中相符合 $daemon_user及$daemon_group應(yīng)該用來(lái)匹配Amavisd-new的用戶及群組 $inet_socket_port 定義Amavisd-new將會(huì)在哪一個(gè)tcp端口接納來(lái)自Postfix的連接 $notify_method及$forward_method定義Amavisd-new把郵件重新注入Postfix的途徑 (3).以下是必須修改項(xiàng) $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主機(jī) (4).下面是SpamAssassin設(shè)定來(lái)替換預(yù)設(shè)的SpamAssassin設(shè)置 $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? 說(shuō)明,默認(rèn)不需要修改但你得知道它們和意義,可以方便的幫助我們?cè)O(shè)置垃圾郵件‘ $sa_tag_level_deflt 指定Amavisd-new由哪一個(gè)級(jí)別開(kāi)始寫(xiě)入X-Spam-Flag、X-Spam-Score、X-Spam-Status等垃圾郵件資訊標(biāo)頭,假如你想為所有郵件加入資訊標(biāo)頭,請(qǐng)把此值設(shè)為 -999 $sa_tag2_level_deflt 指定由哪一個(gè)級(jí)別開(kāi)始在垃圾郵件的標(biāo)頭上標(biāo)簽它們 $sa_kill_level_deflt 指定Amavisd-new由哪一個(gè)級(jí)別開(kāi)始攔截和扣留郵件。這個(gè)用途很大,因?yàn)镾pamAssassin在預(yù)設(shè)情況下不會(huì)這樣做 $sa_dsn_cutoff_level 指定由哪一個(gè)級(jí)別開(kāi)始寄件失敗通告不會(huì)被發(fā)送給寄件人。由于多數(shù)垃圾郵件寄件者的地址都是偽造的,不為明顯的垃圾郵件發(fā)送寄件失敗通告是最合理的,要不然你只會(huì)加劇反向散寄的問(wèn)題 $sa_quarantine_cutoff_level 指定哪一個(gè)級(jí)別開(kāi)始不必扣留垃圾郵件。這個(gè)選項(xiàng)預(yù)設(shè)是被注釋掉的,意思是所有郵件都會(huì)被扣留 (5).下面是發(fā)送通告的郵件地址(默認(rèn)是管理員郵箱,接收垃圾郵件通告的郵箱) $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).設(shè)置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 ], 說(shuō)明,/var/run/clamav/clamd.sock這個(gè)設(shè)定必須與我們先前在/etc/clamd.conf內(nèi)輸入的LocalSocket /var/run/clamav/clamd.sock設(shè)定相一致。
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 說(shuō)明,請(qǐng)注意在maxproc欄內(nèi)的數(shù)值 2 必須要與/etc/amavisd.conf內(nèi)的$max_servers設(shè)定一致。有關(guān)各選項(xiàng)的詳細(xì)解釋請(qǐng)參閱Amavisd-new的文檔(vim /usr/share/doc/amavisd-new-2.8.0/README.postfix)。然后我們定義一個(gè)專用的服務(wù)把郵件重新注入Postfix。我們?yōu)榇嗽?etc/postfix/master.cf內(nèi)加入一個(gè)在localhost(127.0.0.1)的tcp 10025端口(/etc/amavisd.conf的預(yù)設(shè)值)上監(jiān)聽(tīng)的smtp服務(wù): # ========================================================================== # # 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服務(wù)
# 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 ]
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。