implementing-dmarc-dkim-spf-email-security

Configures SPF, DKIM, and DMARC DNS records to prevent email domain spoofing.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill implementing-dmarc-dkim-spf-email-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implementing-dmarc-dkim-spf-email-security
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/phishing-defense/implementing-dmarc-dkim-spf-email-security
Command: npx skills add https://github.com/xalgord/xalgorix --skill implementing-dmarc-dkim-spf-email-security

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Organizations without proper email authentication are vulnerable to domain spoofing and phishing attacks that impersonate their domain. This Skill guides the implementation of SPF, DKIM, and DMARC so receiving mail servers can verify legitimate senders and reject forged messages.

Core Features & Use Cases

  • SPF Configuration: Publishes DNS TXT records listing authorized sending IPs, with guidance on avoiding the 10-lookup limit and permissive mechanisms like +all.
  • DKIM Key Setup: Generates 2048-bit RSA key pairs with OpenSSL and formats public keys for DNS publication under a unique selector.
  • Phased DMARC Rollout: Moves policy from p=none monitoring through quarantine to full reject, with aggregate and forensic reporting addresses.
  • Use Case: A security engineer hardens a corporate domain against phishing by auditing existing records, deploying all three protocols, and validating that a controlled spoof attempt gets rejected while legitimate mail shows dmarc=pass.

Quick Start

Audit the current SPF, DKIM, and DMARC records for my domain and generate the DNS records needed to reach a DMARC reject policy.

Frequently Asked Questions about implementing-dmarc-dkim-spf-email-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up DMARC, DKIM, and SPF for my domain?

Start by auditing existing records with dig TXT queries, then publish an SPF record listing authorized senders ending in -all, generate a 2048-bit DKIM key pair with OpenSSL and publish the public key in DNS, and finally add a DMARC record at _dmarc.example.com beginning with p=none for monitoring.

What is the correct order to deploy SPF, DKIM, and DMARC?

Deploy SPF first to authorize sending IPs, then DKIM to cryptographically sign outgoing mail, and finally DMARC which builds on both. DMARC should start at p=none for monitoring, progress to quarantine, and end at reject once legitimate sources align.

Why does DMARC fail even when SPF and DKIM pass?

DMARC fails when the authenticated domain does not align with the From header domain, even if SPF or DKIM individually pass. Verify the adkim and aspf alignment settings rather than just checking pass/fail results in the Authentication-Results header.

Why does my SPF record cause a permerror?

SPF permerror occurs when the record exceeds 10 DNS lookups, typically from too many include mechanisms. Flatten includes where possible, inventory all legitimate sending sources, and end the record with -all for a hard fail.

What DKIM key size should I use?

Use 2048-bit RSA keys for DKIM, as 1024-bit or shorter keys are deprecated. Assign a unique selector per sending service and rotate keys annually to maintain security.

How do I protect subdomains from email spoofing?

Add the sp=reject tag to your DMARC record to apply the policy to subdomains. Without it, attackers can spoof addresses like noreply.example.com even when the organizational domain is locked down with p=reject.