Anti-Spam Beleidsregels: Geavanceerde Bescherming Tegen Ongewenste Email

💼 Management Samenvatting

Anti-spam beleidsregels vormen de fundamentele verdedigingslinie tegen ongewenste en kwaadaardige emails die inboxen overspoelen, productiviteit verstoren en gebruikers blootstellen aan phishing, malware en frauduleuze content. Deze beleidsregels gebruiken geavanceerde machine learning algoritmes, sender reputation scoring, content filtering en bulk email detection om spam proactief te identificeren en te blokkeren voordat gebruikers deze ontvangen. Voor Nederlandse overheidsorganisaties is het configureren van effectieve anti-spam beleidsregels essentieel voor het handhaven van email hygiene, het beschermen van gebruikers tegen social engineering aanvallen, en het voldoen aan compliance vereisten voor email security binnen de Nederlandse Baseline voor Veilige Cloud.

Aanbeveling
IMPLEMENT
Risico zonder
High
Risk Score
8/10
Implementatie
14u (tech: 6u)
Van toepassing op:
M365
Exchange Online
Defender voor Office 365
SharePoint
OneDrive
Teams

Spam emails vormen een constante bedreiging voor organisaties en vertegenwoordigen meer dan 85% van alle email verkeer wereldwijd. Moderne spam-aanvallen gebruiken geavanceerde technieken die traditionele filters omzeilen: bulk email campaigns waarbij aanvallers duizenden identieke emails versturen naar willekeurige email adressen in de hoop dat een percentage wordt geopend, phishing emails die zich voordoen als legitieme organisaties om inloggegevens te stelen, social engineering aanvallen die gebruikers manipuleren om gevoelige informatie te delen of acties uit te voeren, malware distribution via spam attachments en links, en reputation hijacking waarbij aanvallers legitieme sender reputaties misbruiken. Zonder effectieve anti-spam filtering worden inboxen overspoeld met ongewenste content, wat leidt tot productiviteitsverlies omdat gebruikers tijd besteden aan het sorteren en verwijderen van spam, verhoogd risico op security incidents wanneer gebruikers per ongeluk op kwaadaardige links klikken of malafide attachments openen, email deliverability problemen wanneer legitieme emails worden gemarkeerd als spam door overbelaste filters, en compliance risico's wanneer gevoelige informatie per ongeluk wordt gedeeld met malafide entiteiten via spam responses. Anti-spam beleidsregels voorkomen deze risico's door automatisch spam te detecteren op basis van sender reputation, content analysis, bulk email patterns, en machine learning gebaseerde classificatie, waarbij detected spam wordt geblokkeerd, in quarantine geplaatst of gemarkeerd met warning banners voordat gebruikers deze kunnen bereiken.

PowerShell Modules Vereist
Primary API: Exchange Online PowerShell
Connection: Connect-ExchangeOnline
Required Modules: ExchangeOnlineManagement

Implementatie

Anti-spam beleidsregels configureren een comprehensive filtering systeem dat alle inkomende emails analyseert en classificeert op basis van spam probability scores, sender reputation, content characteristics en bulk email patterns. De configuratie omvat verschillende primaire componenten: (1) Spam filtering action - bepaalt wat er gebeurt wanneer spam wordt gedetecteerd: MoveMessageToJmf (verplaats naar Junk Email folder, aanbevolen voor balans tussen security en usability), AddXHeader (voeg spam header toe maar lever email af, geschikt voor testing), DeleteMessage (verwijder email volledig, meest secure maar kan false positives veroorzaken), RedirectMessage (redirect naar specifiek email adres voor review), of QuarantineMessage (plaats in quarantine voor admin review), (2) Bulk email threshold - configureert de sensitivity voor bulk email detection waarbij emails met identieke content die naar veel ontvangers worden verstuurd worden geclassificeerd als bulk spam, met configuratie van threshold percentages (bijvoorbeeld 5% betekent dat emails naar meer dan 5% van de organisatie worden verstuurd worden als bulk gemarkeerd), (3) High confidence spam action - definieert actie voor emails met zeer hoge spam probability scores (meestal 95%+), waarbij QuarantineMessage of DeleteMessage wordt aanbevolen voor maximale security, (4) Spam action - definieert actie voor emails met medium tot high spam probability (meestal 70-95%), waarbij MoveMessageToJmf wordt aanbevolen voor balans, (5) Bulk email action - definieert actie voor detected bulk emails, waarbij MoveMessageToJmf of QuarantineMessage wordt aanbevolen afhankelijk van organisatiebeleid, (6) Phishing email action - configureert specifieke actie voor detected phishing emails binnen spam filter (werkt samen met dedicated anti-phishing policies), waarbij QuarantineMessage of DeleteMessage wordt aanbevolen, (7) Spam quarantine settings - configureert waar spam wordt opgeslagen en wie toegang heeft, met opties voor admin-only access of end-user access via quarantine portal, (8) End-user spam notifications - bepaalt of gebruikers worden geïnformeerd wanneer hun emails als spam worden gemarkeerd, wat helpt bij awareness maar ook kan leiden tot verwarring, (9) Allowed and blocked sender lists - configureert expliciete whitelists voor legitieme senders die nooit als spam moeten worden gemarkeerd, en blacklists voor bekende spam sources die altijd moeten worden geblokkeerd, (10) Language and region filtering - configureert filtering op basis van email language en sender region, wat nuttig kan zijn voor organisaties die alleen emails in specifieke talen of van specifieke regio's accepteren. De beleidsregels werken samen met connection filtering (IP allow/block lists), anti-phishing policies, anti-malware policies en Safe Links/Safe Attachments voor comprehensive multi-layer email protection.

