I’ve been following the news on Daring Fireball about Omniture’s sneaky use of the 192.168.112.2o7.net domain name in phone-home functionality used by iTunes, Adobe CS3 apps and (presumably) others.
Mitcho.com notes that you can opt out of 2o7.net tracking, but only by setting a browser cookie, which won’t have any effect within apps such as iTunes and Photoshop CS3. That site suggests a third-party solution for preventing apps from connecting to Omniture’s servers. But there is a simpler (and free!) way, at least on OS X.
Like most Unix and Unix-like OSs, Mac OS X has a file that maps domain names to IP addresses, /etc/hosts. The OS looks in this file first when it needs to translate a domain name, before hitting your DNS server – so you can consider it a very crude highest-priority local DNS server. /etc/hosts is dead handy for assigning simple names to machines on your local network with static IP addresses. Mine currently looks like this:
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 10.0.0.11 imac 10.0.0.5 penguin 10.0.0.1 router
The format is simple:
<ip address> <domain_name> [<domain name> ...]
The essence of this trick is: we’re going to add a new domain name (192.168.112.2o7.net) that points to the localhost entry.
How to edit the hosts file is outside the scope of this article, but typically you’ll need to open a Terminal window and type:
$ sudo editor /etc/hosts
where editor is your text editor of choice. If you’ve never used a command-line text editor before and want something easy, use pico (sudo pico /etc/hosts). If you have TextMate and the mate shell command installed you can use that (sudo mate /etc/hosts). You should probably make a backup of /etc/hosts before you edit it, just in case – you can do that with:
$ sudo cp /etc/hosts /etc/hosts.backup
So I’ve changed my /etc/hosts file to resolve the domain name 192.168.112.2o7.net to 127.0.0.1 – the localhost “loopback” address, which always points to the local machine:
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 192.168.112.2o7.net 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 10.0.0.11 imac 10.0.0.5 penguin 10.0.0.1 router
Now when an app tries to phone home to 192.168.112.2o7.net, it’ll be connecting to the local host instead of Omniture’s server. This will typically result in an error response, which the app should silently ignore.
To confirm that the redirection works as expected, I saved my changes to /etc/hosts, opened a new Terminal window and used traceroute:
$ traceroute 192.168.112.2o7.net traceroute to localhost (127.0.0.1), 64 hops max, 40 byte packets 1 localhost (127.0.0.1) 0.387 ms 0.039 ms 0.032 ms
Problem solved!