DMARC was published in 2012 to build upon the SPF and DKIM email conventions for authorizing senders. It allows specification of policies and provides for reporting of actions performed under those policies.
DNS Entry Resembles:
_dmarc.example.com TXT v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=0; adkim=r; aspf=r; pct=100; rf=afrf; ri=86400; sp=none
Simple verification…. send an email to this address and you will receive a response with your SPF, DKIM and DMARC compliance status:
DomainKeys (originally from Yahoo!) and Cisco, and later as an industry collaboration, is a means for and organization to claim responsibility for sending a message, in a way that can be validated by a recipient. As a result, emails are “signed” by the outgoing SMTP server and can be verified against a DNS record. Depending upon the receiver, unsigned emails MAY be treated or marked as SPAM as they could be forgeries.
The below instructions assume Ubuntu (Debian) and Postfix, but could likely be modified for other platforms.
This is a simple mechanism, using DNS to certify that email from your domain comes from authorized servers. This is accomplished by adding a DNS record to identify the servers from which you send legitimate email. Emails sent from other servers MAY then be assumed as forged (SPAM) and blocked by the receiving email server.
NOTE: This can be easily spoofed, as such it should be a portion of your email security strategy, look into DKIM and DMARC too!
One thing that I initially did not understand… if you are supporting IPv6 and IPv4, you should merge your records onto a single DNS TXT entry:
example.com TXT v=spf1 a mx ip4:xxx.xxx.xxx.xxx ip6:xxxx:x:xxx:xxxx:xxx:xxxx:xxxx:xxx -all
In these examples, I have used the OpenDNS servers, please change as appropriate.
sudo vi /etc/network/interfaces
auto l0 eth0
iface lo inet loopback
iface eth0 inet static
dns-nameservers 184.108.40.206 220.127.116.11
sudo vi /etc/resolv.conf
NOTE: I’m not 100% sure if this is required!
Add appropriate content, example:
sudo restart networking
sudo ifdown eth0 && ifup eth0
Working on a Windows machine without elevated permissions can often be difficult for developers. One item that is often useful to change is the ‘hosts’ file. IN Windows 7 and 8 you can often ‘Self-Elevate’ to run a file, but it’s not always obvious how to edit a file in this manner. Some simple batch files can be helpful in this case as you can elevate them to do the actual work requiring permissions.
For example to make all requests to ‘example.com’ to be directed to your own machine…
echo 127.0.0.1 www.example.com >> %hostspath%
echo 127.0.0.1 example.com >> %hostspath%
To replace the existing hosts file with one of your chosing from your desktop. (NOTE: you can change this file or path to anything).
copy "%UserProfile%\Desktop\hosts" "c:\Windows\System32\drivers\etc"
A standard ‘hosts’ file in Windows appears as such:
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 18.104.22.168 rhino.acme.com # source server
# 22.214.171.124 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
DNS is much like a phone book for the internet. For each domain name (or subdomain like ‘www’), there is an IP address that resembles a phone number. Getting the matching number for each domain can take some time and make your site appear slow, particularly on mobile connections. Fortunately, you can pre-request this information and speed up your site in most cases.
To enable a domains DNS lookup to be performed in advance of the request, you can add a single line to the
<head> section of your page.
<link rel="dns-prefetch" href="//giantgeek.com" />
If you want to explicitly turn on (or off) this behavior, you can add one of the following, or their HTTP Header equivalents:
<meta http-equiv="x-dns-prefetch-control" content="on" />
<meta http-equiv="x-dns-prefetch-control" content="off" />
This is supported in all modern browsers:
- Firefox 3.5+
- Safari 5.0+
- MSIE 9.0+
If should be noted that a similar method can be used to prefetch as page, but I will save that for a different article:
<link rel="prefetch" href="http://www.skotfred.com/" />
If you take a close look at your logs you may occasionally see requests for a file named
wpad.dat. This file is related to automatic proxy configuration in many browsers.
To provide this capability to your users and website,
Default behavior is to traverse the domain in reverse, looking for one with a file named
Example (using my domain for example):
- Then in httpd.conf, set the MIME type:
AddType application/x-ns-proxy-autoconfig .pac
- Also in httpd.conf, add a redirect to the actual file you wish to use.
Redirect permanent /wpad.dat http://www.giantgeek.com/proxy.pac
- In the new file, add the following default contents, modify if you use a proxy:
/* 'proxy.pac' - This is the main function called by any browser
NOTE: there is NO proxy!
function FindProxyForURL(url, host)
} // End function FindProxyForUrl
This is a concept I had forgotten about until recently, it can often serve as a simple means of code obfuscation and is also sometimes referred to as “Decimal Address”.
- DNS is used to convert a URL/domain name into an IP address that is used to contact the remote machine.
localhost = 127.0.0.7
giantgeek.com = 126.96.36.199
- IP addresses (as IPv4) are represented as groups of 4 hexadecimal or decimal octets.
- Those numbers can be plugged into a simple formula to be represented as a single large integer.
As such, you can use the following as equivalents:
Since I’ve run a few small websites (like this one) out of my home for years, I’ve found it useful to run a DNS server inside of my firewall. Not only does this make it easier to maintain the websites, but it allows me to lock down security and increase performance of many of my applications.
I run a the following services that use DNS:
- Apache JAMES – mail server that does lookups to send email and filter inbound SPAM.
- Analog – web server log analysis.
- Apache HTTPD – web server, used to host websites, private domains used for internal purposes.
To make things more efficient, I currently have my DNS setup to forward all requests to OpenDNS, allowing for ‘adult’ website filters and analysis of DNS activity.
Some open-source/free DNS servers that I recommend:
I’ve used EveryDNS (free service) for years to host my DNS services. Recently I found that they now offer public DNS service for lookups as OpenDNS. While I still run my own private DNS server for caching and various private addresses. I now do a simple forward lookup to their servers to gain the extra services they provide… notably Phishing and typo protection.
Setup is very simple for most users, and even a non-technical person should have no problems following their installation instructions for a single computer/device or an entire network.