| Home Register Memberlist Help Search Quick Links No Replies |
|
#1
|
||||
|
||||
|
Spoofing
What is spoofing? Spoofing is the purposeful use of an email address that is not the sender’s actual email address in the FROM field on an email. Spoofing is non-preventable, meaning that a domain owner cannot stop someone from purposely spoofing the domain or email address. What steps can be taken to address spoofing? Since spoofing cannot be stopped, it is the legitimate sender’s and legitimate receiver’s responsibility to minimize spam. The sender can setup a valid PTR (rDNS), SPF, SenderID, DomainKeys and DKIM records so that outgoing emails verify they are coming from the actual domain or email. The receiver can institute verification checks for incoming emails to look for SPF, Sender ID, DomainKeys and DKIM records as well as using other methods such as sender verify, greylisting and a lame primary MX server. The following guide will detail how to modify various mail DNS zone records for the sending domain to legitimize email sent from your domain. PTR (rDNS) records A PTR record serves to help a receiving server check that the sender server’s response on port 25 matches the DNS record response for the reverse DNS (rDNS) in the zone. You can check the response from any server by doing the following: Code:
telnet domain.com 25 Code:
telnet errorcodex.com 25 Code:
Trying 64.50.166.3... Connected to errorcodex.com. Escape character is '^]'. 220-synthesis.lunaradmin.com ESMTP Exim 4.69 #1 Mon, 23 Nov 2009 18:28:11 -0800 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. Code:
3 IN PTR synthesis.lunaradmin.com. Code:
host 64.50.166.3 Code:
3.166.50.64.in-addr.arpa domain name pointer synthesis.lunaradmin.com. The point of the PTR record is to allow a receiving host to check that a sender server exists and does claim to be the proper sender of the email message. Such a verification check, which is called sender verify, cuts down the likelihood that the sender server is a spam source, since spammers oftentimes do not have legitimate IPs assigned to emails they send, spoofing the IP so that it instead returns to a non-existant or invalid server address. SPF records Sender Policy Framework (SPF) is an attempt to control the sending of forged emails by providing a TXT record in the domain’s DNS zone to indicate which mail servers are allowed to send mail for a set domain. Setting up an SPF record A wizard is available at http://old.openspf.org/wizard.html on setting up an SPF record. Let’s say we have the domain lunaradmin.com and we indicate yes for the A and MX questions and no for the PTR one, then we would input into the ip4 field the following IPs as the domain and server have both IPs used on it: Code:
64.50.164.46 64.50.164.47 Code:
"v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 ~all" Code:
lunaradmin.com. 14400 IN TXT "v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 ~all" Code:
rndc reload lunaradmin.com Code:
dig txt lunaradmin.com +short Code:
"v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 ~all" Code:
=========Summary of Results========= SPF check: pass DomainKeys check: neutral DKIM check: neutral Sender-ID check: pass SpamAssassin check: ham =========Details:========= HELO hostname: synthesis.lunaradmin.com Source IP: 64.50.164.46 mail-from: admin@lunaradmin.com SPF check details: Result: pass ID(s) verified: smtp.mail=admin@lunaradmin.com DNS record(s): lunaradmin.com. 14400 IN TXT "v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 ~all" lunaradmin.com. 14400 IN A 64.50.164.47 lunaradmin.com. 14400 IN MX 0 lunaradmin.com. lunaradmin.com. 14400 IN A 64.50.164.47 This system of verifying senders by the DNS zones is very similar to SPF records and was developed by Microsoft. Using almost the same syntax as the SPF record, this allows a domain to have an SPF record on a domain to pass the SenderID check. The main difference between the two systems is that SPF checks the MAIL FROM envelope value, while SenderID checks the From address header value. Normally, both of these values are the same. If you’ve setup an SPF record already and performed the test to check-auth@verifier.port25.com then you will notice the pass for SenderID as well: Code:
========Summary of Results========= SPF check: pass DomainKeys check: neutral DKIM check: neutral Sender-ID check: pass SpamAssassin check: ham Code:
Sender-ID check details: Result: pass ID(s) verified: header.From=admin@lunaradmin.com DNS record(s): lunaradmin.com. 14400 IN TXT "v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 ~all" lunaradmin.com. 14400 IN A 64.50.164.47 lunaradmin.com. 14400 IN MX 0 lunaradmin.com. lunaradmin.com. 14400 IN A 64.50.164.47 Now that you have a working SPF record, simply go to http://www.microsoft.com/mscorp/safe...d/default.aspx and follow the prompts to get the rest of the SenderID setup. When I did it, I received the following changed record by Microsoft: Code:
"v=spf1 a mx ip4:64.50.164.46 ip4:64.50.164.47 mx:lunaradmin.com -all" https://support.msn.com/eform.aspx?p...eformts&scrx=1 It might take 1-2 days after filling out the form for Microsoft to add your domain to their program. You will receive an email from Microsoft after it has been successfully added. A few parts to note. First of all, if you only have 1 IP on the server, you would not need the ip4:IP ip4:IP portions of the record, so simply having this would normally work: Code:
“v=spf1 a mx ~all” Next, the original SPF record site uses a soft fail (~all) rather than a hard fail (-all) for it. The Microsoft SenderID site switched it to a hard fail (-all). I have no idea why the Microsoft site required mx:lunaradmin.com for the record, but it did in order to get approved into the program without errors. DomainKeys and DKIM DomainKeys was developed by Yahoo as an encryption system to verify the domain sender and message integrity. The system uses public and private keys in a similar fashion to SSL encryption. The protocol was further developed into DKIM (DomainKeys Identified Mail), which is the replacement for DomainKeys. Unfortunately, some servers use the older DomainKeys verification system and some use the newer DKIM system, and the two systems aren’t interchangeable for the most part. You cannot have both DomainKeys and DKIM records either in your DNS. To overcome this hurdle, you can utilize the DKIMProxy program to handle the setup. Download this package at http://downloads.sourceforge.net/dki...oxy-1.2.tar.gz To see the instructions for installing DKIMProxy on a cPanel-based exim server, please review this tutorial. Synopsis Spoofing of a domain and email address is unpreventable, since anyone can use a script or program to pretend to be using any domain or email address. In order to limit the impact such spoofing causes for a domain, the domain owner can add several components to the domain and server. First, a PTR record can be setup that matches the port 25 telnet response for a domain to pass the sender verify check sent by the receiving server. Usually, the zone file for an IP is only editable at the webhost or ISP level, so if you do not have access to the IP zone file itself, please contact the IP provider to get the PTR record edited to the proper entry. Next, an SPF and SenderID TXT record can be created. Microsoft prefers these type of records, since they were involved in the SenderID framework. An SPF or SenderID record basically is a record in the domain’s zone file indicating what domains and IPs are allowed to send through the server for email. Services like msn and hotmail and live.com email recipients are less likely to reject or tag as spam domains with the SPF and SenderID records. For DomainKeys and DKIM records, you can only have one such record on your domain. This record adds a public key in the DNS zone that maps to a private key on the server. The TXT record is checked by a receiving server and the private key is then requested to see if it matches the encryption. If it passes, then emails will be accepted by the receiving server. This method of authentication is preferred by Yahoo, since the original DomainKeys method was developed by them. Gmail also uses DKIM and DomainKeys to pass email senders to the inbox rather than spam box. Setting Up a Receiving Server to Check for SPF and DomainKeys/DKIM As a note, you can also setup a server as a receiving server to check for SPF, DomainKeys and DKIM to minimize spam on your own server. DKIMProxy actually has an inbound check for DomainKeys and DKIM signed emails. A better idea would probably be to simply add the Perl Modules for SpamAssassin and enable those plugins. This is not as straightforward as it might sound since, even on cPanel, you don’t simply use a GUI to enable them. First, you’d need to install the Perl Modules required for the SpamAssassin plugins to work: Code:
/scripts/perlinstaller Mail::SPF /scripts/perlinstaller Mail::SpamAssassin::Plugin::SPF /scripts/perlinstaller Mail::DomainKeys /scripts/perlinstaller Mail::SpamAssassin::Plugin::DomainKeys /scripts/perlinstaller Mail::DKIM /scripts/perlinstaller Mail::SpamAssassin::Plugin::DKIM Code:
cd /etc/mail/spamassassin Code:
loadplugin Mail::SpamAssassin::Plugin::SPF Code:
vi v312.pre Code:
loadplugin Mail::SpamAssassin::Plugin::DKIM Code:
/etc/init.d/exim restart Code:
Sep 13 14:46:47 synthesis spamd[11790]: spamd: result: . 0 - DKIM_SIGNED,DKIM_VERIFIED,HTML_MESSAGE,SPF_PASS scantime=4.0, size=2486,user=admin,uid=510,required_score=5.0,rhost=localhost,raddr=127.0.0.1, rport=58185,mid=<4f1bee20909131446r24f747b9y3ceac9ec453cecfb@mail.gmail.com>, autolearn=ham,shortcircuit=no Sep 13 14:46:47 synthesis dkimproxy.out[21329]: DKIM signing - signed; message-id=<4f1bee20909131446r24f747b9y3ceac9ec453cecfb@mail.gmail.com>, signer=<@lunaradmin.com>, sender=<domain@gmail.com>
__________________
Miraenda ~ Ex uno disce omnes ~ |
|
#2
|
||||
|
||||
|
I actually wanted to update this topic to mention something that I'd recently found out. While it isn't possible to prevent spoofing from another server for the email address in the "From:" field, it is possible to prevent this on your own machine.
The following ACL can be added to exim.conf Code:
acl_check_data:
deny
authenticated = *
condition = ${if or {{ !eqi{$authenticated_id} {$sender_address} }\
{ !eqi{$authenticated_id} {${address:$header_From:}} }\
}\
}
message = Your FROM must be as the account you have authenticated with to deliver
Code:
#!!#######################################################!!# #!!# This new section of the configuration contains ACLs #!!# #!!# (Access Control Lists) derived from the Exim 3 #!!# #!!# policy control options. #!!# #!!#######################################################!!# #!!# These ACLs are crudely constructed from Exim 3 options. #!!# They are almost certainly not optimal. You should study #!!# them and rewrite as necessary. begin acl Please note that the above differs from this option in cPanel > Exim Configuration Editor area: Set the Sender: Header when the mail sender changes the sender (-f flag passed to sendmail). [?] The cPanel option only sets the Sender: Header for an email, which isn't the same as the From: address. Many email clients look at the From: address rather than the Sender: Header for an email, although the full header will show the Sender: Header in it. Basically, the cPanel option only adds additional details to track down who sent the message, but it does not stop someone from changing the From: address. The ACL mentioned initially does prevent this from happening, preventing spoofing being used on your machine. Thanks.
__________________
Miraenda ~ Ex uno disce omnes ~ |
|
#3
|
|||
|
|||
|
Trying on SMPT server and while sending out emails ... emails aren't being sent by system so i just setup a error log while which is showing me only info about emails sent or not but not what exactly is wrong i am using PHP 5+
__________________
VMWare |
|
#4
|
||||
|
||||
|
You haven't provided enough details for me to know what might be wrong. Try to send an email using:
exim -odf -d mail@domain.com (replace mail@domain.com with the email you are trying to send out to) Test. . Then see what it shows when it tries to send. Provide the output from "exigrep mail@domain.com /var/log/exim_mainlog" command with mail@domain.com as the actual email you sent out to for us to see the error. Also, I'm not certain what PHP 5 would have to do with mail, since the PHP version doesn't impact exim.
__________________
Miraenda ~ Ex uno disce omnes ~ |
|
#5
|
|||
|
|||
|
For the sake of more helpful information for the public please allow me to add a few comments on this post.
Quote:
All the other details are correct and very useful for interested users. Find more information about setting up, references and testing in this article: "Postfix with DKIM, Domainkeys, SPf and Sender-ID" at http://www.tai.ro/2010/04/03/postfix...and-sender-id/ Cheers Alex |
|
#6
|
||||
|
||||
|
I would presume you haven't setup dkimproxy properly in the past as it can be used for multiple domains.
__________________
Miraenda ~ Ex uno disce omnes ~ |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. |
||