Every time a phishing attack makes the news, the conversation collapses into the same tired take: "users just need better training." That framing is wrong, and it lets the real culprits off the hook. Phishing is a structural problem rooted in how domains are trusted, displayed, and verified. If you run self-hosted services, understanding those fundamentals is not optional. It is the difference between a hardened stack and one that hands attackers a free ride.
💡 Why This Matters for Self-Hosters
When you expose a service to the internet, you inherit every weakness in the domain trust model. An attacker does not need to break your app. They can register a lookalike domain, spin up a clone of your login page, and let confused users hand over credentials. Your Vaultwarden, Nextcloud, or Gitea instance can be perfectly patched and still lose users to a domain that looks like yours at a glance.
The browser URL bar is the one signal users are told to trust, and it is surprisingly easy to abuse. Homograph attacks, subdomain tricks, and lookalike TLDs all exploit the gap between "looks legit" and "is legit." Technical defenses on your domain close that gap more reliably than any awareness poster.
🧰 Prerequisites
- A domain you control with access to DNS records
- At least one self-hosted service exposed over HTTPS
- Access to your registrar's management panel
- Basic familiarity with DNS record types (A, TXT, MX, CNAME)
🏗️ Step 1: Lock Down Your Registrar Account First
Domain hijacking is the most direct phishing enabler. An attacker who controls your registrar account controls your DNS, which means they control where your domain points. Before anything else, treat your registrar login as a critical asset.
- Enable TOTP-based two-factor authentication on your registrar account. Avoid SMS 2FA if your registrar supports an authenticator app.
- Enable registrar lock (sometimes called "domain lock" or "transfer lock") to prevent unauthorized transfers away from your current registrar.
- Use a dedicated email address for your registrar account, not one hosted on the same domain you are trying to protect.
Registrar lock is a single checkbox that blocks most automated transfer attacks. There is no reason not to enable it.
📬 Step 2: Deploy Email Authentication Records
A huge percentage of phishing uses spoofed sender addresses. Publishing SPF, DKIM, and DMARC records tells receiving mail servers what to do with mail that claims to come from your domain. Without them, anyone can send email that appears to be from you@yourdomain.com.
SPF specifies which servers are allowed to send mail for your domain. Add a TXT record to your DNS zone:
@ TXT "v=spf1 include:[your-mail-provider] -all" Replace [your-mail-provider] with the include value from your mail provider's documentation. The -all at the end is a hard fail: it tells receivers that any server not listed is not authorized to send for your domain. Whether that mail is actually rejected is up to the receiving server's policy, which is where DMARC comes in. Publish only one SPF record per domain, and stay within SPF's limit of 10 DNS lookups, because every include counts toward it. Consult your provider's docs for the exact include string.
DKIM adds a cryptographic signature to outgoing mail. Your mail provider generates the key pair and gives you a TXT record to publish. The record name looks like:
[selector]._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=[public-key]" The selector name and public key value come from your mail provider. Copy them exactly.
DMARC tells receivers what to do when a message fails both the SPF and DKIM alignment checks, and where to send aggregate reports that show which servers are sending mail as your domain. Start in monitor mode, then tighten the policy once you are confident your legitimate mail passes:
_dmarc.yourdomain.com TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com" When reports show only your expected mail sources passing, move to p=quarantine and eventually p=reject. Reject is the goal. It means spoofed mail from your domain gets dropped outright.
🔒 Step 3: Enable DNSSEC
DNSSEC adds cryptographic signatures to your DNS responses. Without it, an attacker positioned between a resolver and your DNS zone can return forged records, redirecting your domain to a server they control without touching your registrar account. This is DNS spoofing or cache poisoning. DNSSEC lets validating resolvers detect those forged answers and refuse them, although it does not encrypt DNS and only protects users whose resolver actually validates.
Enabling DNSSEC is a two-part process: your DNS provider signs your zone, and you publish a DS record at your registrar to chain the trust. Most major DNS providers (Cloudflare, Route 53, and others) have a one-click or simple toggle to enable signing. Your registrar then needs the DS record to complete the chain. Check both your DNS provider and registrar docs for the exact steps, because the UI differs across platforms.
One caveat: if your DNS provider and registrar are different services, make sure both support DNSSEC before enabling it. A broken DNSSEC chain is worse than no DNSSEC.
🌐 Step 4: Use HTTPS Everywhere and Consider HSTS Preloading
HTTPS with a valid certificate is table stakes at this point. But you can go further with HTTP Strict Transport Security. Once a browser has seen the HSTS header, it will always connect to your domain over HTTPS for the max-age period, even if a user types just the hostname.
Add this header to your reverse proxy or web server config:
Strict-Transport-Security: max-age=31536000; includeSubDomains If you are confident all subdomains are HTTPS-only, you can submit your domain to the HSTS preload list at hstspreload.org. To qualify, the header on your base domain must also include the preload directive, for example Strict-Transport-Security: max-age=63072000; includeSubDomains; preload, with a max-age of at least 31536000, and plain HTTP must redirect to HTTPS. Preloaded domains are hardcoded into browsers as HTTPS-only, so there is no initial plain HTTP request an attacker could intercept and redirect. Treat it as a long-term commitment: removal is possible but slow, so only submit when you are sure every subdomain, including internal-only homelab ones, serves HTTPS.
🛡️ Step 5: Monitor for Lookalike Domains
You cannot control what domains other people register, but you can watch for ones that target yours. Certificate Transparency logs are public, and publicly trusted TLS certificates are logged there, since major browsers require it. Tools like crt.sh let you search for certificates issued to domains similar to yours.
For ongoing monitoring, tools like dnstwist (open source, installable with pip install dnstwist[full] or runnable as the elceef/dnstwist Docker image, with a hosted version at dnstwist.it) generate permutations of your domain name and check which ones are in use. Running it periodically against your domain surfaces lookalikes before your users encounter them. If you find one that is clearly impersonating your service, most registrars and hosting providers have abuse reporting processes.
🔧 Troubleshooting
- DMARC reports show legitimate mail failing SPF: You likely have a sending source not listed in your SPF record. Add the missing include before tightening the DMARC policy.
- DNSSEC validation failures: Usually a mismatch between the DS record at the registrar and the signing keys at the DNS provider. Regenerate the DS record from your DNS provider and re-enter it at your registrar.
- HSTS locking you out of a subdomain: If a subdomain stops serving HTTPS, the
includeSubDomainsdirective will block browser access entirely. Always have HTTPS working on all subdomains before setting that flag. - Mail going to spam after adding DMARC: Monitor-mode DMARC (
p=none) should not affect delivery. Check your SPF and DKIM setup with a tool like MXToolbox to confirm both are passing.
✅ Wrap Up
Phishing is not a user education problem waiting for a training solution. It is a trust infrastructure problem, and the controls exist to address it at the technical layer. For self-hosted services, the stack is straightforward: lock your registrar account, publish SPF, DKIM, and DMARC, enable DNSSEC, enforce HTTPS with HSTS, and monitor for lookalike domains.
None of these steps are exotic. Most take under an hour to implement. They will not stop every attack, but they close the easiest and most commonly abused vectors attackers use against domains exactly like yours. Start with registrar lock and DMARC in monitor mode today, then work through the rest of the list.
Related from the lab
- DNS Showdown: Testing a Brand-New Phishing Domain Against Quad9, NextDNS, and Control D
- You Should Self-Host Your Email (Yes, Even in 2026)
- The Design of Everyday Cryptography: A Homelab Primer
Originally published at codewithromi.com.



