1.На пограничном транспортном сервере(Edge) запускаем powershell под админом и генерируем файл пограничной подписки

  New-EdgeSubscription -FileName E:\Dump\EdgeSubscription.xml

2.Копируем файл EdgeSubscription.xml на сервер почтовых ящиков и запускаем Powershell под админом, затем команду для экспорта конфигурации

New-EdgeSubscription -FileData ([byte[]]$(Get-Content -Path "E:\Downloads\EdgeSubscription.xml" -Encoding Byte -ReadCount 0)) -Site "Default-First-Site-Name"

3. Как только процесс прошел, необходимо выполнить процесс начальной синхронизации:

  Start-EdgeSynchronization

4. Проверить настройку синхронизации

  Get-EdgeSynchronization  

Проверить:

  1. Удалить созданный ранее вручную соединитель отправки в Интернет, для отправки есть EdgeSync – Default-First-Site-Name to Internet;
  2. Проверить настройки соединителя EdgeSync – Inbound to Default-First-Site-Name. Конкретно интересует раздел Доставка – Промежуточный узел, должен быть IP EDGE.
  3. Сервер почтовых ящиков должен разрешать FQDN Edge сервера, пинговать его и соединяться по порту 50636.
Get-AgentLog -StartDate "01/17/2024 08:20" | select Timestamp,IPAddress,P1FromAddress,Recipients,Event,Action,Reason,SmtpResponse | ft -a
Get-AgentLog -StartDate "01/17/2024 08:20" |?{$_.action -match "Reject"} |select Timestamp,IPAddress,P1FromAddress,Recipients,Event,Action,Reason,SmtpResponse | ogv

.\get-AntispamTopBlockedSenderDomains.ps1 P2 Get-SenderIDConfig | Format-List *Enabled*,*Action,Bypassed*

  Set-RecipientFilterConfig -BlockedRecipients @{Add="chris@contoso.com"}
  Set-RecipientFilterConfig -BlockedRecipients @{Remove="david@adatum.com"}
  
  
  Get-IPBlockListProvider
  Add-IPBlockListProvider -Name Spamhaus -LookupDomain zen.spamhaus.org -AnyMatch $true -Enabled $true -RejectionResponse "IP address  {0} is listed by Spamhaus. "
  
  add-IPBlockListProvider -Name 'Spamhaus ZEN' -LookupDomain 'zen.spamhaus.org' -Enabled $true -BitmaskMatch $null -IPAddressesMatch '127.0.0.2','127.0.0.3','127.0.0.4','127.0.0.9','127.0.0.10','127.0.0.11' -Priority '1' -AnyMatch $false -RejectionResponse 'Connecting IP address {0} has been blocked by Spamhaus ZEN. See http://www.spamhaus.org/query/bl?ip={0} for further details.'
  
  Add-IPBlockListProvider -Name “SpamCop IP Block List Provider” -LookupDomain “bl.spamcop.net” -IPAddressesMatch “127.0.0.2”,”127.0.0.5″ -Priority 1 -RejectionResponse “Your message was rejected because the IP address {0} of the server sending your message is in the SpamCop IP Block List Provider.”

Set-IPBlockListProvider “SpamCop IP Block List Provider” -RejectionResponse “Your message was rejected because the IP address {0} of the server sending your message is in the SpamCop IP Block List Provider.”

  
  [PS] C:\Program Files\Microsoft\Exchange Server\V15\scripts>.\get-AntispamTopRBLProviders.ps1
  
  
  
  

Set-RecipientFilterConfig -RecipientValidationEnabled $true

Exchange 2016 Антиспам Агент УСТАНОВКА АГЕНТА EXCHANGE ANTISPAM

& $env:ExchangeInstallPath\Scripts\Install-AntiSpamAgents.ps1

Перезапуск службы

Restart-Service MSExchangeTransport

Указываем службе транспорта, сервер обработки спама:

Set-TransportConfig -InternalSMTPServers 10.10.10.32

(Если несколько серверов Exchange, укажите их через запятую)

НАСТРОЙКА

IP Block List Providers — SpamHaus и SpamCop:

Add-IPBlockListProvider -Name “SpamHaus IP Block List Provider” -LookupDomain “zen.spamhaus.org” -BitMaskMatch 127.0.0.1

Set-IPBlockListProvider “SpamHaus IP Block List Provider” -RejectionResponse “Your message was rejected because the IP address of the server sending your message is in the SpamHaus IP Block List Provider.”

Add-IPBlockListProvider -Name “SpamCop IP Block List Provider” -LookupDomain “bl.spamcop.net” -IPAddressesMatch “127.0.0.2”,”127.0.0.5″ -Priority 1

Set-IPBlockListProvider “SpamCop IP Block List Provider” -RejectionResponse “Your message was rejected because the IP address of the server sending your message is in the SpamCop IP Block List Provider.”

Add-IPBlockListProvider -Name dnsbl.sorbs.net -LookupDomain dnsbl.sorbs.net

Add-IPBlockListProvider -Name cbl.abuseat.org -LookupDomain cbl.abuseat.org

Add-IPBlockListProvider -Name spam.dnsbl.sorbs.net -LookupDomain spam.dnsbl.sorbs.net

Add-IPBlockListProvider -Name spam.rbl.msrbl.net -LookupDomain spam.rbl.msrbl.net

Add-IPBlockListProvider -Name bl.spamcannibal.org -LookupDomain bl.spamcannibal.org

Add-IPBlockListProvider -Name psbl.surriel.com -LookupDomain psbl.surriel.com

Указываем перечень доменов, которые требуется исключить из механизма проверки:

Set-ContentFilterConfig -BypassedSenderDomains domain.ru,domain.com

Добавление к этому списку:

Set-ContentFilterConfig –BypassedSenderDomains @{Add=”domain2.com”, “domain.net”}

Добавляем провайдера белых списков адресов:

Add-IPAllowListProvider -name swl.spamhaus.org -lookupdomain swl.spamhaus.org

Add-IPAllowListProvider -name iadb.isipp.com -lookupdomain iadb.isipp.com

Add-IPAllowListProvider -name query.bondedsender.org -lookupdomain query.bondedsender.org

Add-IPAllowListProvider -name hul.habeas.com -lookupdomain hul.habeas.com

Проверка наличия и корректности SPF

Set-SenderIDConfig -SpoofedDomainAction Reject

Настроим фильтрацию содержимого:

Set-ContentFilterConfig -SCLDeleteEnabled $true -SCLDeleteThreshold 9 SCLRejectEnabled $true -SCLRejectThreshold 7

Set-ContentFilterConfig -RejectionResponse “Your email is identified as spam, and has been rejected by the recipient’s e-mail system.”

ПОЛЕЗНОЕ:

Агенты

Get-TransportAgent

Включен ли агент

Get-ContentFilterConfig | fl enabled

Отключение агента

Set-ContentFilterConfig -Enabled $false

dd-AttachmentFilterEntry -Name image/jpeg -Type ContentType You can also do that a bit different way

Add-AttachmentFilterEntry -Name *.jpg -Type FileName To test this out, send an email with attached file format you just filtered.

To remove extension from filter, type in following

Remove-AttachmentFilterEntry ContentType:image/jpeg

Set-AttachmentFilterListConfig [-Action <Reject | Strip | SilentDelete>] [-RejectResponse "<Message text>"] [-AdminMessage "<Replacement file text>"] [-ExceptionConnectors <ConnectorGUID>] Set-AttachmentFilterListConfig -Action Reject -RejectResponse "This message contains a prohibited attachment. Your message can't be delivered. Please resend the message without the attachment."