Vereisten en Voorbereiding

Voor het configureren van comprehensive anti-spam beleidsregels zijn verschillende voorwaarden en voorbereidingen vereist die ervoor zorgen dat de implementatie succesvol verloopt en effectieve bescherming biedt zonder legitieme business processen te verstoren. Microsoft 365 E3 of E5 licentie (of Exchange Online Plan 2) is vereist voor toegang tot geavanceerde anti-spam features, hoewel basis anti-spam filtering standaard beschikbaar is voor alle Exchange Online tenants. Exchange Administrator of Security Administrator rol is nodig voor policy configuratie via Microsoft 365 Defender portal of PowerShell. PowerShell 5.1+ met ExchangeOnlineManagement module versie 3.0 of hoger is vereist voor geautomatiseerde configuratie en bulk-operaties, wat essentieel is voor grote organisaties die consistentie willen garanderen across multiple tenants of regelmatig policy updates moeten uitvoeren.

Daarnaast is het cruciaal om vooraf een comprehensive spam policy documentatie te ontwikkelen die beschrijft welke spam filtering levels nodig zijn voor verschillende user groups, welke senders als legitiem moeten worden beschouwd en moeten worden toegevoegd aan allow lists, en welke business processen afhankelijk zijn van bulk emails (bijvoorbeeld marketing campaigns, newsletter subscriptions, automated notifications) die mogelijk worden beïnvloed door bulk email filtering. Een priority senders lijst moet worden geïdentificeerd met externe partners, vendors, en business-critical senders die nooit als spam moeten worden gemarkeerd, inclusief hun email domains en IP ranges indien bekend. Een testing plan moet worden ontwikkeld om te valideren dat business-critical emails en legitieme senders niet false positive worden geblokkeerd, waarbij test scenarios worden gedefinieerd voor verschillende email types (transactional emails, marketing emails, partner communications, automated notifications).

Security team email adres moet worden geconfigureerd voor spam incident notifications en escalaties, waarbij een gedeeld mailbox of distribution list wordt gebruikt waar alle spam alerts worden afgeleverd voor incident response. Quarantine policy documentatie moet worden ontwikkeld die beschrijft welke quarantine policy wordt gebruikt (admin-only of end-user accessible), procedures voor spam review, retention periods voor quarantined items, en escalation procedures voor false positives. User communication plan moet worden ontwikkeld om gebruikers te informeren over spam filtering, hoe ze kunnen rapporteren over false positives, hoe ze toegang krijgen tot quarantined items indien end-user access is ingeschakeld, en wat ze moeten doen wanneer legitieme emails worden gemarkeerd als spam. Compliance mapping documentatie moet worden ontwikkeld die beschrijft hoe anti-spam policies voldoen aan BIO richtlijn 13.02 voor email security, ISO 27001 A.13.2.1 voor information transfer protection, NIS2 Artikel 21 voor cybersecurity risicobeheer, en CIS Microsoft 365 Foundations Benchmark control 2.2 voor spam filtering.

Implementatie van Anti-Spam Beleidsregels

Gebruik PowerShell-script anti-spam-policies.ps1 (functie Invoke-Remediation) – PowerShell script voor automatische configuratie van comprehensive anti-spam policies met spam filtering actions, bulk email thresholds, quarantine settings en allowed/blocked sender lists.

Implementatie van anti-spam beleidsregels via Microsoft 365 Defender portal begint met navigatie naar security.microsoft.com → Email & collaboration → Threat policies → Anti-spam policies. Klik op 'Create' om een nieuwe anti-spam policy aan te maken met een beschrijvende naam zoals 'Default Anti-Spam Policy' of 'Company Wide Spam Protection'. De eerste configuratiestap betreft de spam filtering actions, waarbij wordt bepaald wat er gebeurt wanneer verschillende spam types worden gedetecteerd.

