Engineering & Infrastructure

Rolling out the fix for unwanted popups to billing counter computers across Multiple Stores With MITM-DNS

7-minute read • homemadesoftware.net

The hosts-file fix in our last post worked well for the one shop we built it for. Then the customer asked for the same protection across every laptop, in every one of their stores. That's when a one-line hosts-file edit stopped being a solution and started being a chore.

Why hosts-file edits don't scale

Editing /etc/hosts is a five-minute job on one machine. Across a growing fleet of laptops spread over multiple stores, it turns into an ongoing liability:

What we needed instead was one place to make the change that every device, in every store, would automatically respect.

mitm-dns: a DNS server we control

We already run mitm-dns, a lightweight DNS server we built for exactly this kind of override. It's a custom resolver driven by a single JSON config file: it answers the domains we've explicitly listed, and forwards everything else upstream to normal public DNS resolvers so regular browsing is unaffected.

Point a device at it as its DNS server and it behaves like any other DNS server, except for the handful of domains we've told it to override.

Pointing the popup domain to a dead IP

Instead of editing a hosts file on each machine, we added one entry to the DNS server's config, once:

{ "version": "1.0.0", "forward_to": ["1.1.1.1", "8.8.8.8"], "domains": { "salesdomain.com": { "records": [ { "name": "feedback", "type": "A", "value": "0.0.0.0", "ttl": 300 } ] } } }

This tells the server that any request for feedback.salesdomain.com should resolve to 0.0.0.0, a non-routable address that fails instantly, instead of the vendor's real server. Every other domain on the internet is still forwarded normally through forward_to. The server picks the change up automatically, no restart needed.

Wiring it into the network

The config change was the easy part. The bigger win was getting every device to use this server without touching them one by one:

🌐 At the router

We updated each store's router so it hands out our DNS server's address as part of normal DHCP, instead of the ISP's default. Any device that joins the store network — laptops, tablets, POS terminals — picks it up automatically. Nothing to install.

💻 On individual laptops

For laptops that leave the store network (taken home, used on mobile data), we set the DNS server manually in the OS network settings so the block travels with the device wherever it connects.

DNS resolution, before and after

Querying the popup's domain against the vendor's real DNS still resolves normally:

$ dig feedback.salesdomain.com ;; ANSWER SECTION: feedback.salesdomain.com. 300 IN A 198.51.100.42

But once a device is using our DNS server, the exact same lookup resolves differently:

$ dig @203.0.113.10 feedback.salesdomain.com ;; ANSWER SECTION: feedback.salesdomain.com. 300 IN A 0.0.0.0

Same domain, same device — different answer, because the DNS server it's asking has been told to override this one name and forward everything else honestly.

Why this is the better long-term fix

Takeaway: A fix that works on one machine doesn't automatically work on a fleet. When the same override needs to apply everywhere, push it to the network layer every device already shares — DNS — instead of repeating the fix on every machine by hand.

Did this help you?

We investigated this and fixed it for our customer. If it you have a similar issue our mitm-dns solution would be excellent solution for this. If you have a software problem you would like us to look at, we would love to hear from you.

Follow us to know more about the exciting products we build: