茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1669425 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_0231.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2012/11/20 7:14:01
引言:

請教學長們

最近有一個domain name 一直發一大堆mail ,都是一些spam 或virus
我想利用 /etc/postfix/access 把這個doman name REJECT, 但是一
直不成功,以下是我的設定方式,請教一下有錯嗎 ?

# vi /etc/postfix/main.cf
mynetworks = 127.0.0.0/8, hash:/etc/postfix/access (加入了這一行)

然後在
#vi /etc/postfix/access 加入 要和不要 relay 的domain 例如

localhost.localdomain______RELAY
localhost________________RELAY
127.0.0.1________________RELAY

yahoo.com.tw____________REJECT(例如要REJECT yahoo的郵件)
msn.com ________________REJECT

然後 建立 /etc/postfix/access.db 這個資料庫
#postmap hash:/etc/postfix/access

不知道這樣做是那裡有錯誤,因為yahoo被我REJECT 了,但還是可以寄信進來也可以寄信過去, , 請問一下要禁止某一domain 的relay,這樣做是錯在那裡呢, 謝謝回覆





您是完全使用 sendmail style 的架構來看 postfix 的,這當然完全無效。
要談防 spam 或者是阻擋連線/寄信,需要先了解這些東西:
1. 連線端 ip 來源
2. smtp 溝通時使用的 sender
3. smtp 溝通時使用的 recipient
4. mail header 內容

而我個人設定像是:
smtpd_recipient_restrictions =
        reject_non_fqdn_sender
        reject_non_fqdn_recipient
        reject_unknown_sender_domain
        reject_unknown_recipient_domain
        reject_unlisted_sender
        permit_mynetworks
        permit_sasl_authenticated
        reject_rbl_client dnsbl.sorbs.net
        reject_rbl_client bl.spamcop.net
        reject_rbl_client relays.ordb.org
        reject_rbl_client xbl.spamhaus.org
        check_recipient_access regexp:/etc/postfix/rcpt_checks
        check_client_access regexp:/etc/postfix/client_checks
        check_helo_access regexp:/etc/postfix/helo_checks
        check_sender_access regexp:/etc/postfix/sender_checks
        reject_unauth_destination

其中像是 client_checks 檔案:
/192\.168\.2\.1/             REJECT


請先閱讀:
http://www.postfix.org/SMTPD_ACCESS_README.html
http://www.postfix.org/postconf.5.html




感謝 kenduest , 這邊文章實在是惠我良多,我看了很多遍。
瞭解其順序還有每個環節的重要

不知是否可以分享一下 裡面幾個 checks 檔的用法
        check_recipient_access regexp:/etc/postfix/rcpt_checks
        check_client_access regexp:/etc/postfix/client_checks
        check_helo_access regexp:/etc/postfix/helo_checks
        check_sender_access regexp:/etc/postfix/sender_checks

我分享一下我找到一個不錯的 helo_checks, 作者是 Ralf Hildebrandt (http://www.postfix-book.com/)
他把用本機或是自己的 domain name 及數字的 helo/ehlo 檔掉了 效果真的不錯
/^localhost$/ 550 Don't use my own domain (localhost)
/^charite\.de$/ 550 Don't use my own domain
/^160\.45\.207\.131$/ 550 Don't use my own IP address
/^mail\.charite\.de$/ 550 Don't use my own hostname
/^141\.42\./ 550 Don't use an IP address from my network
/^\[160\.45\.207\.131\]$/ 550 Don't use my own IP address in brackets
/^\[141\.42\./ 550 Don't use an IP address from my network
/^[0-9.]+$/ 550 Your software is not RFC 2821 compliant: EHLO/HELO must be a domain or an address-literal (IP enclosed in []) - not a naked IP.




原文出處:關於postfix access 的設定,無效
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|