Stap 1: Spam Filtering Actions - In de sectie 'Spam filtering' configureer de actions voor verschillende spam confidence levels. Voor 'High confidence spam' selecteer 'Quarantine message' (aanbevolen) of 'Delete message' voor maximale security, waarbij emails met zeer hoge spam probability scores (meestal 95%+) automatisch worden geblokkeerd. Voor 'Spam' selecteer 'Move message to Junk Email folder' (aanbevolen) voor balans tussen security en usability, waarbij emails met medium tot high spam probability (meestal 70-95%) worden verplaatst naar Junk folder maar nog steeds toegankelijk zijn voor gebruikers. Voor 'Bulk email' selecteer 'Move message to Junk Email folder' of 'Quarantine message' afhankelijk van organisatiebeleid, waarbij bulk emails worden behandeld als potential spam maar niet volledig worden geblokkeerd tenzij expliciet gewenst. Voor 'Phishing email' selecteer 'Quarantine message' of 'Delete message' (aanbevolen) omdat phishing emails altijd moeten worden geblokkeerd, waarbij deze setting werkt samen met dedicated anti-phishing policies voor comprehensive protection.

Stap 2: Bulk Email Threshold - Configureer de 'Bulk email threshold' door een percentage in te stellen dat bepaalt wanneer emails als bulk worden geclassificeerd. De standaardwaarde is 7, wat betekent dat emails naar meer dan 7% van de organisatie worden verstuurd worden als bulk gemarkeerd. Voor organisaties die strikter willen zijn kan deze waarde worden verlaagd naar 5% of lager, terwijl organisaties die meer permissief willen zijn deze waarde kunnen verhogen naar 10% of hoger. Het is belangrijk om deze threshold te tunen op basis van organisatiegrootte en email patterns - kleine organisaties kunnen lagere thresholds nodig hebben omdat een klein aantal identieke emails al een groot percentage vertegenwoordigt, terwijl grote organisaties hogere thresholds kunnen gebruiken omdat marketing campaigns en automated notifications legitiem naar veel gebruikers worden verstuurd.

Stap 3: Quarantine Settings - Configureer waar spam wordt opgeslagen en wie toegang heeft via de 'Quarantine settings' sectie. Selecteer de quarantine policy die wordt gebruikt voor spam items - 'AdminOnlyAccessPolicy' (standaard) beperkt toegang tot admins alleen, wat geschikt is voor organisaties met centrale security teams die alle quarantined items reviewen. Voor organisaties die gebruikers meer autonomie willen geven kan een aangepaste quarantine policy worden gemaakt die gebruikers toegang geeft tot hun eigen quarantined items via de quarantine portal, waarbij gebruikers zelf kunnen bepalen of items legitiem zijn en kunnen worden vrijgegeven. Configureer ook de retention period voor quarantined spam items (standaard: 30 dagen), waarbij items automatisch worden verwijderd na de retention period tenzij expliciet worden vrijgegeven.

Stap 4: End-User Notifications - Bepaal of gebruikers worden geïnformeerd wanneer hun emails als spam worden gemarkeerd via de 'End-user spam notifications' sectie. Het inschakelen van end-user notifications helpt bij awareness en geeft gebruikers controle over hun spam filtering, maar kan ook leiden tot verwarring wanneer gebruikers niet begrijpen waarom legitieme emails zijn gemarkeerd. Security teams moeten daarom zorgvuldig afwegen of end-user notifications worden ingeschakeld en gebruikers trainen over wat te doen wanneer zij een spam notification ontvangen. Voor organisaties met centrale security teams kan het beter zijn om end-user notifications uit te schakelen en alle spam handling te centraliseren via admin review.

Stap 5: Allowed and Blocked Sender Lists - Configureer expliciete whitelists en blacklists via de 'Allowed and blocked senders' sectie. Voeg priority senders toe aan de allowed senders lijst, inclusief externe partners, vendors, business-critical senders, en andere legitieme entiteiten die nooit als spam moeten worden gemarkeerd. Deze lijst kan worden geconfigureerd op basis van email adressen, domains, of IP ranges. Voeg bekende spam sources toe aan de blocked senders lijst, inclusief domains en IP ranges die regelmatig spam versturen. Het is belangrijk om deze lijsten regelmatig te reviewen en bij te werken omdat sender reputaties kunnen veranderen, en om voorzichtig te zijn met het toevoegen van uitzonderingen omdat dit security kan verzwakken.

Stap 6: Language and Region Filtering - Optioneel kan 'Language and region filtering' worden geconfigureerd voor organisaties die alleen emails in specifieke talen of van specifieke regio's accepteren. Deze feature kan nuttig zijn voor Nederlandse overheidsorganisaties die primair communiceren in het Nederlands en alleen emails van Nederlandse of Europese senders accepteren, maar moet voorzichtig worden gebruikt omdat het legitieme internationale communicatie kan blokkeren. Configureer allowed languages (bijvoorbeeld Nederlands, Engels) en blocked regions (bijvoorbeeld regio's met hoge spam rates) indien gewenst.

