## Configure Remote Rspamd Server
- Login to your SmarterMail Server as an administrator, choose "Antispam" and click on "New Server" at Remote Rspam Servers.
- Enter _name_ for this server. I used the DNS name of my Rspamd Server
example: `<your domain>`.
- Enter Rspamd Server Address. Add the full address of the server
example: `https://<your domain>`
- Enter Checkv2 Endpoint, which is `/checkv2`
- Enter Learnspam Endpoint, which is `/learnspam`
- Enter Learnham Endpoint, which is `/learnham`
- Click Save
![[Pasted image 20240818180604.png|350]]
- On the same page click "Spam Checks"
- Click "Remote Rspamd" and activate Enable Spool Filtering and Enable Outbound SMTP Blocking.
- Click save
![[Pasted image 20240818180746.png|350]]
## Check if MailService is running
```powershell
$ServiceName = 'MailService'
$ServiceInfo = Get-Service -Name $ServiceName
if ($ServiceInfo.Status -ne 'Running') {
write-host $ServiceName is $ServiceInfo.Status, Starting $ServiceName
Start-Service -Name $ServiceName -verbose
$ServiceInfo.Refresh()
write-host $ServiceName is $ServiceInfo.Status
}
else {
write-host $ServiceName is $ServiceInfo.Status
}
```
## Mailbox Restore Process
```powershell
Get-ChildItem -Path $(Get-Location) -File -Include mailbox.cfg,root.cfg -Recurse | Remove-Item -Force -Verbose
```
## Update all IIS bindings to use Centralized Certificate Store (CCS)
```powershell
# Update all IIS bindings to use Centralized Certificate Store (CCS)
Import-Module WebAdministration
# Explicitly load the assembly from the IIS directory
Add-Type -Path "C:\Windows\System32\inetsrv\Microsoft.Web.Administration.dll"
$sm = New-Object Microsoft.Web.Administration.ServerManager
foreach ($site in $sm.Sites) {
foreach ($binding in $site.Bindings) {
if ($binding.Protocol -eq "https") {
# Remove certificateHash and certificateStoreName
$binding.CertificateHash = $null
$binding.CertificateStoreName = $null
# Enable CCS (sslFlags = 3)
$binding.SetAttributeValue("sslFlags", 3)
}
}
}
$sm.CommitChanges()
Write-Host "All HTTPS bindings updated to use Centralized Certificate Store."
```
## Cleanup expired Certificates
```powershell
# Set the certificate store location
$certStore = "Cert:\LocalMachine\My"
# Get current date
$currentDate = Get-Date
# Get all certificates from the specified store
$certs = Get-ChildItem -Path $certStore
foreach ($cert in $certs) {
# Check if the certificate is expired
if ($cert.NotAfter -lt $currentDate) {
Write-Host "Certificate $($cert.Thumbprint) is expired. Deleting..."
# Remove the expired certificate
Remove-Item -Path $cert.PSPath -Force
Write-Host "Certificate $($cert.Thumbprint) deleted."
}
}
```