Setup Modoboa Email Server on Ubuntu 22.04.2 LTS

Ubuntu 22.04.2 LTS
Minimum RAM 1gb (without clamav)
Minimum RAM 2gb (with clamav)

clamav-daemon start condition failed?
clamav-freshclam service needs lot of memory (out of memory will cause service to restart loop, then will be blocked by clamav CDN)
Rate limited / blocked from clamav CDN update, stop clamav-freshclam service for a while before restarting again

modoboa need pycairo
pycairo need packages:
sudo apt install libcairo2-dev pkg-config python3-dev

git clone https://github.com/modoboa/modoboa-installer
cd modoboa-installer
sudo python3 run.py --stop-after-configfile-check <domain>

update installer.cfg, set letsencrypt on
[certificate]
type=letsencrypt

[letsencrypt]
email=admin@domain.tld

run installer
sudo python3 run.py --debug <domain>

To limit clamav resource usages:
https://www.geekytuts.net/fix-high-server-load-and-memory-cpu-consumption-of-clamd-clamav/

To enable RAR scanning:
https://forum.proxmox.com/threads/av-scanning-in-rar-archives-not-working.71139/

To enable DKIM and SPF filter:
https://www.linuxbabe.com/mail-server/setting-up-dkim-and-spf

NOTE: DigitalOcean block outgoing port 25, alternative solution using sendgrid as relay to postfix
https://docs.sendgrid.com/for-developers/sending-email/postfix

Sources:
https://modoboa.readthedocs.io/en/latest/installation.html

OpenSSH Server on Windows 10

Install OpenSSH via Powershell Admin:
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Install OpenSSH (GUI Method):
Go to Settings → System → Optional Features.
Check if OpenSSH is installed. If not, select Add a feature, then find and install both OpenSSH Client and Server.
Confirm OpenSSH is listed in System and Optional Features.
Open the Services app, find OpenSSH SSH Server, set its startup type to Automatic, and start the service.

Install OpenSSH on older Windows 10 prior version 10.1809:
Download https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v7.9.0.0p1-Beta
Unpack to c:\Program Files\OpenSSH
Run Powershell as an Administrator:
Set-Location "C:\Program Files\OpenSSH"
.\install-sshd.ps1

Install SSH key:

type .\.ssh\id_ecdsa.pub
ssh target@win10pc
copy con \ProgramData\ssh\administrators_authorized_keys
icacls.exe \ProgramData\ssh\administrators_authorized_keys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"

Sources:
– https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
– https://docs.plm.automation.siemens.com/content/polarion/19.3/help/en_US/polarion_linux_installation/configure_ole_object_support_and_attachment_preview_generator/install_openssh.html