
Implementing DMARC DKIM SPF Email Security
FreeStrengthen your email security against phishing and spoofing.
Free · Opens the source repo
What Implementing DMARC DKIM SPF Email Security does
Implementing DMARC, DKIM, and SPF Email Security is crucial for organizations looking to enhance their email authentication mechanisms. This skill provides a comprehensive approach to configuring these three vital protocols, which work together to prevent domain spoofing and ensure message integrity. By implementing these standards, you can significantly reduce the risk of phishing attacks that exploit your organization's domain.
The skill guides users through the process of auditing existing DNS records and implementing the necessary SPF, DKIM, and DMARC records. SPF allows you to specify which mail servers are permitted to send emails on behalf of your domain, while DKIM adds a cryptographic signature to your outgoing emails, ensuring that they have not been altered during transmission. DMARC builds on these protocols by providing a policy framework for handling unauthenticated emails, allowing you to define how to treat messages that fail authentication checks.
This skill is ideal for IT professionals, system administrators, and security engineers who are responsible for email security within their organizations. It requires access to DNS management and email server configurations, making it suitable for those with a basic understanding of DNS TXT records and email server setups. By following the provided workflows, users can effectively implement and monitor these email security measures, thereby enhancing their organization's overall security posture against email-based threats.
In addition to the implementation steps, the skill includes tools and resources for monitoring and analyzing DMARC reports, helping users identify unauthorized senders and potential spoofing attempts. This proactive approach to email security is essential for maintaining trust and integrity in your organization's communications.
When to use it
Use this skill when deploying email authentication protocols or assessing your domain's email security posture.
When not to use it
This skill is not suitable for environments without DNS management access or those unfamiliar with email server configurations.
What you can build with it
Setting Up Email Authentication
Use this skill to configure SPF, DKIM, and DMARC records for your organization's domain to enhance email security.
Conducting Security Assessments
Leverage this skill during security assessments to evaluate and improve your domain's email security posture.
Compliance Alignment
Implement this skill to align your email security practices with industry compliance requirements.
How to install Implementing DMARC DKIM SPF Email Security
View source1. Install with the skills CLI
npx skills add mukul975/anthropic-cybersecurity-skills/implementing-dmarc-dkim-spf-email-security --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mukul975Implementing DMARC, DKIM, and SPF Email Security
Overview
SPF, DKIM, and DMARC form the three pillars of email authentication. Together they prevent domain spoofing, validate message integrity, and define policies for handling unauthenticated mail. Proper implementation drastically reduces phishing attacks that impersonate your organization's domain.
When to Use
- When deploying or configuring implementing dmarc dkim spf email security capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- DNS management access for your domain
- Access to email server/MTA configuration (Postfix, Exchange, Google Workspace, Microsoft 365)
- Basic understanding of DNS TXT records
- Python 3.8+ for validation scripts
Key Concepts
SPF (Sender Policy Framework)
Publishes a DNS TXT record listing authorized IP addresses and mail servers that can send email on behalf of your domain. Receiving servers check the envelope sender's IP against this list.
DKIM (DomainKeys Identified Mail)
Adds a cryptographic signature to outgoing emails using a private key. The corresponding public key is published in DNS. Receivers verify the signature to ensure the message was not altered in transit.
DMARC (Domain-based Message Authentication, Reporting and Conformance)
Builds on SPF and DKIM by specifying a policy (none/quarantine/reject) for messages that fail authentication, and provides a reporting mechanism to monitor spoofing attempts.
Workflow
Step 1: Audit Current State
# Check existing SPF record
dig TXT example.com | grep spf
# Check existing DKIM selector
dig TXT selector1._domainkey.example.com
# Check existing DMARC record
dig TXT _dmarc.example.com
Step 2: Implement SPF
# DNS TXT record for example.com
v=spf1 ip4:203.0.113.0/24 include:_spf.google.com include:spf.protection.outlook.com -all
Key SPF mechanisms:
ip4:/ip6:- Authorize specific IP rangesinclude:- Include another domain's SPF recorda- Authorize domain's A record IPsmx- Authorize domain's MX record IPs-all- Hard fail all others (recommended)~all- Soft fail (monitoring phase)
Step 3: Implement DKIM
# Generate DKIM key pair (2048-bit RSA)
openssl genrsa -out dkim_private.pem 2048
openssl rsa -in dkim_private.pem -pubout -out dkim_public.pem
# Format public key for DNS (remove headers, join lines)
grep -v "PUBLIC KEY" dkim_public.pem | tr -d '\n'
DNS TXT record at selector1._domainkey.example.com:
v=DKIM1; k=rsa; p=MIIBIjANBgkqhki...
Step 4: Implement DMARC
# DNS TXT record at _dmarc.example.com
# Phase 1 (Monitor):
v=DMARC1; p=none; rua=mailto:dmarc-aggregate@example.com; ruf=mailto:dmarc-forensic@example.com; pct=100
# Phase 2 (Quarantine):
v=DMARC1; p=quarantine; rua=mailto:dmarc-aggregate@example.com; pct=25
# Phase 3 (Reject):
v=DMARC1; p=reject; rua=mailto:dmarc-aggregate@example.com; pct=100
Step 5: Monitor and Analyze DMARC Reports
Use the scripts/process.py to parse DMARC aggregate XML reports and identify authentication failures, unauthorized senders, and spoofing attempts.
Tools & Resources
- MXToolbox: https://mxtoolbox.com/SuperTool.aspx
- DMARC Analyzer (dmarcian): https://dmarcian.com/
- Google Postmaster Tools: https://postmaster.google.com/
- Valimail DMARC Monitor: https://www.valimail.com/
- DMARC Report Analyzer: https://dmarc.postmarkapp.com/
Validation
- SPF record passes validation at mxtoolbox.com
- DKIM signature verified on test emails
- DMARC record properly formatted and reporting enabled
- Test emails pass all three checks in recipient's Authentication-Results header
Frequently asked questions about Implementing DMARC DKIM SPF Email Security
Similar skills
Data Breach Blast Radius Analyzer
Assess potential breach impacts before they occur.
Verify Agent Action
Ensure safe execution of AI agent actions with thorough reviews.
Agent Supply Chain Integrity
Ensure the integrity of AI agent plugins and tools.
Agent OWASP ASI Compliance Check
Ensure your AI agents meet OWASP ASI security standards.
Securing S3 Buckets
Enhance your S3 bucket security with AWS best practices.
AWS Account Enumeration with ScoutSuite
Assess AWS security posture with comprehensive audits.
