J'ai installé postfix-policyd-spf-python
et configuré l'intégration de postfix
selon la documentation.
Voici mon fichier de configuration policyd-spf.conf
:
debugLevel = 1
TestOnly = 0
HELO_reject = SPF_Not_Pass
Mail_From_reject = Fail
PermError_reject = False
TempError_Defer = False
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1
Les e-mails entrants des serveurs de messagerie étrangers sont vérifiés et signalés correctement. Mais quand je vérifie la protection contre les tentatives d'hameçonnage, les e-mails passent étrangement :
$ telnet mail.example.com 25
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
helo asd.somedomain.com
250 mail.example.com
mail from: me@example.com
250 2.1.0 Ok
rcpt to: test@example.com
250 2.1.5 Ok
data
354 End data with .
from: "ME"
to: "test"
subject: test
asdasd klajsdlaksjd
merci!
.
250 2.0.0 Ok: queued as 8C9EC1260E1
À mon avis, cet e-mail NE devrait PAS être livré.
Voici la sortie de débogage de postfix-policyd-spf-python
:
policyd-spf[34414]: Found the end of entry
policyd-spf[34414]: Config: {'debugLevel': 5, 'HELO_reject': 'SPF_Not_Pass', 'Mail_From_reject': 'Fail', 'PermError_reject': 'False', 'TempError_Defer': 'False', 'skip_addresses': '127.0.0.0/8,::ffff:127.0.0.0/104,::1', 'TestOnly': 0, 'SPF_Enhanced_Status_Codes': 'Yes', 'Header_Type': 'SPF', 'Hide_Receiver': 'Yes', 'Authserv_Id': 'mail.example.com', 'Lookup_Time': 20, 'Whitelist_Lookup_Time': 10, 'Void_Limit': 2, 'Reason_Message': 'Message {rejectdefer} due to: {spf}. Please see {url}', 'No_Mail': False, 'Mock': False}
policyd-spf[34414]: Cached data for this instance: []
policyd-spf[34414]: skip_addresses enabled.
policyd-spf[34414]: _get_resultcodes: scope: helo, Reject_Not_Pass_Domains: None, helo_policy: SPF_Not_Pass, mfrom_policy: Fail
policyd-spf[34414]: Scope helo unused results: ['Pass', 'None', 'Temperror', 'Permerror']
policyd-spf[34414]: helo policy true results: actions: {'defer': [], 'reject': ['Fail', 'Softfail', 'Neutral'], 'prepend': ['Pass', 'None', 'Temperror', 'Permerror']} local {'local_helo': False, 'local_mfrom': False}
policyd-spf[34414]: spfcheck: pyspf result: "['None', '', 'helo']"
policyd-spf[34414]: None; identity=no SPF record; client-ip=xx.xx.xx.xx; helo=asd.somedomain.com; envelope-from=me@example.com; receiver=
policyd-spf[34414]: _get_resultcodes: scope: mfrom, Reject_Not_Pass_Domains: None, helo_policy: SPF_Not_Pass, mfrom_policy: Fail
policyd-spf[34414]: Scope mfrom unused results: ['Pass', 'None', 'Neutral', 'Softfail', 'Temperror', 'Permerror']
policyd-spf[34414]: mfrom policy true results: actions: {'defer': [], 'reject': ['Fail'], 'prepend': ['Pass', 'None', 'Neutral', 'Softfail', 'Temperror', 'Permerror']} local {'local_helo': False, 'local_mfrom': False}
policyd-spf[34414]: spfcheck: pyspf result: "['Fail', 'SPF fail - not authorized', 'mailfrom']"
policyd-spf[34414]: Fail; identity=mailfrom; client-ip=xx.xx.xx.xx; helo=asd.somedomain.com; envelope-from=me@example.com; receiver=
policyd-spf[34414]: Action: None: Text: None Reject action: 550 5.7.23
Comme nous pouvons le voir à partir des fichiers journaux, la vérification SPF retourne:
spfcheck: pyspf result: "['Fail', 'SPF fail - not authorized', 'mailfrom']"
cependant, la dernière ligne indique:
Action: None: Text: None Reject action: 550 5.7.23
Pourquoi cela? Pourquoi l'Action: None
? À mon avis, l'e-mail devrait être rejeté et non accepté par le serveur. Que fais-je de mal?