PISA Pakistan — Community CERT

← ⚙️ Cyber Security Fundamentals

39. Email Authentication: DMARC, DKIM, SPF Implementation for Pakistani Organizations

⏱ 7 min

Email Authentication: DMARC, DKIM, SPF Implementation for Pakistani Organizations

Email Threat Landscape in Pakistan

Phishing emails impersonating banks (Habib Bank, MCB) and e‑wallets (easypaisa, JazzCash) circulate via WhatsApp forwards and fake OTP pages. The NCCIA 1799 helpline regularly receives reports of Business Email Compromise (BEC) that start with spoofed sender domains.

Understanding SPF, DKIM, DMARC

  • SPF (Sender Policy Framework): DNS TXT record listing IPs authorized to send mail for your domain.
  • DKIM (DomainKeys Identified Mail): Cryptographic signature added to email headers, verified against a public key in DNS.
  • DMARC (Domain‑based Message Authentication, Reporting & Conformance): Policy that tells receivers what to do if SPF/DKIM fail, and provides aggregate reports.

Step‑by‑Step DNS Configuration

  1. Publish SPF
    v=spf1 ip4:203.0.113.0/24 include:_spf.google.com ~all
    
    Replace 203.0.113.0/24 with your mail server IPs.
  2. Generate DKIM key pair (e.g., using OpenDKIM):
    opendkim-genkey -s mail -d example.pk
    
    Add the TXT record _mail._domainkey.example.pk with the public key.
  3. Set DKIM selector in your mail server (Postfix, Exchange) and sign outgoing mail.
  4. Create DMARC record
    v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.pk; pct=100
    
    Start with p=quarantine, then move to p=reject once you have no legitimate failures.
  5. Monitor DMARC reports (daily) for alignment failures and spoofing attempts.

Monitoring DMARC Reports and Adjusting Policy

  • Use a DMARC analyzer tool (e.g., dmarcian) to parse rua reports.
  • If legitimate bulk mail (marketing, transactional) fails alignment, update SPF/DKIM for those services.
  • Block p=reject for domains with no legitimate email until you have full coverage.

Integrating with SBP Consumer Guidelines

The State Bank of Pakistan’s consumer protection directives require banks to protect customers from phishing. Properly configured DMARC reduces spoofed emails that target easypaisa users, aligning your organization with SBP expectations.

Do / Don't

  • Do test configuration with mail-tester.com before going live.
  • Don’t set p=reject without first reviewing DMARC reports; you may block valid mail.
  • Do publish a DMARC policy on all subsidiary domains (e.g., sub.example.pk).
  • Don’t use ~all softfail forever; it does not prevent spoofing.

Takeaway

Today, add an SPF record for your primary mail domain and create a DKIM key pair. Even if you can’t finalize DMARC yet, publishing SPF will immediately reduce the number of forged emails that appear to come from your organization.

← PrevNext →