AnnexGroup

Documentation

Connecting third-party tools

AnnexGroup speaks standard protocols and has a REST administration. On top of that, there are three ways to bring third-party tools into the server or to operate the server from the outside: virus scanners and spam filters as engines, events as webhooks, the admin API.

What is open today

Direction Way Suited for
Reading and sending mailboxes IMAP, SMTP (port 587 with login) Automation tools with mail nodes, archiving, own scripts
Calendars and contacts CalDAV, CardDAV Synchronisation, scheduling, own services
User directory LDAP (read-only) External systems that look up addresses
Administration REST under /api/v1/admin/…, described as an OpenAPI file, login with an admin access token Creating users, queue, backup, settings from scripts and workflows
Metrics /metrics (Prometheus format) Prometheus, Grafana, Zabbix (HTTP query)
Events Webhooks (below) n8n, Zapier, Make, Node-RED, Home Assistant, own services
Virus protection, spam protection Engines (below) clamd, Rspamd, commercial scanners via ICAP, own services via HTTP, command-line programs

Not included: a Milter interface and third-party program code in the server process. The open boundary is listed under "Limits".

Connecting virus scanners and spam filters

In the administration: The same settings can be maintained under Administration → Integrations, with a connection test per engine. What is saved there replaces the values of config.yaml completely and takes effect at once, without a restart; “Back to config.yaml” discards the saved values. The page never shows passwords or tokens; an empty field when saving keeps the existing value.

In config.yaml under antispam, next to rspamd_url and clamav_addr, there is a list engines. Each entry is an engine in the slot virus or spam:

antispam:
  enabled: true
  virus_bei_fehler: zurueckstellen
  engines:
    - name: scanner-firma          # ICAP (RFC 3507)
      typ: icap
      slot: virus
      adresse: icap://10.0.0.5:1344/avscan   # icaps:// for TLS
      zeitlimit: 20s
      bei_fehler: zurueckstellen
    - name: eigener-filter         # raw message via POST, response as JSON
      typ: http
      slot: spam
      adresse: https://filter.example.org/scan
      token: geheim                # optional, as Bearer
    - name: kommandozeile          # message on standard input
      typ: befehl
      slot: virus
      programm: /usr/local/bin/mein-scanner
      argumente: ["--stdin"]
Type Contract
icap REQMOD according to RFC 3507. 204 means clean. With 200 and X-Infection-Found (Threat=…), X-Virus-ID or X-Violations-Found, the message counts as a detection. Many products speak ICAP, such as Sophos, Kaspersky, Trend Micro, ESET, Symantec and c-icap with ClamAV.
http POST with Content-Type: message/rfc822. Response with status 200 and JSON: {"fund":"Name"} for a virus, {"score":5.2,"symbole":["X"],"kopfzeilen":{"X-Filter":"eigener"}} for spam. Redirects are not followed.
befehl Program with an absolute path and fixed arguments, without a shell. The message arrives on standard input. Exit 0 means clean, exit 1 means a detection (the first output line is the name), any other exit is an error. Only for the slot virus. Output and runtime are limited.
clamd, rspamd like the previous fields, also as a list entry

bei_fehler says what happens when an engine gives no verdict: ueberspringen (deliver, with a warning and an amber light), zurueckstellen (the sender tries again later, response 451) or ablehnen (550). For virus protection, zurueckstellen is the setting when nothing is specified: mail waits instead of arriving without being scanned.

An error in the list (unknown type, missing program path, duplicate name) prevents the server from starting. The server never silently skips a misconfigured engine. Every engine appears in the component overview of the administration with its state; if it fails, the light turns amber or red.

Built-in mail protection, junk threshold and blocklists

The server ships with a built-in mail protection core (MH-3): rules, a learning filter and optional DNS blocklists. It runs in-process, needs no setup and is on by default. Under Administration → Integrations it can be switched off where the spam filter engines live; switching it off asks for confirmation and explains the consequence — there is no silent way to turn it off.

  • Switched off means: incoming mail is no longer scored for spam and no longer moved to the Junk folder. SPF, DKIM and DMARC still verify the origin — that is an origin verdict, not a content verdict. External spam engines (Rspamd, ICAP, HTTP, command) keep working unchanged.
  • Junk threshold (spam_score_add_header, default 6): from this score on, a message is moved to the Junk folder and marked with X-AnnexGroup-Spam. Trusted senders of the recipient stay in the inbox; own submission via 587 is never re-sorted.
  • Hard limit (spam_score_reject, default 0 = never reject): from this score on, a message is rejected on delivery.
  • Blocklists (blocklists): per zone the domain name and the points per hit (at most 5, so a single list never reaches the junk threshold on its own). The server only queries public IPv4 sender addresses. No zone is preset — check the terms of use of the chosen zone; Spamhaus, for example, requires a licence for business use. Duplicate zones and invalid names are rejected when saving.

