Можно установить антиспам агенты полностью с помощью скрипта Install-AntiSpamAgents.ps1, но они установятся только для Hub коннектора. Если посмотреть содержимое скрипта, то там -TransportService HUB
Для FrontEnd можно установить агенты отдельно, используя -TransportService FrontEnd
& $env:ExchangeInstallPath\Scripts\Install-AntiSpamAgents.ps1
Get-ReceiveConnector | fl name,bindings Get-RecipientFilterConfig | FL Enabled,RecipientValidationEnabled Get-AcceptedDomain | Format-List Name,AddressBookEnabled Set-RecipientFilterConfig -RecipientValidationEnabled $true Restart-Service MSExchangeTransport
С какого-то сервиспака по умолчанию работает только на HubTransport, но не на FrontEndTransport
Set-RecipientFilterConfig -BlockListEnabled $true -BlockedRecipients batman@exchlab.ru
После какого-то CU работает только на Hub, а не на FrontEnd
(Get-ReceiveConnector)[0] | Get-ADPermission -user "NT AUTHORITY\Anonymous Logon" | where {$_.ExtendedRights -like "ms-exch-smtp-accept-authoritative-domain-sender"} | Remove-ADPermission
После ввода . выйдет предупреждение
550 5.7.60 SMTP; Client does not have permissions to send as this sender
"Connection Filtering Agent" по умолчанию не устанавливается
В существующем FrontEnd коннекторе по умолчанию необходимо указать "не используемый" порт, например 251.
get-ReceiveConnector | ?{$_.bindings.port -eq 25}| Set-ReceiveConnector -Bindings 0.0.0.0:251 # или вручную Get-ReceiveConnector "Default FrontEnd Mail" | Set-ReceiveConnector -Bindings 0.0.0.0:251
Создаем новый коннектор FromInternet
New-ReceiveConnector -name "FromInternet" -Bindings 0.0.0.0:555 -AuthMechanism BasicAuth -RemoteIPRanges 0.0.0.0-255.255.255.255 -ProtocolLoggingLevel Verbose -Banner "220 mail.e2019.ru fromInternet"
Install-TransportAgent -Name "Connection Filtering Agent" -TransportService Hub -TransportAgentFactory "Microsoft.Exchange.Transport.Agent.ConnectionFiltering.ConnectionFilteringAgentFactory" -AssemblyPath "C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\agents\Hygiene\Microsoft.Exchange.Transport.Agent.Hygiene.dll" Enable-TransportAgent "Connection Filtering Agent" -TransportService Hub restart-service MSExchangeFrontEndTransport
Чтобы посмотреть агента, нужно указывать конкретно для Hub или для FrontEnd По умолчанию показывает только для Hub.
Get-TransportAgent -TransportService FrontEnd | fl *
get-ipBlockListEntry Add-IPBlockListEntry -IPAddress "10.10.10.10." -Comment (Get-Date) -ExpirationTime (Get-Date).AddDays(10) remove-ipBlockListEntry 27 #удалить запись номер 27
Логи находятся по пути C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\Hub\AgentLog
Командлет для работы
get-AgentLog -startDate "12/18/2025" | select Timestamp,IPAddress,P1FromAddress,Recipients,Action,Reason,SmtpResponse | ogv