ExposeMailDkim
Pulls the opendkim public key off the mail VM and writes it into the mail VM’s Proxmox description (notes), so the operator can read the DKIM TXT value straight from the Proxmox GUI (no SSH needed) to paste into the external DNS provider. Runs every netsetup update cycle from EnsureCustomerVms right after the mail VM is up. Best-effort: any failure (no mail VM, SSH down, key not generated yet) is logged + swallowed.
The opendkim key file (/var/lib/opendkim/<domain>.txt) is a multi-line BIND record with the value split across quoted chunks. NETSetup.Helpers.ExposeMailDkim.FlattenDkim(System.String) joins the chunks into the single-line TXT value (v=DKIM1; k=rsa; p=...). The description is set via qm set <vmid> -description, base64-piped through bash -c so multi-line text and special characters survive the NETCommand argv pipeline. Overwrites each cycle (the mail VM description is netsetup-managed), so it is idempotent and always reflects the current key.
public static class ExposeMailDkim
1. Methods
1.1. Run(ISystemHost, NETSetupConfig, Host)
Resolves the mail VM, gates on the guest-agent reporting hostname=="Mail", reads the opendkim pubkey over SSH, flattens it, and writes it into the VM’s Proxmox description.
public static void Run(ISystemHost host, NETSetupConfig config, Host proxmoxHost)
| Name | Type | Description |
|---|---|---|
host |
ISystemHost |
|
config |
NETSetupConfig |
|
proxmoxHost |
Host |