Changes take effect immediately, without a restart, and are recorded in the audit log with the old and the new value. The thresholds also exist in config.yaml; whatever is saved in the admin replaces the file completely. The state and traffic light of the built-in mail protection are shown on the components page.

Sending events to n8n and other tools (webhooks)

The server can send events to an address as soon as they happen. That is the trigger a workflow tool needs.

Events

Name When
mail.delivered a message has arrived in the mailbox of a local recipient
mail.rejected a message was rejected before acceptance (reason: virus, spam, dmarc)
mail.sent a message was accepted for delivery to the outside (not: arrived at the recipient)
user.created, user.disabled user created or disabled
backup.completed, backup.failed a backup finished or failed
component.state an engine switches between ok and degraded

Message content and attachments are never sent along, only envelope, subject, size and reason. Anyone who needs the content fetches it over IMAP with an access token.

Create a recipient

curl -X POST https://mail.example.org/api/v1/admin/webhooks \
  -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"n8n","url":"https://n8n.example.org/webhook/abc","events":["mail.rejected","user.created"]}'

The response contains id and secret. The secret appears only in this response; with POST /api/v1/admin/webhooks/{id}/rotate-secret you receive a new one. events may contain *, a group such as mail.* or full names; empty means all.

What arrives

POST /webhook/abc
X-Annex-Event: mail.rejected
X-Annex-Delivery: 5f0c…
X-Annex-Timestamp: 1761200000
X-Annex-Signature: sha256=3b9f…

{"id":"5f0c…","event":"mail.rejected","time":"2026-10-23T05:00:00Z",
 "data":{"from":"x@example.com","to":["a@firma.de"],"reason":"virus","virus":"Eicar-Test-Signature","submission":false}}

Verify the signature. X-Annex-Signature is sha256= plus the HMAC-SHA256 over timestamp + "." + raw body, with the secret as the key. Also verify that the timestamp is no older than five minutes; that protects against replay. In an n8n Code node. The webhook node needs the “Raw Body” option switched on under “Options”, and n8n needs N8N_BLOCK_ENV_ACCESS_IN_NODE=false and NODE_FUNCTION_ALLOW_BUILTIN=crypto. The following node ran with n8n 1.100.1; here the secret is kept in the environment variable ANNEX_WEBHOOK_SECRET:

const crypto = require('crypto');
const buf = await this.helpers.getBinaryDataBuffer(0, 'data');
const roh = buf.toString('utf8');
const kopf = $input.first().json.headers;
const ts = kopf['x-annex-timestamp'];
const soll = 'sha256=' + crypto.createHmac('sha256', $env.ANNEX_WEBHOOK_SECRET).update(ts + '.' + roh).digest('hex');
if (soll !== kopf['x-annex-signature'] || Math.abs(Date.now() / 1000 - Number(ts)) > 300) {
  throw new Error('Invalid signature');
}
return $input.all();

Delivery. Events run in the background and never slow down mail delivery. If the recipient does not respond with 2xx, the server retries up to five times (after 30 seconds, 5 minutes, 30 minutes, 2 hours); after that, the delivery is listed as failed in GET /api/v1/admin/webhooks/{id}/deliveries. POST …/test immediately sends a test event and shows the response. Completed deliveries are deleted after 30 days.

Security. Addresses must use https://. A recipient in your own network (for example n8n in the same data centre) needs "allow_private": true explicitly; then http:// and private addresses are allowed as well. Connections to link-local addresses (including the metadata services of cloud providers), multicast and 0.0.0.0 are always blocked. What is checked is the address actually used to establish the connection. Redirects are not followed, proxies are not used.

Actions from workflows: the admin API

With an admin access token (Administration → Admin access tokens) you can operate the administration from an HTTP node, for example creating users or triggering a backup. The paths are listed in the OpenAPI description. A workflow that posts a notification on mail.rejected and opens a ticket on user.created needs only the webhook trigger and the nodes of the target system.

Limits

  • The connection of commercial virus scanners is tested against test servers according to RFC 3507, not against a commercial product. What your product returns in the ICAP header, you see in the test with an EICAR file; header names are not uniform across products.
  • The example workflow for n8n shown above — webhook trigger with signature verification in the code node — is marked as run only where a run against an n8n instance is documented.
  • A Milter interface is missing. Anyone using a Milter scanner connects it via a command-line program or a small HTTP service.
  • Events do not report message contents.

Something unclear or described wrong? Tell us — we will fix it. Your question shows us where the text falls short.