Bölüm 09 Posta Taşımacılığı ve Savunma Admin: #pSmtpQueue

Öneri: nextxch'in önünde ek bir katman olarak Proxmox Mail Gateway

Ein vorgelagertes E-Mail-Gateway nimmt alle E-Mails aus dem Internet an, prüft sie mit einem zweiten, unabhängigen Antispam- und Antiviren-Engine und leitet nur saubere E-Mails an nextxch weiter. Diese Seite zeigt die Architektur, eine Schritt-für-Schritt-Einrichtung von Proxmox Mail Gateway (Open Source, AGPLv3) vor nextxch sowie die relevanten nextxch-Einstellungen.

İşlemsel İpucu ve Mimari Notu

Ağ geçidi isteğe bağlıdır: nextxch kendi spam ve virüs korumasına sahiptir. Kullanılması durumunda önem arz eden husus: ağ geçidinin IP adresini nextxch üzerinde güvenilir bir ağ geçidi olarak ekleyin (5. adım). nextxch ardından gerçek gönderen IP adresini ağ geçidinin Received üst bilgisinden okur ve ağ geçidi IP adresini denetlemek yerine SPF, DMARC, gri liste (greylisting) ve DNSBL değerlendirmesini doğru şekilde yapmaya devam eder.

Ön plandaki bir ağ geçidinin neden mantıklı olabileceği

  • Derinlemesine savunma: Kötü amaçlı bir iletinin posta kutusuna ulaşabilmesi için iki bağımsız sistemin başarısız olması gerekir. Bir üründeki zayıflık tek başına yeterli değildir.
  • İkinci e-posta koruma ve antivirüs motoru: Proxmox Mail Gateway kendi kurallarını, Bayes filtresini, SPF'yi, DNSBL'yi ve ClamAV'yi kullanır. Bir filtrenin kaçırdığını diğeri genellikle yakalar.
  • Quarantäne: Verdächtige Nachrichten werden im Gateway zurückgehalten und können von Administratoren oder Benutzern über den Spam-Bericht geprüft und freigegeben werden.
  • İnternetten soyutlama: İnternetten gelen bağlantıları 25 numaralı bağlantı noktasında yalnızca ağ geçidi kabul eder. nextxch bunun arkasında yer alır ve 25 numaralı bağlantı noktası yalnızca ağ geçidine açıktır.
  • Bakım sırasında arabelleğe alma: nextxch bir güncelleme veya bakım için kısa süreliğine erişilemez durumda olduğunda, ağ geçidi gelen mesajları kuyruğunda tutar ve sonrasında teslim eder.

Dürüst bir değerlendirme: nextxch, kendi spam koruması (uyarlamalı filtreye sahip SpamGuard, SPF/DKIM/DMARC/ARC, gri liste, DNSBL, kimlik avı sezgisel yöntemleri) ile birlikte gelir ve paralel olarak 8 adede kadar antivirüs motorunu koordine eder (Windows AMSI, YARA/Sanesecurity, Cymru MHR, MalwareBazaar, VirusTotal Hash, ClamAV, RFC 3507 ICAP, Rspamd/CLI). Çoğu kurulum için bu yeterlidir. Öndeki bir ağ geçidi isteğe bağlıdır ve daha yüksek gereksinimler için karşılığını verir: çok aşamalı filtreleme talep eden politikalar, merkezi bir karantina, bir MX arkasında birkaç posta sunucusu veya katı ağ ayrımı.

Mimari: internet -> Proxmox Mail Gateway -> nextxch

MX kaydı ağ geçidini gösterir. 25 numaralı portta postayı kabul eder, filtreler ve SMTP üzerinden nextxch'e iletir. İsteğe bağlı olarak nextxch, giden postaları ağ geçidinin 26 numaralı dahili portu üzerinden gönderir.

