Revert "Translate all posts to German with personal blog style"
Build & Deploy / deploy (push) Successful in 27s

This reverts commit cc7ba433d4.
This commit is contained in:
2026-06-06 19:27:10 +02:00
parent cc7ba433d4
commit 057a61a14c
5 changed files with 184 additions and 149 deletions
+77 -49
View File
@@ -1,98 +1,126 @@
+++
date = '2025-08-01T10:03:15+02:00'
draft = false
title = 'Backscatter ade: Ungültige Empfänger vor dem Exchange abfangen'
title = 'Blocking Invalid Recipients Before They Reach Your Exchange Server'
[cover]
image = "/imgs/email-route.jpg"
alt = "E-Mail App Icon auf blauem Hintergrund"
alt = "Email App icon on blue background"
caption = ""
+++
Neulich hatte ich ein richtig fieses Problem: **Backscatter**. Einer unserer Mail-Gateways landete auf der **backscatter.org**-Blacklist, weil wir Bounce-Nachrichten an gefälschte Absender geschickt haben. Ja, genau so läuft das: man will ja eigentlich nur Mails zustellen und plötzlich ist man selber der Spammer.
Recently, I had to deal with a serious problem: **backscatter**.
One of our mail gateways ended up listed on the **backscatter.org** blacklist for sending bounce messages to forged senders.
Nach einem Blick in die Logs war mir klar: Unser System war gegen Backscatter-Attacken so gut geschützt wie ein Fahrradschloss aus Pappe. Also musste was passieren.
After checking the logs, I quickly realized that our system wasn't actually protected against backscatter attacks, so I had to do something about it.
## Was zur Hölle ist Backscatter?
Backscatter ist Müll, den dein Mail-Server **verschickt, nachdem** er eine Nachricht angenommen hat meistens in Form eines **Non-Delivery Reports (NDR)** oder Bounces an eine **gefälschte Absenderadresse**.
Passiert so:
## What Even Is Backscatter?
- Ein Spammer schickt 'ne Mail mit ner **fake "Von"-Adresse** (oft von nem armen Unschuldigen).
- Dein Server **nimmt die Mail an**, stellt aber später fest: "Hoppla, den Empfänger gibt's gar nicht."
- Dein Server schickt nen **Bounce** an die gefälschte Absenderadresse und trifft damit den Falschen.
Backscatter is unwanted email that your mail server sends **after** receiving a message, usually in the form of a **non-delivery report (NDR)** or **bounce** to a **forged sender address**.
Und Zack, dein Server versendet Spam, ohne es zu wollen. Willkommen im Club.
It happens when:
## Das Problem bei uns
- A spammer sends email with a **fake "From" address** (often an innocent third party).
- Your mail server **accepts** the message first, but later discovers its undeliverable.
- Your server sends a **bounce** to the forged address, hitting an innocent person instead of the spammer.
Unser Mail-Gateway leitet hauptsächlich Mails an mehrere interne Exchange-Cluster weiter. Klar, wir haben eine Liste mit gültigen Domains Postfix nimmt nur Mail für diese Domains an.
This makes your server appear to be sending spam, even though you're just bouncing bad mail.
**Das Problem?** Postfix wusste nicht, welche einzelnen Empfänger auf den Exchange-Servern gültig sind. Also hat es fröhlich Mails für **nicht existierende Benutzer** angenommen, um sie dann später zu bouncen. Klassischer Backscatter.
## Das Ziel
Wir wollten Mails **während der SMTP-Session** ablehnen idealerweise direkt nach dem `RCPT TO`-Befehl, wenn der Empfänger auf dem Exchange nicht existiert.
## The Problem in Our Setup
Dann kriegt der Sender sofort einen Korb und wir müssen erst gar keinen Bounce generieren. Win-Win.
Our mail gateway mostly relays mail to multiple internal Exchange Server clusters.
We have a list of valid domains configured, so Postfix will only accept mail for those domains.
## Mögliche Lösungen (und warum ich sie verworfen hab)
**The problem?**
Postfix didn't know which individual recipients were valid on the downstream Exchange servers.
That meant it would happily accept messages for **nonexistent users**, only to later bounce them, classic backscatter behavior.
## The Goal
We needed to reject mail **during the SMTP session**, ideally right after the `RCPT TO` command, if the recipient didn't exist on the Exchange servers.
That way, the sending server would get the rejection immediately, and we would never have to generate a bounce message.
## Possible Solutions I Considered
### **1. relay_recipient_maps**
Dafür hätte ich ne **komplette Liste aller gültigen Empfänger** in Postfix pflegen müssen. Klar, geht. Aber dann müsste ich ein Skript schreiben, das die Liste regelmäßig aus Active Directory synchronisiert.
This would require maintaining a **full list of valid recipients** in a Postfix lookup table.
It works well, but means writing and maintaining a script to **sync the list from Active Directory** on a regular basis.
Für uns war das zu viel Gefrickel, zu fehleranfällig und zu nervig zu warten.
For us, this was too much custom scripting, too fragile, and too messy to maintain.
### **2. virtual_mailbox_maps mit LDAP**
LDAP-Lookups direkt gegen Active Directory, um Empfänger in Echtzeit zu prüfen. Klingt erstmal gut, aber:
- Mehr Komplexität und Abhängigkeiten.
- Potenzielle Sicherheitsrisiken.
- Hat nicht so richtig in unsere Umgebung gepasst.
Also auch gestrichen.
### **2. virtual_mailbox_maps with LDAP**
Another approach would be using **LDAP lookups** directly against Active Directory to verify recipients in real-time.
## Die Lösung: `reject_unverified_recipient`
This can work in some setups, but:
- It adds complexity and dependencies.
- It can introduce security concerns.
- It didnt fit well with our environment.
Beim Durchlesen der **Postfix Address Verification Howto** bin ich über `reject_unverified_recipient` gestolpert und dachte sofort: "Digga, genau das brauch ich!"
So I ruled it out.
### **Wie es funktioniert**
Wenn ne eingehende SMTP-Session die `RCPT TO`-Phase erreicht:
1. Postfix checkt, ob `reject_unverified_recipient` für die Empfängerdomäne aktiv ist.
2. Wenn ja, wird kurz **beim downstream Mail-System angefragt**, ob die Adresse existiert.
3. Antwort vom downstream System:
- **User existiert** → Postfix macht weiter.
- **User existiert nicht** → Postfix **lehnt sofort ab** mit:
## The Solution: `reject_unverified_recipient`
While reading through the **Postfix Address Verification Howto**, I came across the `reject_unverified_recipient` option - bling! - exactly what I needed.
### **How It Works**
When an incoming SMTP session reaches the `RCPT TO` stage:
1. Postfix checks if `reject_unverified_recipient` is enabled for the recipient domain.
2. If yes, it temporarily **probes the downstream mail system** to see if the recipient address exists.
3. If the downstream system says:
- **User exists** → Postfix continues processing.
- **User does not exist** → Postfix **rejects immediately** with:
```
550 5.1.1 <user@example.de>: Recipient address rejected: User unknown
```
Weil die Ablehnung **während des SMTP-Dialogs** passiert, wird gar kein Bounce generiert. Backscatter ade!
Because the rejection happens **during SMTP**, no bounce is generated, and backscatter is avoided entirely.
## Umsetzung in ISPConfig
Bei uns laufen die Mail-Gateways mit **Postfix** und **ISPConfig** als Verwaltungsoberfläche. Also hab ich ne neue Konfigurationsoption in ISPConfig eingebaut, mit der man `reject_unverified_recipient** **pro Domain** steuern kann plus einen **Validation Server** für den downstream-Server.
## Implementation in ISPConfig
### Validation Server für die Empfängerprüfung
In our case, the mail gateways run **Postfix** with **ISPConfig** as the management interface.
I implemented a new configuration option in ISPConfig for **per-domain control** of `reject_unverified_recipient`, along with a **validation server** to specify for the downstream validation server.
Wichtiges Detail: Exchange-Server können standardmäßig keine Empfänger über SMTP-Port `25` validieren. Man muss die Funktion erst auf dem Exchange aktivieren und den Hub Transport Service nutzen der läuft standardmäßig auf Port `2525`.
### Specifying a Validation Server for Recipient Verification
Unbedingt den Zugriff auf diesen Port einschränken! Der erlaubt nämlich anonyme Logins für die Empfängervalidierung das will man nicht in der freien Wildbahn haben.
One important detail is that Exchange servers cannot validate recipients over the default SMTP transport on port `25`. To enable recipient validation, you need to activate it on the Exchange server and use the Hub Transport service, which by default runs on port `2525`.
> **Achtung:** Das ändert nichts an deinem normalen Mail-Flow. Nur die SMTP-Probes für die Empfängerprüfung gehen an diesen Validation Server.
> Postfix macht das mit der `address_verify_transport_maps`-Option.
Make sure to restrict access to this port, as it requires anonymous login specifically for recipient validation, you don't want that exposed broadly.
Für die Performance hab ich noch nen lokalen Cache auf dem Gateway eingerichtet (`address_verify_map`), damit nicht ständig dieselben Empfänger neu geprüft werden. Spart Nerven und Resourcen.
> **Note:** This setup does not affect your regular mail flow. Only the SMTP probes used for verifying recipients are sent to this validation server.
> Postfix enables this behavior with the `address_verify_transport_maps` option.
Jetzt können wir für alle Domains, die eine Empfängerprüfung brauchen, das Ding im Panel anschalten und Postfix ans richtige **Validation Transport** schicken.
To optimize performance and reduce unnecessary verification probes for addresses that have already been checked, I configured a local cache on the mail gateway using the `address_verify_map` option. This way, repeated probes for the same recipient are avoided.
## Das Ergebnis
Now, for domains that need recipient verification, we can enable it in the panel and point Postfix to the appropriate **validation transport**.
Seit `reject_unverified_recipient` aktiv ist und auf die Exchange-Cluster zeigt, ist der Backscatter komplett weg. Wir nehmen keine Mails mehr für ungültige Empfänger an. Feierabend.
## Fazit
## The Result
After enabling `reject_unverified_recipient` and pointing it at the Exchange clusters, the backscatter stopped completely.
We were no longer accepting messages for invalid recipients.
## Conclusion
If your Postfix server is acting as a relay for Exchange (or any downstream mail system) and you're struggling with **backscatter spam**, enabling `reject_unverified_recipient` can be a clean and effective fix.
It avoids maintaining large static recipient maps, works dynamically, and ensures that invalid mail is rejected **before** it ever gets into your system.
Wenn dein Postfix als Relay für Exchange (oder ein anderes downstream-Mail-System) läuft und du **Backscatter-Spam** loswerden willst: `reject_unverified_recipient` ist der Weg. Sauber, dynamisch, keine großen statischen Listen und vor allem: die Drecksmail kommt erst gar nicht rein.