Stap 7: Policy Assignment - In de sectie 'Applied to' selecteer 'All users' voor company-wide protection, of maak specifieke assignments voor verschillende user groups. Voor priority accounts kan een separate 'Anti-Spam - Priority Accounts' policy worden gemaakt met stricter settings zoals hogere spam thresholds en altijd Quarantine action. Deze priority policy heeft voorrang over de company-wide policy voor toegewezen gebruikers. Na configuratie moet de policy worden getest om te valideren dat legitieme emails niet false positive worden geblokkeerd, waarbij test emails worden verzonden van externe senders, bulk email scenarios worden getest, en quarantined items worden gereviewed tijdens de eerste weken na implementatie.

Monitoring en Effectiviteit Meting

Gebruik PowerShell-script anti-spam-policies.ps1 (functie Invoke-Monitoring) – Controleert of anti-spam policies zijn geconfigureerd en rapporteert status van spam filtering, bulk email detection, quarantine management en detected spam statistics.

Continue monitoring van anti-spam beleidsregels is essentieel om de effectiviteit te meten, false positives te identificeren, en emerging spam patterns te detecteren. Start met het Microsoft 365 Defender portal dashboard onder Email & collaboration → Threat policies → Anti-spam policies → Overview, waar een overzicht wordt getoond van alle geconfigureerde policies, spam detection statistics, en recente spam attempts. Review quarantined spam emails regelmatig via Security.microsoft.com → Threat management → Review → Quarantine, filter op 'Spam' om alle geblokkeerde spam emails te zien, en analyseer de detection reasons om te begrijpen waarom emails zijn geblokkeerd (bulk email, high confidence spam, sender reputation, etc.).

Gebruik Threat Explorer voor gedetailleerde analyse van spam campaigns: Navigate naar Security.microsoft.com → Threat Explorer, filter op 'Spam' of 'Bulk email' om alle detected spam attempts te zien, analyseer sender patterns om trends te identificeren (bijvoorbeeld welke domains het meest worden gebruikt voor spam, welke bulk email patterns worden gedetecteerd), review spam detection rates om te zien hoeveel spam wordt geblokkeerd versus hoeveel door gebruikers wordt gemarkeerd als spam, en exporteer data voor trendanalyse over meerdere maanden. Monitor bulk email detections via Security.microsoft.com → Email & collaboration → Threat policies → Anti-spam policies → Bulk email, waar bulk email patterns worden getoond die wijzen op potential spam campaigns of legitieme marketing emails die mogelijk moeten worden whitelisted.

Analyseer false positives regelmatig door quarantined items te analyseren en te identificeren welke legitieme senders false positive zijn gemarkeerd. Voeg deze senders toe aan allowed senders lijst of adjust policy thresholds indien nodig. Meet policy effectiveness door detection rates te tracken: aantal detected spam emails per maand, percentage van spam emails die worden geblokkeerd voordat ze gebruikers bereiken, aantal false positives en impact op business operations, user-reported spam rates (lager is beter omdat dit betekent dat filters effectief zijn), en bulk email detection accuracy (hoeveel legitieme bulk emails worden correct geclassificeerd versus false positives).

Voer quarterly reviews uit waarbij policy effectiveness wordt geëvalueerd, policy settings worden getuned op basis van spam landscape changes, allowed/blocked sender lists worden geüpdatet met nieuwe legitieme senders en bekende spam sources, bulk email thresholds worden geadjusteerd op basis van false positive rates, en threat intelligence wordt geüpdatet met nieuwe spam patterns en techniques. Document alle bevindingen in een anti-spam effectiveness rapport dat wordt gedeeld met security team, management en compliance officers.

Remediatie en Troubleshooting

Gebruik PowerShell-script anti-spam-policies.ps1 (functie Invoke-Remediation) – Herstelt ontbrekende anti-spam policies of configureert comprehensive anti-spam protection volgens best practices.

Voor problemen met anti-spam beleidsregels zijn verschillende remediatiestrategieën beschikbaar. Bij ontbrekende anti-spam policies moet eerst worden geïdentificeerd welke policies ontbreken via het monitoring script, waarna ontbrekende policies worden geconfigureerd via de portal of PowerShell script. Verifieer policy assignments om te zorgen dat alle users correcte anti-spam policies hebben toegewezen, en test policies na configuratie om te valideren dat protection werkt zoals verwacht.

