DKIM (DomainKeys Identified Mail) digitally signs outgoing emails, allowing recipients to Verifieer email authenticity en detecteer spoofed/forged emails claiming to be van your domain.
Aanbeveling
IMPLEMENT
Risico zonder
High
Risk Score
7/10
Implementatie
3u (tech: 2u)
Van toepassing op:
β M365 β Exchange Online
Zonder DKIM kunnen attackers spoof your domain: Verzend emails appearing to come van @yourcompany.com, recipient servers kan niet Verifieer authenticity, phishing emails van spoofed domain succeed, damage to domain reputation. DKIM signing proves: email actually came van your domain, email hasn't been tampered in transit. Receiving servers can Verifieer DKIM signature en reject spoofed emails.
Schakel in DKIM signing voor alle aangepaste domains in Exchange Online. Configuration: (1) Add DKIM DNS records (TXT records) to public DNS, (2) Schakel in DKIM signing in Exchange Online per domain, (3) alle outbound emails get DKIM-Signature header met cryptographic signature, (4) Receiving servers Verifieer signature against public key in DNS. DKIM works samen met SPF en DMARC voor complete email authentication.
Voor elke aangepaste domain: Get DKIM CNAMEs (selector1._domainkey, selector2._domainkey)
Add CNAME records to public DNS
Verifieer DNS propagation (nslookup)
Schakel in DKIM signing in M365 admin center
Test: Verzend email, Controleer headers voor DKIM-Signature
monitor: DKIM failures in email logs
Compliance en Auditing
CIS M365 - regelen 2.1.2 (DKIM ingeschakeld)
BIO 13.02
ISO 27001:2022 A.13.2.1
NIS2 Artikel 21
Monitoring
Gebruik PowerShell-script dkim-enable.ps1 (functie Invoke-Monitoring) β Controleren.
Remediatie
Gebruik PowerShell-script dkim-enable.ps1 (functie Invoke-Remediation) β Herstellen.
Compliance & Frameworks
CIS M365: Control 2.1.2 (L1) - Zorg ervoor dat DKIM is ingeschakeld
BIO: 13.02 - BIO: Email authentication
ISO 27001:2022: A.13.2.1 - Email beveiligingsbeleidsregels
NIS2: Artikel - Email authentication
Automation
Gebruik het onderstaande PowerShell script om deze security control te monitoren en te implementeren. Het script bevat functies voor zowel monitoring (-Monitoring) als remediation (-Remediation).
PowerShell
<#
.SYNOPSIS
DKIM Signing Configuration
.DESCRIPTION
Ensures DKIM (DomainKeys Identified Mail) is enabled for all domains.
DKIM prevents email spoofing and improves deliverability.
.NOTES
Filename: dkim-enable.ps1
Author: Nederlandse Baseline voor Veilige Cloud
.EXAMPLE
.\dkim-enable.ps1 -Monitoring
Check DKIM status for all domains
.EXAMPLE
.\dkim-enable.ps1 -Remediation
Enable DKIM for all domains
#>#Requires -Version 5.1#Requires -Modules ExchangeOnlineManagement
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[switch]$Monitoring,
[Parameter(Mandatory = $false)]
[switch]$Remediation,
[Parameter(Mandatory = $false)]
[switch]$Revert,
[switch]$WhatIf
)
$ErrorActionPreference = 'Stop'
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "DKIM Signing Configuration" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
function Invoke-Monitoring {
try {
Connect-ExchangeOnline -ShowBanner:$false -ErrorAction Stop
Write-Host "Checking DKIM configuration for all domains..." -ForegroundColor Gray
$configs = Get-DkimSigningConfig -ErrorAction Stop
$result = @{
isCompliant = $true
total = $configs.Count
enabled = 0
disabled = 0
disabledDomains = @()
}
foreach ($config in $configs) {
if ($config.Enabled) {
$result.enabled++
Write-Host " [OK] ENABLED: $($config.Domain)" -ForegroundColor Green
}
else {
$result.disabled++
$result.isCompliant = $false$result.disabledDomains += $config.Domain
Write-Host " [FAIL] DISABLED: $($config.Domain)" -ForegroundColor Red
}
}
Write-Host "`n Total domains: $($result.total)" -ForegroundColor Cyan
Write-Host " DKIM Enabled: $($result.enabled)" -ForegroundColor Green
Write-Host " DKIM Disabled: $($result.disabled)" -ForegroundColor $(
if ($result.disabled -gt 0) { "Red" } else { "Green" }
)
if ($result.isCompliant) {
Write-Host "`n[OK] COMPLIANT - DKIM enabled for all domains" -ForegroundColor Green
exit 0
}
else {
Write-Host "`n[FAIL] NON-COMPLIANT - DKIM not enabled for all domains" -ForegroundColor Red
Write-Host "`nNote: You must publish CNAME records in DNS before enabling DKIM" -ForegroundColor Yellow
exit 1
}
}
catch {
Write-Host "`n[FAIL] ERROR: $_" -ForegroundColor Red
exit 2
}
}
function Invoke-Remediation {
try {
Connect-ExchangeOnline -ShowBanner:$false -ErrorAction Stop
Write-Host "Getting disabled DKIM configurations..." -ForegroundColor Gray
$configs = Get-DkimSigningConfig | Where-Object { -not $_.Enabled }
if ($configs.Count -eq 0) {
Write-Host " [OK] All DKIM configs already enabled" -ForegroundColor Green
exit 0
}
Write-Host "`nEnabling DKIM for $($configs.Count) domains...`n" -ForegroundColor Cyan
$enabled = 0$failed = 0foreach ($config in $configs) {
try {
Write-Host " Enabling DKIM for $($config.Domain)..." -ForegroundColor Gray
# First, ensure DNS records are publishedWrite-Host " Checking DNS records..." -ForegroundColor Gray
Set-DkimSigningConfig -Identity $config.Domain -Enabled $true -ErrorAction Stop
Write-Host " [OK] Enabled" -ForegroundColor Green
$enabled++
}
catch {
Write-Host " [FAIL] Failed: $_" -ForegroundColor Red
Write-Host " Check DNS CNAME records are published!" -ForegroundColor Yellow
$failed++
}
}
Write-Host "`n Enabled: $enabled" -ForegroundColor Green
if ($failed -gt 0) {
Write-Host " Failed: $failed" -ForegroundColor Red
Write-Host "`nβ οΈ Failures likely due to missing DNS records" -ForegroundColor Yellow
Write-Host "Publish CNAME records shown in Microsoft 365 Admin Center" -ForegroundColor Cyan
}
if ($enabled -gt 0) {
Write-Host "`n[OK] DKIM enabled for$enabled domains" -ForegroundColor Green
}
exit 0
}
catch {
Write-Host "`n[FAIL] ERROR: $_" -ForegroundColor Red
exit 2
}
}
function Invoke-Revert {
try {
Connect-ExchangeOnline -ShowBanner:$false -ErrorAction Stop
$configs = Get-DkimSigningConfig | Where-Object { $_.Enabled }
foreach ($config in $configs) {
Set-DkimSigningConfig -Identity $config.Domain -Enabled $false -ErrorAction Stop
Write-Host " β οΈ Disabled: $($config.Domain)" -ForegroundColor Yellow
}
exit 0
}
catch {
Write-Host "ERROR: $_" -ForegroundColor Red
exit 2
}
}
try {
if ($Revert) {
Invoke-Revert
}
elseif ($Monitoring) {
Invoke-Monitoring
}
elseif ($Remediation) {
Invoke-Remediation
}
else {
Write-Host "Usage:" -ForegroundColor Yellow
Write-Host " -Monitoring Check DKIM status" -ForegroundColor Gray
Write-Host " -Remediation Enable DKIM (requires DNS records!)" -ForegroundColor Gray
Write-Host " -Revert Disable DKIM" -ForegroundColor Gray
}
}
catch { throw }
finally {
Write-Host "`n========================================`n" -ForegroundColor Cyan
}
Risico zonder implementatie
Risico zonder implementatie
High: High - Domain spoofing attacks succeed. Attackers Verzend phishing emails appearing to be van your company. Damages reputation, maakt mogelijk BEC attacks, no cryptographic verification of email authenticity.
Management Samenvatting
Schakel in DKIM signing voor alle domains. Cryptographically signs outgoing emails. Recipients can Verifieer authenticity. Works met SPF/DMARC. Voldoet aan CIS 2.1.2 L1, BIO 13.02. Setup: 2u (DNS changes).