#pSmtpQueue
Recomendación: Proxmox Mail Gateway como capa adicional delante de nextxch
Un gateway de correo antepuesto acepta todo el correo procedente de internet, lo comprueba con un segundo motor antispam y antivirus independiente y reenvía a nextxch solo el correo limpio. Esta página muestra la arquitectura, una configuración paso a paso de Proxmox Mail Gateway (código abierto, AGPLv3) delante de nextxch y los ajustes de nextxch que importan.
El gateway es opcional: nextxch tiene su propia protección contra spam y virus. Importante si lo utiliza: añada la IP del gateway en nextxch como gateway de confianza (paso 5). nextxch lee entonces la IP real del remitente del encabezado Received del gateway y sigue evaluando correctamente SPF, DMARC, greylisting y DNSBL en lugar de comprobar la IP del gateway.
Por qué puede tener sentido un gateway delante
- Defensa en profundidad: deben fallar dos sistemas independientes antes de que un mensaje malicioso llegue a un buzón. Una debilidad en un producto no basta por sí sola.
- Segundo motor antispam y antivirus: Proxmox Mail Gateway utiliza sus propias reglas, filtro bayesiano, SPF, DNSBL y ClamAV. Lo que se le escapa a un filtro, a menudo lo detecta el otro.
- Cuarentena: los mensajes sospechosos se retienen en el gateway y los administradores o los usuarios pueden revisarlos y liberarlos a través del informe de spam.
- Desacoplamiento de internet: solo el gateway acepta conexiones desde internet en el puerto 25. nextxch se sitúa detrás, con el puerto 25 abierto únicamente para el gateway.
- Almacenamiento temporal durante el mantenimiento: si nextxch no está disponible brevemente por una actualización o un mantenimiento, el gateway conserva los mensajes entrantes en su cola y los entrega después.
Una valoración honesta: nextxch incluye su propia protección antispam (SpamGuard con filtro adaptativo, SPF/DKIM/DMARC/ARC, greylisting, DNSBL, heurísticas antiphishing) e integra ClamAV. Para la mayoría de las instalaciones es suficiente. Un gateway delante es opcional y compensa ante requisitos más exigentes: directivas que exigen filtrado en varias etapas, una cuarentena central, varios servidores de correo detrás de un MX o una separación estricta de redes.
Arquitectura: Internet -> Proxmox Mail Gateway -> nextxch
El registro MX apunta al gateway. Este acepta el correo en el puerto 25, lo filtra y lo reenvía por SMTP a nextxch. Opcionalmente, nextxch envía el correo saliente a través del puerto interno 26 del gateway.
Proxmox® es una marca registrada de Proxmox Server Solutions GmbH. El nombre se utiliza únicamente con fines descriptivos; nextxch no está afiliado a Proxmox Server Solutions GmbH ni está respaldado ni certificado por ella.
Configuración de un vistazo
El orden evita perder correo: primero configure y pruebe el gateway por completo, después cambie el registro MX y, por último, cierre el puerto 25 en nextxch.
1. Install Proxmox Mail Gateway (ISO, on Debian or as an LXC container)
2. Add relay domains (every domain nextxch accepts)
3. Default relay = nextxch host, port 25 (Mail Proxy -> Relaying)
4. Enable receiver verification, TLS and a certificate in the gateway
5. nextxch: add the gateway IP as a trusted gateway (SpamGuard)
6. Send a test message through the gateway, check Message Trace in nextxch
7. Switch the MX record to the gateway (remove the old MX only after the TTL expires)
8. Firewall: allow port 25 on nextxch from the gateway only
9. Optional outbound: gateway as smart host in nextxch (port 26, STARTTLS)
Example values on this page:
Gateway: pmg.company.com 203.0.113.25 (public, MX)
nextxch: mail.company.com 10.0.0.20 (internal, mailboxes)
1. Instalar Proxmox Mail Gateway
Proxmox Mail Gateway se ejecuta como appliance independiente (instalador ISO en hardware o como VM), como paquetes en un sistema Debian existente o como contenedor LXC. Si utiliza Proxmox VE, hay disponible una plantilla de contenedor lista para usar en el gestor de appliances. Después se administra mediante la interfaz web en el puerto 8006.
Option A: ISO installer (hardware or VM)
Download the ISO from proxmox.com/downloads -> boot -> run the installer
Host name: pmg.company.com (FQDN, matching the future MX and PTR)
IP: static IP, e.g. 203.0.113.25 or a DMZ address behind NAT
Option B: on an existing Debian system
Add the Proxmox package repository and install the packages as described in
"Install Proxmox Mail Gateway on Debian" in the PMG admin guide
Option C: LXC container in Proxmox VE
Proxmox VE -> Storage -> CT Templates -> Templates -> section "mail"
-> download the Proxmox Mail Gateway template -> create the container
Web interface: https://pmg.company.com:8006 (port 8006 from the admin network only)
Repositories: without a subscription, add the "pmg-no-subscription" repository.
For production, Proxmox recommends the enterprise repository (with subscription).
2. Dominios de relay, relay predeterminado y verificación de destinatarios en el gateway
Todos los ajustes están en la interfaz web de PMG, en Configuration -> Mail Proxy. El gateway solo acepta correo para los dominios de relay indicados y, tras filtrarlo, lo entrega al relay predeterminado.
Configuration -> Mail Proxy -> Relay Domains
company.com
company-group.com (every domain configured in nextxch, including alias domains)
Configuration -> Mail Proxy -> Relaying
Default Relay: mail.company.com (or 10.0.0.20)
Relay Port: 25
Relay Protocol: SMTP
Disable MX lookup: yes (address the nextxch host directly)
Configuration -> Mail Proxy -> Ports
External SMTP Port: 25 (from the internet, untrusted)
Internal SMTP Port: 26 (from nextxch, trusted, for outbound mail)
Configuration -> Mail Proxy -> Options
Verify Receivers: 550 (reject unknown recipients right away)
SPF: yes
DNSBL Sites: e.g. zen.spamhaus.org (observe the list's terms of use)
Several internal servers: Configuration -> Mail Proxy -> Transports
(domain or single address -> its own target server)
3. Cambiar el registro MX al gateway
Realice el cambio solo cuando un mensaje de prueba enviado a través del gateway haya llegado a nextxch (Message Trace en /admin/). Reduzca antes el TTL del registro MX a unos pocos minutos. No modifique los registros del propio nextxch (A/AAAA, PTR, Autodiscover): los clientes siguen conectándose directamente a nextxch.
; Gateway
pmg.company.com. 3600 IN A 203.0.113.25
; PTR for 203.0.113.25 at your provider: pmg.company.com
; MX points to the gateway only
company.com. 3600 IN MX 10 pmg.company.com.
; nextxch stays reachable for clients (IMAP, SMTP submission, webmail)
mail.company.com. 3600 IN A 198.51.100.20
Test beforehand, without a DNS change:
swaks --to anna.weber@company.com --server pmg.company.com --port 25 --tls
4. Saliente opcional: gateway como smart host en nextxch
El correo saliente pasa entonces también por los filtros del gateway (p. ej., análisis antivirus, estadísticas). En el Admin Cockpit, en SMTP, Queue Controls & Live MX Tester (#pSmtpQueue), introduzca el gateway como smart host global, o utilice rutas SMTP para enviar solo determinados remitentes a través del gateway. Importante: la IP pública del gateway debe figurar entonces en el registro SPF de sus dominios, y su PTR debe coincidir con el nombre HELO del gateway.
# A) Global smart host: all outbound mail through the gateway
nextxch-cli update SmtpQueue --set outboundSmartHost=pmg.company.com \
--set outboundSmartPort=26 --set outboundSmartHostTlsMode=StartTlsRequired
# B) Exception: one partner domain still directly via DNS MX (route without target host)
nextxch-cli create Route --set domain=partner.com --set bypassSmartHost=true \
--set description="direct via MX, not through the gateway"
# C) Only certain senders through the gateway (#pSmtpQueue -> domain routes)
# Destination domain: *
# Only for senders: company.com, *.company.com (SenderDomains)
# Target host: pmg.company.com:26 (several, comma-separated = failover)
# TLS mode: StartTlsRequired
# Priority: 50 (smaller = first; default 100)
# Add the gateway IP to the SPF record of the sender domain:
company.com. IN TXT "v=spf1 mx ip4:203.0.113.25 -all"
# In the gateway: add the nextxch IP under Configuration -> Mail Proxy -> Networks
# if nextxch is not in the same subnet as the gateway.
5. Añadir la IP del gateway como de confianza en nextxch
Un gateway de correo acepta el mensaje él mismo y lo vuelve a entregar. Para nextxch, la IP que entrega es entonces siempre la IP del gateway. Para que SPF, DMARC, greylisting, DNSBL y la comprobación de DNS inverso sigan evaluando al remitente real, añada el gateway en SpamGuard & ClamAV (#pSpam), en "Gateways de confianza". Para las conexiones desde estas IP, nextxch lee la IP del remitente del encabezado Received que escribió el gateway. Los encabezados solo se evalúan en conexiones desde IP incluidas en la lista, de modo que un remitente que entrega directamente no puede falsificar su IP de esta forma. TrustedProxyCidrs (Cluster:EnableProxyProtocol) es otra cosa: solo se aplica a proxies TCP como HAProxy que usan el protocolo PROXY.
# nextxch: add the gateway as trusted (public and internal IP, CIDR allowed)
# (admin cockpit: SpamGuard & ClamAV (#pSpam) -> "Trusted gateways")
nextxch-cli update SpamGuard --set trustedRelayCidrs=203.0.113.25,10.0.0.25
# Check: send a test message through the gateway, then in the spam analyzer or Message Trace
# TRUSTED_RELAY Via gateway 10.0.0.25, sender IP 198.51.100.7 from Received header
# SPF_PASS (SPF now checked against 198.51.100.7)
# Stays active in nextxch:
# SPF/DKIM/DMARC/ARC, greylisting, DNSBL, adaptive content filter,
# phishing heuristics, allow/block lists, ClamAV (if enabled)
# Connection limit: all inbound mail comes from one IP.
# Check MaxConnectionsPerIp (#pSmtpQueue, default 48) for high volumes.
6. Firewall y TLS en ambos tramos
Cierre el puerto 25 de nextxch en el firewall del host o perimetral (Firewall de Windows, nftables, pfSense/OPNsense). Las reglas de IP de nextxch no son adecuadas para ello, porque se aplican a todos los puertos SMTP a la vez y, por tanto, afectarían también a los puertos 465 y 587 de los clientes. Cifre ambos tramos: Internet <-> gateway y gateway <-> nextxch.
Firewall nextxch (inbound)
TCP 25 only from 203.0.113.25 / 10.0.0.25 (gateway)
TCP 465, 587 clients (SMTP submission) -> stay open
TCP 993, 443 clients (IMAP, webmail, DAV, push) -> stay open
Firewall gateway (inbound)
TCP 25 from the internet
TCP 26 from nextxch only (smart host, if used)
TCP 8006 from the admin network only
TLS internet <-> gateway
Configuration -> Mail Proxy -> TLS: "Enable TLS" on
Certificate: Certificates -> ACME (Let's Encrypt) for pmg.company.com
TLS gateway -> nextxch
nextxch offers STARTTLS on port 25 with the certificate of mail.company.com
Gateway: TLS destination policy for mail.company.com = encrypt
(or verify if the default relay is entered as a host name)
TLS nextxch -> gateway (smart host)
outboundSmartHostTlsMode = StartTlsRequired
7. DKIM/DMARC, greylisting y backscatter
Tres puntos que a menudo se pasan por alto en la práctica: el gateway no debe modificar el correo saliente, el greylisting solo debe ejecutarse en un único lugar y los destinatarios desconocidos deben rechazarse durante el diálogo SMTP.
DKIM / DMARC
- nextxch signs outbound mail with DKIM. The gateway forwards it unchanged.
- No disclaimer rule for outbound mail and no content changes in the gateway
(otherwise the DKIM signature breaks and DMARC fails at the recipient).
- Leave DKIM signing off in the gateway; maintain disclaimers in nextxch if needed.
Greylisting
- Slows down spam bots but delays first messages from new senders (usually < 30 minutes per PMG docs).
- Run it in the gateway only; behind the gateway it would be ineffective in nextxch.
- For time-critical senders (e.g. login codes, order confirmations) use the welcomelist,
or skip greylisting entirely if the other filters are sufficient.
Avoid backscatter
- Verify Receivers = 550: the gateway asks nextxch via RCPT TO whether the address exists.
- nextxch rejects unknown recipients at RCPT TO, so the check takes effect immediately.
- Catch-all addresses in nextxch defeat the check and should be avoided.
8. Licencia y costes (a 1 de noviembre de 2026)
Proxmox Mail Gateway es de código abierto bajo la GNU AGPLv3 y puede usarse por completo sin suscripción; en ese caso, las actualizaciones proceden del repositorio pmg-no-subscription, que Proxmox destina a sistemas de prueba y no productivos. Una suscripción se aplica por host y año, según Proxmox incluye usuarios y dominios ilimitados, y da acceso al repositorio enterprise. Los precios siguientes proceden de la página de precios de Proxmox y pueden cambiar; proxmox.com es siempre la referencia. nextxch no vende suscripciones de Proxmox.
Licence: GNU Affero General Public License v3 (AGPLv3), since PMG 5.0
Optional subscriptions per host and year (net, per proxmox.com, as of 1 Nov 2026):
Community EUR 190 no ticket support (forum)
Basic EUR 540 5 tickets/year, response 1 business day
Standard EUR 1,260 15 tickets/year, response 4 hours
Premium EUR 1,900 unlimited tickets, response 2 hours
(response = first reply to critical requests within business hours)
Sources:
https://www.proxmox.com/en/products/proxmox-mail-gateway/pricing
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html (admin guide 9.1.1: licence, repositories, ports)
Configuración, valores predeterminados y buenas prácticas
| Ajuste / ubicación | Descripción | Valor predeterminado | Buena práctica de producción |
|---|---|---|---|
PMG: Relay Domains (Mail Proxy) |
Lista de dominios para los que el gateway acepta y reenvía correo. El correo para otros dominios se rechaza. | leer |
Añada todos los dominios configurados en nextxch, incluidos los dominios alias. Cuando añada un dominio en nextxch, añádalo también al gateway. |
PMG: Default Relay + Port (Mail Proxy -> Relaying) |
Destino del correo entrante tras el filtrado (transporte de Postfix). Servidores internos adicionales por dominio mediante Transports. | Port 25 · SMTP |
mail.company.com o 10.0.0.20, puerto 25, protocolo SMTP. Active "Disable MX lookup" si introduce un nombre de host que tiene su propio registro MX. |
PMG: Verify Receivers (Mail Proxy -> Options) |
Verificación de destinatarios: antes de aceptar, el gateway pregunta a nextxch mediante RCPT TO si la dirección existe y rechaza los destinatarios desconocidos durante el diálogo SMTP. | aus |
Establézcalo en 550. Evita el backscatter, porque el gateway nunca acepta correo para direcciones inventadas que después tendría que rebotar. |
PMG: TLS + Zertifikat |
STARTTLS para las conexiones entrantes y salientes del gateway. Sin un certificado propio, PMG genera uno autofirmado. | TLS aus |
Active TLS, obtenga un certificado de confianza mediante ACME (Let's Encrypt) para pmg.company.com y establezca una política TLS "encrypt" para el host de nextxch. |
PMG: Disclaimer & DKIM-Signatur |
La acción de regla Disclaimer añade texto al cuerpo; DKIM Signing firma el correo recibido en el puerto interno. | aus |
Deje ambas opciones desactivadas. nextxch firma con DKIM; cualquier cambio del contenido en el gateway rompe la firma y, por tanto, DMARC. Mantenga los avisos legales únicamente en nextxch (se añaden antes de la firma). |
nextxch: Smart-Host (#pSmtpQueue · outboundSmartHost) |
Smart host global: todo el correo saliente se envía a este relay en lugar de directamente al MX del destinatario. | leer (direkt per MX) · Port 25 |
pmg.company.com, puerto de relay 26 (el puerto interno del gateway), modo TLS StartTlsRequired, sin SMTP AUTH. En el gateway, la IP de nextxch debe figurar en Networks (la misma subred se permite automáticamente). |
nextxch: Route · SenderDomains |
Condición de remitente de una ruta SMTP: dominios (company.com, *.company.com) o direcciones (billing@company.com, *@company.com). Vacío = cualquier remitente. | leer |
Enviar solo determinados inquilinos a través del gateway: una ruta con dominio de destino * y SenderDomains = company.com, host de destino pmg.company.com:26. |
nextxch: Route · Priority |
Orden entre rutas del mismo rango; gana el número menor y, después, el patrón más específico. | 100 |
El rango va antes que la prioridad: remitente + dominio de destino, después dominio de destino, después solo remitente (destino *), después *, después smart host global y después DNS MX. |
nextxch: Route · BypassSmartHost |
Solo para rutas sin host de destino: el correo a este dominio se entrega directamente vía DNS MX aunque haya un smart host global configurado. | false |
Para dominios de partners concretos que no deben pasar por el gateway. Si la ruta tiene un host de destino, el interruptor se ignora. |
nextxch: Vertrauenswürdige Gateways (#pSpam · trustedRelayCidrs) |
IP o redes CIDR de gateways anteriores. Cuando una conexión procede de allí, nextxch toma la IP del remitente y el HELO del encabezado Received más alto que no haya escrito un gateway incluido en la lista ni localhost. | leer |
Añada la IP pública e interna del gateway, p. ej., 203.0.113.25 y 10.0.0.25. Solo sus propios gateways: los encabezados Received de las IP indicadas se consideran verídicos. El analizador de spam muestra entonces la regla TRUSTED_RELAY con la IP del remitente detectada. |
nextxch: SPF, DKIM, DMARC & ARC, Greylisting, DNSBL (#pSpam) |
Con el gateway incluido en la lista, comprueban la IP real del remitente. Sin él solo verían la IP del gateway, y SPF devolvería en la mayoría de los casos softfail o fail para otros dominios. | abhängig von der Konfiguration |
Déjelos activados. Comprobar tanto en el gateway como en nextxch no causa problemas; si quiere greylisting en un solo lugar, manténgalo en el gateway y desactívelo en nextxch. |
Firewall: Port 25 auf nextxch |
Tras el cambio de MX, solo el gateway puede acceder a nextxch en el puerto 25. | offen für alle |
En el firewall del host o perimetral, permita el puerto 25 solo desde 203.0.113.25 o desde la IP interna del gateway. Los puertos 465, 587, 993 y 443 permanecen abiertos para los clientes. |