Mail flow with Proxmox Mail Gateway in front Inbound: internet to gateway on port 25, gateway to nextxch on port 25 with TLS. Outbound, optional: nextxch to gateway port 26, gateway to the internet on port 25. Internet Sending MTAs Recipient MX Proxmox Mail Gateway MX · port 25 external Receiver verification SPF · DNSBL · Greylisting Spam, viruses, quarantine Port 26 internal nextxch Port 25 from gateway only SpamGuard · 8-Engine-AV DKIM signing Mailboxes, groupware SMTP 25 · STARTTLS SMTP 25 · TLS Smart host · port 26 Delivery · port 25
Düz çizgi: gelen yol (gerekli). Kesikli çizgi: akıllı ana makine olarak ağ geçidinden giden yol (isteğe bağlı). Akıllı ana makine olmadan nextxch, giden postaları doğrudan DNS MX üzerinden iletmeye devam eder.

Proxmox®, Proxmox Server Solutions GmbH şirketinin tescilli ticari markasıdır. Bu ad yalnızca tanımlama amaçlı kullanılmaktadır; nextxch, Proxmox Server Solutions GmbH ile bağlantılı değildir ve bu şirket tarafından onaylanmamış veya sertifikalandırılmamıştır.

Bir bakışta kurulum

Bu sıra e-posta kaybını önler: önce ağ geçidini tamamen kurup test edin, ardından MX kaydını değiştirin ve son olarak nextxch üzerindeki 25 numaralı bağlantı noktasını kapatın.

Başvuru / Yapılandırma
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'i Kurun

Proxmox Mail Gateway bağımsız bir cihaz olarak (donanımda ISO yükleyicisi veya sanal makine olarak), mevcut bir Debian sisteminde paketler halinde veya bir LXC konteyneri olarak çalışır. Proxmox VE kullanıyorsanız, cihaz yöneticisinde kullanıma hazır bir konteyner şablonu mevcuttur. Daha sonra bunu 8006 numaralı bağlantı noktasındaki web arayüzü üzerinden yönetirsiniz.

Başvuru / Yapılandırma
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. Ağ geçidinde aktarım alan adları, varsayılan aktarım ve alıcı doğrulaması

Tüm ayarlar PMG web arayüzünde Configuration -> Mail Proxy altında yer alır. Ağ geçidi yalnızca listelenen aktarma etki alanları (relay domains) için posta kabul eder ve filtrelemeden sonra varsayılan aktarıcıya iletir.

Başvuru / Yapılandırma
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 kaydını ağ geçidine yönlendirin

Ağ geçidi üzerinden test e-postası nextxch'e ulaştıktan sonra geçiş yapın (/admin/ içinde Message Trace). Önceden MX kaydının TTL değerini birkaç dakikaya düşürün. nextxch'in kendi kayıtlarını değiştirmeyin (A/AAAA, PTR, Otomatik Keşif): istemciler doğrudan nextxch'e bağlanmaya devam eder.

Başvuru / Yapılandırma
; 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. İsteğe bağlı giden posta: nextxch içinde akıllı ana bilgisayar olarak ağ geçidi