Bij false positive blocking moeten quarantined items worden gereviewed om legitieme emails te identificeren die false positive zijn geblokkeerd. Voeg legitieme senders toe aan allowed senders lijst in de anti-spam policy, of adjust policy thresholds door bulk email threshold te verhogen indien te veel legitieme bulk emails worden geblokkeerd. Create policy exceptions voor business-critical senders die regelmatig false positive zijn, en document false positives in een log voor policy tuning en trendanalyse. Voor insufficient protection moet de detection effectiveness worden geanalyseerd om gaps te identificeren. Enable additional protection features zoals stricter spam actions (Quarantine in plaats van Move to Junk), verlaag bulk email threshold voor strikter filtering, implement priority account protection met stricter policies voor executives, en review allowed/blocked sender lists om te zorgen dat bekende spam sources worden geblokkeerd.

Compliance en Framework Mapping

Anti-spam beleidsregels vormen een critical component van email security en zijn essentieel voor compliance met verschillende security frameworks. CIS Microsoft 365 Foundations Benchmark - control 2.2 (Zorg ervoor dat Anti-Spam policy is geconfigureerd met appropriate filtering actions), control 2.3 (Bulk email filtering is ingeschakeld), en control 2.7 (Quarantine management is geconfigureerd). BIO Baseline Informatiebeveiliging Overheid - Thema 13.02.01 (Email beveiligingscontroles - Spam filtering en bulk email protection), Thema 13.02.02 (Email hygiene - Spam detection en prevention), en Thema 12.05 (Identity management - Bescherming tegen social engineering via spam). ISO 27001:2022 A.8.16 (Security event monitoring - Spam threat detection en response), A.13.2.1 (Information transfer beleidsregels - Email security controls tegen spam), en A.7.4 (Human resource security - User awareness en spam training). NIS2 Artikel 21 (Cybersecurity risicobeheer - Threat detection en prevention maatregelen tegen spam) en Artikel 23 (Incident response - Spam detection capabilities). AVG Artikel 32 (Beveiliging van verwerking - Bescherming tegen spam die kan leiden tot data breaches via social engineering). Anti-spam policies moeten worden behandeld als critical security controls die regelmatig worden gereviewed, getest en geüpdatet op basis van emerging spam threats. Alle policy wijzigingen moeten worden gelogd voor audit doeleinden en policy effectiveness moet worden gemeten via spam detection rates, false positive rates, en user-reported spam rates.

