#pSmtpQueue
推奨: nextxch の前段に追加レイヤーとして Proxmox Mail Gateway を配置
前段に置くメール ゲートウェイは、インターネットからのすべてのメールを受け取り、独立した 2 つ目のスパム対策およびウイルス対策エンジンでチェックし、クリーンなメールだけを nextxch に転送します。このページでは、アーキテクチャ、nextxch の前段に Proxmox Mail Gateway (オープンソース、AGPLv3) を置くステップ バイ ステップの設定手順、重要な nextxch 側の設定を紹介します。
ゲートウェイはオプションです: nextxch には独自のスパム対策とウイルス対策があります。使用する場合に重要な点: nextxch でゲートウェイの IP を信頼済みゲートウェイとして追加してください (ステップ 5)。これにより nextxch はゲートウェイの Received ヘッダーから実際の送信者 IP を読み取り、ゲートウェイの IP をチェックするのではなく、SPF、DMARC、グレーリスト、DNSBL を引き続き正しく評価します。
前段にゲートウェイを置くことが有効な理由
- 多層防御: 悪意のあるメッセージがメールボックスに届くには、2 つの独立したシステムの両方が失敗する必要があります。1 つの製品の弱点だけでは突破されません。
- 2 つ目のスパム対策・ウイルス対策エンジン: Proxmox Mail Gateway は独自のルール、ベイジアン フィルター、SPF、DNSBL、ClamAV を使用します。一方のフィルターが見逃したものを、もう一方が捕捉することもよくあります。
- 検疫: 不審なメッセージはゲートウェイに保留され、管理者またはユーザーがスパム レポートから確認して解放できます。
- インターネットからの分離: インターネットからのポート 25 の接続を受け付けるのはゲートウェイのみです。nextxch はその背後に配置され、ポート 25 はゲートウェイに対してのみ開放されます。
- メンテナンス中のバッファリング: 更新やメンテナンスのために nextxch が一時的に利用できない場合、ゲートウェイが受信メッセージをキューに保持し、後で配信します。
率直な評価: nextxch には独自のスパム対策 (適応型フィルターを備えた SpamGuard、SPF/DKIM/DMARC/ARC、グレーリスト、DNSBL、フィッシング ヒューリスティック) が付属し、ClamAV を統合しています。ほとんどの環境ではこれで十分です。前段のゲートウェイはオプションで、要件が高い場合に効果を発揮します: 多段階フィルタリングを求めるポリシー、一元的な検疫、1 つの MX の背後に複数のメール サーバーがある構成、厳格なネットワーク分離などです。
アーキテクチャ: インターネット -> Proxmox Mail Gateway -> nextxch
MX レコードはゲートウェイを指します。ゲートウェイはポート 25 でメールを受け付けてフィルタリングし、SMTP で nextxch に転送します。オプションで、nextxch は送信メールをゲートウェイの内部ポート 26 経由で送信できます。
Proxmox® は Proxmox Server Solutions GmbH の登録商標です。この名称は説明目的でのみ使用しています。nextxch は Proxmox Server Solutions GmbH と提携関係になく、同社による推奨や認定も受けていません。
セットアップの概要
この順序でメールの消失を防ぎます: まずゲートウェイを完全にセットアップしてテストし、次に MX レコードを切り替え、最後に nextxch のポート 25 を閉じます。
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. Proxmox Mail Gateway をインストール
Proxmox Mail Gateway は、スタンドアロン アプライアンス (ハードウェアまたは VM 上の ISO インストーラー)、既存の Debian システム上のパッケージ、または LXC コンテナーとして動作します。Proxmox VE を使用している場合は、アプライアンス マネージャーで既製のコンテナー テンプレートを利用できます。導入後は、ポート 8006 の Web インターフェイスで管理します。
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. ゲートウェイでのリレー ドメイン、既定のリレー、受信者検証
すべての設定は PMG の Web インターフェイスの [Configuration] -> [Mail Proxy] にあります。ゲートウェイは登録されたリレー ドメイン宛てのメールのみを受け付け、フィルタリング後に既定のリレーに渡します。
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. MX レコードをゲートウェイに切り替える
ゲートウェイ経由のテスト メッセージが nextxch に届いたことを確認してから (/admin/ のメッセージ トレース) 切り替えてください。事前に MX レコードの TTL を数分に下げておきます。nextxch 自体のレコード (A/AAAA、PTR、Autodiscover) は変更しないでください。クライアントは引き続き 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. 任意の送信設定: nextxch でゲートウェイをスマート ホストに
送信メールもゲートウェイのフィルター (例: ウイルス スキャン、統計) を通過するようになります。管理コックピットの [SMTP、キュー制御とライブ MX テスター] (#pSmtpQueue) で、ゲートウェイをグローバル スマート ホストとして入力するか、SMTP ルートを使って特定の送信者のみをゲートウェイ経由で送信します。重要: その場合、ゲートウェイのパブリック IP をドメインの SPF レコードに含め、その PTR をゲートウェイの HELO 名と一致させる必要があります。
# 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. nextxch でゲートウェイ IP を信頼済みとして追加
メール ゲートウェイはメッセージ自体を受け取り、改めて配信します。そのため nextxch から見ると、配信元 IP は常にゲートウェイの IP になります。SPF、DMARC、グレーリスト、DNSBL、逆引き DNS チェックが引き続き実際の送信者を判定できるよう、SpamGuard & ClamAV (#pSpam) の "信頼済みゲートウェイ" にゲートウェイを追加してください。これらの IP からの接続について、nextxch はゲートウェイが書き込んだ Received ヘッダーから送信者 IP を読み取ります。ヘッダーが評価されるのは登録済み IP からの接続のみなので、直接配信する送信者がこの方法で IP を偽装することはできません。TrustedProxyCidrs (Cluster:EnableProxyProtocol) は別物で、PROXY プロトコルを使用する HAProxy などの TCP プロキシにのみ適用されます。
# 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. 両方の経路でのファイアウォールと TLS
ホストまたは境界ファイアウォール (Windows ファイアウォール、nftables、pfSense/OPNsense) で nextxch のポート 25 を閉じてください。nextxch の IP ルールはすべての SMTP ポートにまとめて適用され、クライアントが使う 465 と 587 にも影響するため、この用途には適していません。インターネット <-> ゲートウェイ間、ゲートウェイ <-> 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、グレーリスト、バックスキャッター
実務で見落とされがちな 3 つのポイントです。ゲートウェイは送信メールを変更してはならず、グレーリストは 1 か所でのみ実行し、不明な受信者は 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. ライセンスとコスト (2026 年 11 月 1 日時点)
Proxmox Mail Gateway は GNU AGPLv3 のオープンソースで、サブスクリプションなしでもすべての機能を利用できます。その場合、更新は pmg-no-subscription リポジトリから提供されますが、Proxmox はこれをテスト用および非本番システム向けとしています。サブスクリプションはホストごと・年ごとに適用され、Proxmox によるとユーザー数とドメイン数は無制限で、エンタープライズ リポジトリにアクセスできます。以下の価格は Proxmox の価格ページによるもので、変更される場合があります。常に proxmox.com の情報が正となります。nextxch は 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)
設定、既定値 & ベスト プラクティス
| 設定 / 場所 | 説明 | 既定値 | 本番環境のベスト プラクティス |
|---|---|---|---|
PMG: Relay Domains (Mail Proxy) |
ゲートウェイがメールを受け付けて転送するドメインの一覧。その他のドメイン宛てのメールは拒否されます。 | leer |
エイリアス ドメインを含め、nextxch で構成されているすべてのドメインを追加してください。nextxch にドメインを追加したら、ゲートウェイにも追加してください。 |
PMG: Default Relay + Port (Mail Proxy -> Relaying) |
フィルタリング後の受信メールの配送先 (Postfix トランスポート)。ドメインごとの追加の社内サーバーは Transports で指定します。 | Port 25 · SMTP |
mail.company.com または 10.0.0.20、ポート 25、プロトコル SMTP。独自の MX レコードを持つホスト名を入力する場合は、"Disable MX lookup" を有効にしてください。 |
PMG: Verify Receivers (Mail Proxy -> Options) |
受信者検証: ゲートウェイは受け付ける前に RCPT TO で nextxch にアドレスが存在するかを問い合わせ、不明な受信者を SMTP ダイアログ中に拒否します。 | aus |
550 に設定します。ゲートウェイが架空のアドレス宛てのメールを受け入れて後でバウンスする必要がなくなるため、バックスキャッターを防止します。 |
PMG: TLS + Zertifikat |
ゲートウェイの受信接続と送信接続に STARTTLS を使用します。独自の証明書がない場合、PMG は自己署名証明書を生成します。 | TLS aus |
TLS をオンにし、pmg.company.com 用の信頼された証明書を ACME (Let's Encrypt) で取得し、nextxch ホストに対して TLS ポリシー "encrypt" を設定します。 |
PMG: Disclaimer & DKIM-Signatur |
ルール アクションの Disclaimer は本文にテキストを追加します。DKIM Signing は内部ポートで受信したメールに署名します。 | aus |
両方ともオフのままにしてください。nextxch は DKIM で署名します。ゲートウェイで内容を変更すると署名が壊れ、その結果 DMARC も失敗します。免責事項は nextxch でのみ管理してください (署名の前に追加されます)。 |
nextxch: Smart-Host (#pSmtpQueue · outboundSmartHost) |
グローバル スマート ホスト: すべての送信メールは、受信者の MX に直接ではなく、このリレーに送られます。 | leer (direkt per MX) · Port 25 |
pmg.company.com、リレー ポート 26 (ゲートウェイの内部ポート)、TLS モード StartTlsRequired、SMTP AUTH なし。ゲートウェイ側では、nextxch の IP を Networks に登録する必要があります (同じサブネットは自動的に許可されます)。 |
nextxch: Route · SenderDomains |
SMTP ルートの送信者条件: ドメイン (company.com、*.company.com) またはアドレス (billing@company.com、*@company.com)。空 = すべての送信者。 | leer |
特定のテナントだけをゲートウェイ経由で送信する: 宛先ドメイン * と SenderDomains = company.com、ターゲット ホスト pmg.company.com:26 のルートを作成します。 |
nextxch: Route · Priority |
同じランクのルート間での順序。数値が小さいほうが優先され、次により具体的なパターンが優先されます。 | 100 |
ランクは優先度より優先されます: 送信者 + 宛先ドメイン、次に宛先ドメイン、次に送信者のみ (宛先 *)、次に *、次にグローバル スマート ホスト、最後に DNS MX。 |
nextxch: Route · BypassSmartHost |
ターゲット ホストのないルートのみ: グローバル スマート ホストが設定されていても、このドメイン宛てのメールは DNS MX 経由で直接配信されます。 | false |
ゲートウェイを経由させない個別のパートナー ドメイン向けです。ルートにターゲット ホストがある場合、このスイッチは無視されます。 |
nextxch: Vertrauenswürdige Gateways (#pSpam · trustedRelayCidrs) |
上流ゲートウェイの IP または CIDR ネットワーク。そこからの接続の場合、nextxch は登録済みゲートウェイや localhost が書き込んだものではない最上位の Received ヘッダーから、送信者 IP と HELO を取得します。 | leer |
公開 IP と内部 IP のゲートウェイ アドレスを追加します (例: 203.0.113.25 と 10.0.0.25)。自社のゲートウェイのみを登録してください。登録した IP からの Received ヘッダーは信頼できるものとして扱われます。スパム アナライザーには、検出された送信者 IP とともにルール TRUSTED_RELAY が表示されます。 |
nextxch: SPF, DKIM, DMARC & ARC, Greylisting, DNSBL (#pSpam) |
ゲートウェイが登録されていれば、実際の送信元 IP がチェックされます。登録されていない場合はゲートウェイの IP しか見えず、他のドメインでは SPF の結果がほとんど softfail または fail になります。 | abhängig von der Konfiguration |
有効のままにしてください。ゲートウェイと nextxch の両方でチェックしても問題ありません。グレーリストを 1 か所だけにしたい場合は、ゲートウェイ側で有効にし、nextxch 側で無効にします。 |
Firewall: Port 25 auf nextxch |
MX の切り替え後は、ポート 25 で nextxch に到達できるのはゲートウェイのみとします。 | offen für alle |
ホストまたは境界ファイアウォールで、ポート 25 は 203.0.113.25 または内部ゲートウェイ IP からのみ許可してください。ポート 465、587、993、443 はクライアント向けに開いたままにします。 |