Giden e-postalar daha sonra ağ geçidinin filtrelerinden de geçer (örn. virüs taraması, istatistikler). SMTP, Kuyruk Kontrolleri & Canlı MX Test Aracı (#pSmtpQueue) altında yönetici kokpitinde, ağ geçidini küresel akıllı ana bilgisayar (smart host) olarak girin veya yalnızca belirli göndericilerin ağ geçidinden gönderilmesi için SMTP rotalarını kullanın. Önemli: ağ geçidinin ortak IP'si etki alanlarınızın SPF kaydında olmalı ve PTR'si ağ geçidinin HELO adı ile eşleşmelidir.

Başvuru / Yapılandırma
# 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ğ geçidi IP'sini nextxch'te güvenilir olarak ekleyin

Ein E-Mail-Gateway nimmt die Nachricht selbst an und stellt sie erneut zu. Für nextxch ist die zustellende IP dann immer die Gateway-IP. Damit SPF, DMARC, Greylisting, DNSBL und die Reverse-DNS-Prüfung dennoch den echten Absender bewerten, fügen Sie das Gateway unter SpamGuard & ClamAV (#pSpam) bei „Vertrauenswürdige Gateways“ hinzu. Für Verbindungen von diesen IPs liest nextxch die Absender-IP aus dem Received-Header, den das Gateway geschrieben hat. Header werden nur für Verbindungen von gelisteten IPs ausgewertet, sodass ein direkt eineliefernder Absender seine IP auf diese Weise nicht fälschen kann. TrustedProxyCidrs (Cluster:EnableProxyProtocol) sind etwas anderes: Sie gelten nur für TCP-Proxys wie HAProxy, die das PROXY-Protokoll verwenden.

Başvuru / Yapılandırma
# 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. Her iki bacakta güvenlik duvarı ve TLS

Ana bilgisayar veya çevre güvenlik duvarında (Windows Firewall, nftables, pfSense/OPNsense) nextxch üzerindeki 25 numaralı bağlantı noktasını kapatın. nextxch IP kuralları tüm SMTP bağlantı noktalarına aynı anda uygulandığından ve bu nedenle istemcilerin 465 ve 587 numaralı bağlantı noktalarını da etkileyeceğinden bunun için uygun değildir. Her iki bacağı da şifreleyin: internet <-> ağ geçidi ve ağ geçidi <-> nextxch.

Başvuru / Yapılandırma
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 ve backscatter

Uygulamada sıklıkla gözden kaçan üç nokta. Ağ geçidi giden postayı değiştirmemelidir, gri liste tek bir yerde çalışmalıdır ve bilinmeyen alıcılar SMTP iletişim kutusu sırasında reddedilmelidir.

Başvuru / Yapılandırma
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.

91. Lisans ve maliyet (1 Kasım 2026 itibarıyla)

Proxmox Mail Gateway, GNU AGPLv3 altında açık kaynaklıdır ve abonelik olmadan tamamen kullanılabilir; güncellemeler bu durumda Proxmox'un test ve üretim dışı sistemler için amaçladığı pmg-no-subscription deposundan gelir. Proxmox'a göre barındırıcı (host) ve yıl başına bir abonelik geçerlidir, sınırsız kullanıcı ve etki alanı içerir ve kurumsal depoya erişim sağlar. Aşağıdaki fiyatlar Proxmox fiyatlandırma sayfasından alınmıştır ve değişebilir; proxmox.com her zaman yetkilidir. nextxch, Proxmox abonelikleri satmaz.

Başvuru / Yapılandırma
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)

Ayarlar, Varsayılan Değerler ve En İyi Uygulamalar

Ayar / Konum Açıklama Varsayılan Değer Üretim En İyi Uygulamaları
PMG: Relay Domains (Mail Proxy) Ağ geçidinin posta kabul ettiği ve yönlendirdiği alan adlarının listesi. Diğer alan adlarına gelen postalar reddedilir. leer Takma ad alan adları dahil olmak üzere nextxch'te yapılandırılan her alan adını ekleyin. nextxch'e bir alan adı eklediğinizde, bunu ağ geçidine de ekleyin.
PMG: Default Relay + Port (Mail Proxy -> Relaying) Filtrelemeden sonra gelen posta için hedef (Postfix aktarımı). Aktarımlar aracılığıyla etki alanı başına ek dahili sunucular. Port 25 · SMTP mail.company.com veya 10.0.0.20, bağlantı noktası 25, protokol SMTP. Kendi MX kaydına sahip bir konak adı girerseniz "MX aramasını devre dışı bırak" seçeneğini etkinleştirin.
PMG: Verify Receivers (Mail Proxy -> Options) Alıcı doğrulaması: Ağ geçidi kabul etmeden önce SMTP diyaloğu sırasında nextxch'e RCPT TO ile adresin var olup olmadığını sorar ve bilinmeyen alıcıları reddeder. aus 550 olarak ayarlayın. Ağ geçidi, daha sonra bounce etmesi gerekecek uydurma adresler için asla posta kabul etmediğinden backscatter'ı önler.
PMG: TLS + Zertifikat Ağ geçidinin gelen ve giden bağlantıları için STARTTLS. Kendi sertifikası olmayan PMG, kendi imzalı (self-signed) bir sertifika oluşturur. TLS aus TLS'yi açın, pmg.company.com için ACME (Let's Encrypt) aracılığıyla güvenilir bir sertifika edinin ve nextxch ana bilgisayarı için "encrypt" (şifrele) TLS politikası belirleyin.
PMG: Disclaimer & DKIM-Signatur Sorumluluk Reddi (Disclaimer) kural eylemi mesaja metin ekler; DKIM İmzalama ise dahili portta alınan postaları imzalar. aus İkisini de kapalı tutun. nextxch, DKIM ile imzalar; ağ geçidindeki içerikteki herhangi bir değişiklik imzayı bozar ve dolayısıyla DMARC'ı geçersiz kılar. Sadece nextxch içinde feragatnameleri koruyun (imzalamadan önce eklenir).
nextxch: Smart-Host (#pSmtpQueue · outboundSmartHost) Küresel akıllı sunucu (smart host): Tüm giden e-postalar doğrudan alıcı MX'i yerine bu aktarıcıya (relay) gider. leer (direkt per MX) · Port 25 pmg.company.com, aktarım (relay) portu 26 (ağ geçidinin dahili portu), TLS modu StartTlsRequired, SMTP AUTH yok. Ağ geçidinde nextxch IP adresi Networks altında listelenmelidir (aynı alt ağa otomatik olarak izin verilir).
nextxch: Route · SenderDomains Bir SMTP rotasının gönderen koşulu: etki alanları (company.com, *.company.com) veya adresler (billing@company.com, *@company.com). Boş = her gönderen. leer Yalnızca belirli kiracıları ağ geçidinden gönderin: hedef etki alanı * ve SenderDomains = company.com, hedef sunucu pmg.company.com:26 olan bir rota.
nextxch: Route · Priority Aynı önceliğe sahip rotalar arasında sıralama; daha küçük sayı kazanır, ardından daha spesifik kalıp geçerlidir. 100 Sıralama öncelikten önce gelir: gönderen + hedef alan adı, ardından hedef alan adı, ardından yalnızca gönderen (hedef *), ardından *, ardından küresel akıllı ana bilgisayar, ardından DNS MX.
nextxch: Route · BypassSmartHost Hedef ana bilgisayarı olmayan yollar için: Küresel bir akıllı ana bilgisayar ayarlanmış olsa bile bu etki alanına gelen postalar doğrudan DNS MX üzerinden gider. false Ağ geçidinden (gateway) geçmemesi gereken bireysel iş ortağı alan adları için. Rotanın hedef bir sunucusu varsa, bu anahtar yok sayılır.
nextxch: Vertrauenswürdige Gateways (#pSpam · trustedRelayCidrs) Yukarı akış geçitlerinin IP'leri veya CIDR ağları. Bir bağlantı buradan geldiğinde nextxch; listelenen bir geçit veya localhost tarafından yazılmamış olan en üstteki Received üstbilgisinden (header) gönderen IP'sini ve HELO'sunu alır. leer Genel ve dahili ağ geçidi IP'sini ekleyin, örn. 203.0.113.25 ve 10.0.0.25. Yalnızca kendi ağ geçitleriniz: Listelenen IP'lerden gelen Received üst bilgileri doğru kabul edilir. Spam analizörü daha sonra algılanan gönderen IP'si ile TRUSTED_RELAY kuralını gösterir.
nextxch: SPF, DKIM, DMARC & ARC, Greylisting, DNSBL (#pSpam) Listelenen ağ geçidi ile gerçek gönderen IP'sini kontrol ederler. Bu olmadan yalnızca ağ geçidi IP'sini görürler ve SPF diğer alan adları için çoğunlukla softfail veya fail döndürür. abhängig von der Konfiguration Açık bırakın. Hem ağ geçidinde hem de nextxch'te kontrol etmek zararsızdır; gri listeyi yalnızca tek bir yerde istiyorsanız ağ geçidinde tutun ve nextxch'te kapatın.
Firewall: Port 25 auf nextxch MX değişikliğinden sonra, yalnızca ağ geçidi 25 numaralı bağlantı noktasından nextxch'e erişebilir. offen für alle Ana bilgisayar veya çevre güvenlik duvarında (perimeter firewall), 25 numaralı portun yalnızca 203.0.113.25 adresinden veya dahili ağ geçidi IP adresinden gelmesine izin verin. 465, 587, 993 ve 443 numaralı portlar istemciler için açık kalır.