Compliance & Frameworks

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 Anti-Spam Policies: Geavanceerde Bescherming tegen Ongewenste Email .DESCRIPTION Configureert comprehensive anti-spam policies in Microsoft Defender voor Office 365 inclusief spam filtering actions, bulk email thresholds, quarantine settings, allowed/blocked sender lists en end-user notifications. Implementeert een gelaagde verdedigingsstrategie tegen spam emails. .NOTES Filename: anti-spam-policies.ps1 Author: Nederlandse Baseline voor Veilige Cloud Created: 2025-01-28 Last Modified: 2025-01-28 Version: 1.0 Related JSON: content/m365/defender-email/anti-spam-policies.json .LINK https://github.com/[org]/m365-tenant-best-practise .EXAMPLE .\anti-spam-policies.ps1 -Monitoring Controleert of alle anti-spam policies zijn geconfigureerd .EXAMPLE .\anti-spam-policies.ps1 -Remediation Configureert comprehensive anti-spam policies volgens best practices #> #Requires -Version 5.1 #Requires -Modules ExchangeOnlineManagement [CmdletBinding()] param( [Parameter()] [switch]$WhatIf, [Parameter()] [switch]$Monitoring, [Parameter()] [switch]$Remediation ) $ErrorActionPreference = 'Stop' $VerbosePreference = 'Continue' function Connect-RequiredServices { <# .SYNOPSIS Verbindt met benodigde Microsoft services #> [CmdletBinding()] param() Write-Verbose "Verbinding maken met Exchange Online..." try { Connect-ExchangeOnline -ShowBanner:$false -ErrorAction Stop Write-Verbose "Verbonden met Exchange Online" } catch { Write-Error "Kon niet verbinden met Exchange Online: $_" throw } } function Test-AntiSpamPolicies { <# .SYNOPSIS Test of anti-spam policies correct zijn geconfigureerd .OUTPUTS PSCustomObject met compliance resultaten #> [CmdletBinding()] param() Write-Verbose "Controleren van anti-spam policies..." try { $policies = Get-HostedContentFilterPolicy -ErrorAction Stop $rules = Get-HostedContentFilterRule -ErrorAction Stop $results = @{ IsCompliant = $false TotalPolicies = $policies.Count EnabledPolicies = 0 PoliciesWithSpamAction = 0 PoliciesWithBulkEmailThreshold = 0 PoliciesWithQuarantine = 0 PoliciesWithAllowedSenders = 0 PoliciesWithBlockedSenders = 0 PolicyDetails = @() MissingFeatures = @() } if ($policies.Count -eq 0) { Write-Host " ❌ Geen anti-spam policies gevonden" -ForegroundColor Red $results.MissingFeatures += "Geen anti-spam policies geconfigureerd" return $results } Write-Host "`n Anti-Spam Policies:" -ForegroundColor Cyan foreach ($policy in $policies) { $policyInfo = @{ Name = $policy.Identity Enabled = $policy.Enabled HighConfidenceSpamAction = $policy.HighConfidenceSpamAction SpamAction = $policy.SpamAction BulkSpamAction = $policy.BulkSpamAction PhishSpamAction = $policy.PhishSpamAction BulkThreshold = $policy.BulkThreshold QuarantineRetentionPeriod = $policy.QuarantineRetentionPeriod EndUserSpamNotificationEnabled = $policy.EndUserSpamNotificationEnabled AllowedSenders = $policy.AllowedSenders BlockedSenders = $policy.BlockedSenders } if ($policy.Enabled) { $results.EnabledPolicies++ Write-Host " ✅ ENABLED: $($policy.Identity)" -ForegroundColor Green if ($policy.SpamAction -and $policy.SpamAction -ne 'None') { $results.PoliciesWithSpamAction++ Write-Host " Spam Action: $($policy.SpamAction) ✅" -ForegroundColor Green } else { Write-Host " Spam Action: ❌ Niet geconfigureerd" -ForegroundColor Red $results.MissingFeatures += "Spam action niet geconfigureerd in $($policy.Identity)" } if ($policy.HighConfidenceSpamAction -and $policy.HighConfidenceSpamAction -ne 'None') { Write-Host " High Confidence Spam Action: $($policy.HighConfidenceSpamAction) ✅" -ForegroundColor Green } else { Write-Host " High Confidence Spam Action: ❌ Niet geconfigureerd" -ForegroundColor Red $results.MissingFeatures += "High confidence spam action niet geconfigureerd in $($policy.Identity)" } if ($policy.BulkThreshold -gt 0) { $results.PoliciesWithBulkEmailThreshold++ Write-Host " Bulk Email Threshold: $($policy.BulkThreshold)% ✅" -ForegroundColor Green } else { Write-Host " Bulk Email Threshold: ❌ Niet geconfigureerd" -ForegroundColor Red $results.MissingFeatures += "Bulk email threshold niet geconfigureerd in $($policy.Identity)" } if ($policy.BulkSpamAction -and $policy.BulkSpamAction -ne 'None') { Write-Host " Bulk Spam Action: $($policy.BulkSpamAction) ✅" -ForegroundColor Green } else { Write-Host " Bulk Spam Action: ❌ Niet geconfigureerd" -ForegroundColor Yellow } if ($policy.PhishSpamAction -and $policy.PhishSpamAction -ne 'None') { Write-Host " Phishing Spam Action: $($policy.PhishSpamAction) ✅" -ForegroundColor Green } else { Write-Host " Phishing Spam Action: ❌ Niet geconfigureerd" -ForegroundColor Red $results.MissingFeatures += "Phishing spam action niet geconfigureerd in $($policy.Identity)" } if ($policy.QuarantineRetentionPeriod -gt 0) { $results.PoliciesWithQuarantine++ Write-Host " Quarantine Retention: $($policy.QuarantineRetentionPeriod) dagen ✅" -ForegroundColor Green } else { Write-Host " Quarantine Retention: ❌ Niet geconfigureerd" -ForegroundColor Yellow } if ($policy.AllowedSenders -and $policy.AllowedSenders.Count -gt 0) { $results.PoliciesWithAllowedSenders++ Write-Host " Allowed Senders: $($policy.AllowedSenders.Count) ✅" -ForegroundColor Green } else { Write-Host " Allowed Senders: Geen geconfigureerd" -ForegroundColor Gray } if ($policy.BlockedSenders -and $policy.BlockedSenders.Count -gt 0) { $results.PoliciesWithBlockedSenders++ Write-Host " Blocked Senders: $($policy.BlockedSenders.Count) ✅" -ForegroundColor Green } else { Write-Host " Blocked Senders: Geen geconfigureerd" -ForegroundColor Gray } Write-Host " End User Spam Notifications: $(if ($policy.EndUserSpamNotificationEnabled) { 'Enabled ✅' } else { 'Disabled' })" -ForegroundColor $(if ($policy.EndUserSpamNotificationEnabled) { "Green" } else { "Gray" }) } else { Write-Host " ⚠️ DISABLED: $($policy.Identity)" -ForegroundColor Yellow $results.MissingFeatures += "Policy $($policy.Identity) is uitgeschakeld" } $results.PolicyDetails += $policyInfo } # Check policy assignments Write-Host "`n Policy Assignments:" -ForegroundColor Cyan foreach ($rule in $rules) { if ($rule.Enabled) { Write-Host " ✅ Rule: $($rule.Identity) -> Policy: $($rule.HostedContentFilterPolicy)" -ForegroundColor Green } else { Write-Host " ⚠️ Rule: $($rule.Identity) (DISABLED)" -ForegroundColor Yellow } } # Determine compliance $hasRequiredFeatures = ($results.PoliciesWithSpamAction -gt 0) -and ($results.PoliciesWithBulkEmailThreshold -gt 0) -and ($results.EnabledPolicies -gt 0) $results.IsCompliant = $hasRequiredFeatures return $results } catch { Write-Error "Fout bij controleren van anti-spam policies: $_" throw } } function Invoke-Monitoring { <# .SYNOPSIS Monitort de compliance status van anti-spam policies #> [CmdletBinding()] param() Write-Host "`nMonitoring: Anti-Spam Policies" -ForegroundColor Yellow Write-Host "=================================" -ForegroundColor Yellow $result = Test-AntiSpamPolicies Write-Host "`nResultaten:" -ForegroundColor Cyan Write-Host " Totaal policies: $($result.TotalPolicies)" -ForegroundColor Cyan Write-Host " Ingeschakelde policies: $($result.EnabledPolicies)" -ForegroundColor Cyan Write-Host " Policies met Spam Action: $($result.PoliciesWithSpamAction)" -ForegroundColor $(if ($result.PoliciesWithSpamAction -gt 0) { "Green" } else { "Red" }) Write-Host " Policies met Bulk Email Threshold: $($result.PoliciesWithBulkEmailThreshold)" -ForegroundColor $(if ($result.PoliciesWithBulkEmailThreshold -gt 0) { "Green" } else { "Red" }) Write-Host " Policies met Quarantine: $($result.PoliciesWithQuarantine)" -ForegroundColor $(if ($result.PoliciesWithQuarantine -gt 0) { "Green" } else { "Yellow" }) Write-Host " Policies met Allowed Senders: $($result.PoliciesWithAllowedSenders)" -ForegroundColor $(if ($result.PoliciesWithAllowedSenders -gt 0) { "Green" } else { "Gray" }) Write-Host " Policies met Blocked Senders: $($result.PoliciesWithBlockedSenders)" -ForegroundColor $(if ($result.PoliciesWithBlockedSenders -gt 0) { "Green" } else { "Gray" }) if ($result.MissingFeatures.Count -gt 0) { Write-Host "`n Ontbrekende features:" -ForegroundColor Red foreach ($feature in $result.MissingFeatures) { Write-Host " - $feature" -ForegroundColor Red } } if ($result.IsCompliant) { Write-Host "`n✅ COMPLIANT - Alle anti-spam policies zijn correct geconfigureerd" -ForegroundColor Green exit 0 } else { Write-Host "`n❌ NON-COMPLIANT - Actie vereist voor ontbrekende of onjuist geconfigureerde policies" -ForegroundColor Red Write-Host " Gebruik -Remediation om policies te configureren volgens best practices" -ForegroundColor Yellow exit 1 } } function Invoke-Remediation { <# .SYNOPSIS Configureert comprehensive anti-spam policies volgens best practices #> [CmdletBinding()] param() Write-Host "`nRemediatie: Anti-Spam Policies Configureren" -ForegroundColor Yellow Write-Host "=============================================" -ForegroundColor Yellow try { Connect-RequiredServices Write-Host "`nConfigureren van anti-spam policies..." -ForegroundColor Cyan # Check if policy already exists $existingPolicy = Get-HostedContentFilterPolicy -Identity "Default Anti-Spam Policy" -ErrorAction SilentlyContinue if ($existingPolicy) { Write-Host " Policy 'Default Anti-Spam Policy' bestaat al" -ForegroundColor Yellow Write-Host " Updaten van bestaande policy..." -ForegroundColor Gray if ($WhatIf) { Write-Host " [WhatIf] Zou policy updaten met comprehensive settings" -ForegroundColor Yellow } else { Set-HostedContentFilterPolicy -Identity "Default Anti-Spam Policy" ` -HighConfidenceSpamAction Quarantine ` -SpamAction MoveToJmf ` -BulkSpamAction MoveToJmf ` -PhishSpamAction Quarantine ` -BulkThreshold 7 ` -QuarantineRetentionPeriod 30 ` -EndUserSpamNotificationEnabled $false ` -Enable $true ` -ErrorAction Stop Write-Host " ✅ Policy bijgewerkt" -ForegroundColor Green } } else { Write-Host " Aanmaken van nieuwe policy 'Default Anti-Spam Policy'..." -ForegroundColor Gray if ($WhatIf) { Write-Host " [WhatIf] Zou nieuwe policy aanmaken met comprehensive settings" -ForegroundColor Yellow } else { $policy = New-HostedContentFilterPolicy -Name "Default Anti-Spam Policy" ` -HighConfidenceSpamAction Quarantine ` -SpamAction MoveToJmf ` -BulkSpamAction MoveToJmf ` -PhishSpamAction Quarantine ` -BulkThreshold 7 ` -QuarantineRetentionPeriod 30 ` -EndUserSpamNotificationEnabled $false ` -Enable $true ` -ErrorAction Stop Write-Host " ✅ Policy aangemaakt" -ForegroundColor Green # Create corresponding rule Write-Host " Aanmaken van policy rule..." -ForegroundColor Gray $domains = Get-AcceptedDomain -ErrorAction SilentlyContinue $domainList = $domains | Select-Object -ExpandProperty Name $rule = New-HostedContentFilterRule -Name "Default Anti-Spam Policy Rule" ` -HostedContentFilterPolicy "Default Anti-Spam Policy" ` -RecipientDomainIs $domainList ` -Priority 0 ` -Enabled $true ` -ErrorAction Stop Write-Host " ✅ Rule aangemaakt" -ForegroundColor Green } } Write-Host "`n Configuratie instructies:" -ForegroundColor Cyan Write-Host " 1. Voeg allowed senders toe via Security portal:" -ForegroundColor Yellow Write-Host " Security.microsoft.com > Email & collaboration > Threat policies > Anti-spam" -ForegroundColor Gray Write-Host " > Edit policy > Allowed senders" -ForegroundColor Gray Write-Host " 2. Voeg blocked senders toe indien nodig:" -ForegroundColor Yellow Write-Host " > Blocked senders > Add known spam sources" -ForegroundColor Gray Write-Host " 3. Tune bulk email threshold op basis van organisatiegrootte:" -ForegroundColor Yellow Write-Host " > Bulk email threshold (standaard: 7%)" -ForegroundColor Gray Write-Host " 4. Test policies met test emails om false positives te voorkomen" -ForegroundColor Yellow Write-Host " 5. Monitor quarantined items regelmatig" -ForegroundColor Yellow Write-Host "`n✅ Anti-spam policies geconfigureerd" -ForegroundColor Green Write-Host " Let op: Voeg allowed/blocked senders handmatig toe via Security portal" -ForegroundColor Yellow exit 0 } catch { Write-Error "Fout bij configureren van anti-spam policies: $_" Write-Host " Handmatige configuratie: Security Admin Center > Threat policies > Anti-spam" -ForegroundColor Yellow exit 2 } } # ============================================================================ # MAIN EXECUTION # ============================================================================ try { Write-Host "`n========================================" -ForegroundColor Cyan Write-Host "Anti-Spam Policies" -ForegroundColor Cyan Write-Host "Nederlandse Baseline voor Veilige Cloud" -ForegroundColor Cyan Write-Host "========================================`n" -ForegroundColor Cyan # Execute based on parameters if ($Monitoring) { Connect-RequiredServices Invoke-Monitoring } elseif ($Remediation) { Invoke-Remediation } else { # Default: Compliance check Connect-RequiredServices $result = Test-AntiSpamPolicies if ($result.IsCompliant) { Write-Host "`n✅ COMPLIANT" -ForegroundColor Green } else { Write-Host "`n❌ NON-COMPLIANT" -ForegroundColor Red Write-Host "`nRun met -Monitoring voor gedetailleerde rapportage" -ForegroundColor Yellow Write-Host "Run met -Remediation om policies te configureren" -ForegroundColor Yellow } return $result } } catch { Write-Error "Error: $_" throw } finally { Write-Host "`n========================================`n" -ForegroundColor Cyan }

Risico zonder implementatie

Risico zonder implementatie
High: Zonder anti-spam beleidsregels worden inboxen overspoeld met ongewenste emails, wat leidt tot productiviteitsverlies, verhoogd risico op security incidents, email deliverability problemen en compliance risico's. Spam vertegenwoordigt meer dan 85% van alle email verkeer wereldwijd en vormt een constante bedreiging. Zonder adequate bescherming worden gebruikers blootgesteld aan phishing, malware en frauduleuze content via spam emails.

Management Samenvatting

Configureer comprehensive anti-spam policies met spam filtering actions (Quarantine voor high confidence spam, Move to Junk voor regular spam), bulk email threshold configuratie, quarantine settings, allowed/blocked sender lists, en end-user notifications. Implementeer multi-layer defense strategie. Voldoet aan CIS 2.2-2.7 (L1), BIO 13.02.01-13.02.02, ISO 27001 A.8.16/A.13.2.1, NIS2, AVG Artikel 32. Implementatie: 6 uur technisch + 8 uur voor governance, testing en documentatie. HIGH PRIORITY voor email hygiene en security.