Batched SMTP

Batched SMTP dient dazu, Mails zunächst zu sammeln, um dann mehrere eMails auf einmal zu verschicken. Durch das Zwischenschalten von GZIP oder COMPRESS können die Nachrichten zusätzlich komprimiert werden, um den Datenduchsatz zu erhöhen.

Unter Unix gibt es folgende MTAs, die mehr oder weniger mit BSMTP umgehen können:

Sendmail

Sendmail kann auch in der Version 8.8 noch nicht direkt BSMTP. Allerdings gibt es ein Zusatzpaket von Felix Schröder, daß Sendmail um diese Möglichkeit erweitert.

BSMTP Paket konfigurieren

Nach dem Auspacken dieses Paketes konfiguriert man dieses durch den Aufruf von ./configure.

Section 1: Program paths

cc and gcc found. Preferring gcc.
path (including name) of C compiler [/usr/bin/gcc]: 
path (including name) of install [/usr/bin/install]: 
path (including name) of sh (should handle sh functions) [/bin/sh]: 
path (including name) of gzip [/usr/bin/gzip]: 
path (including name) of perl [/usr/bin/perl]: 
path (including name) of compress [/usr/bin/compress]: 
path (including name) of uux [/usr/bin/uux]: 
path (including name) of sendmail [/usr/sbin/sendmail]: 

Section 2: Compilation flags

flags for the C compiler [-O2]: 

Section 3: Installation paths

directory where private executables reside [/usr/local/libexec]: 
directory where public executables reside [/usr/local/bin]: 
directory where to install mailer description [/usr/share/sendmail/mailer]: 

Section 4: bsmtp software configuration

directory where the batch smtp queue resides [/var/spool/bsmtp]: 
owner of bsmtp queue [daemon]: 
protocol given to sendmail as parameter [bsmtp]: 

When batching, the batcher needs a way to find out the local host name.
The local hostname can be statically configured (by entering it as
answer to the following question).

Else the batcher can try to find out by using a command. This can
be given in backticks as answer to the following question.

On some systems, hostname needs an option to return the fully qualified
hostname (as on some Linux variants -f). Please don't forget to include
that here, if it is necessary on your system.

Note that the C batcher uses a heuristic technique:
if the answer to the following question begins with `hostname
it uses gethostname(2), else it uses the answer as static hostname
(even if it contains shell metacharacters. So be careful!)

Local hostname or backtick expression [`hostname`]: `hostname -f`

If the hostname found out by the batcher has no domain attached
to it, the batcher appends a default string to the hostname.
If you want none to be attached, answer 'none' (without the quotes)
here. Else choose the string to append.

Domain to append to domainless hostnames [.UUCP]: none

Section 5: sendmail version

Note: There's only a mailer description for Sendmail 8.6.x and 8.7.x
If you give another version here, no mailer description will be installed

Please enter the version number of your sendmail binary (x.y) [8.8]: 

Section 6: system configuration

There are two locking schemes for the bsmtp package.
Lockfiles: These are more portable, but are prone to stale locks
flock: This requires BSD style flock() locking, but is preferred
on systems, which support that.

Do you want to use flock() locking (true or false) [true]: 
Writing config.sed

Danach können mit make die C-Programme erstellt und übersetzt werden. Tritt dabei kein Fehler auf, wird die Installation der Dateien mit make install abgeschlossen.

Sendmail anpassen

Je nachdem, ob man das Sendmail-System selber konfiguriert hat oder eine vorkonfigurierte Version benutzt, gestaltet sich der Vorgang schwieriger oder leichter.

Zunächst sollte man die Regeln für den BSMTP-Empfang einarbeiten, indem man eine seine sendmail.cf erzeugt. Diese sollte dann einen Abschnitt mit der BSMTP Mailer specification enthalten.

Um auch selber BSMTP zum Versenden zu nutzen, gibt man als Smart-Host zum Beispiel bsmtp:netserv an. In der SuSE-Linux-Distribution genügt es, in der Datei /etc/rc.config den Eintrag SENDMAIL_SMARTHOST="bsmtp:netserv" anzupassen und SuSEconfig aufzurufen.

Batches erzeugen

Bis jetzt werden die eMails nur in /var/spool/bsmtp gesammelt. Um die Nachrichten zu verschicken, müssen diese noch mit den nötigen Kommandozeilen versehen werden. Dazu ruft man das Programm /usr/local/libexec/batcher g-rgsmtp netserv auf, daß in diesem Fall alle Nachrichten, die über Netserv verschickt werden, mit gzip packt und diese an uux übergibt, um den Job zu starten. Der Aufruf kann entweder als Cron-Job in regelmäßigen Abständen automatisch ausgeführt werden oder aber vor jedem Netcall manuell oder per Script getätigt werden.

Eine elegante Möglichkeit besteht darin, den Batchvorgang direkt von uucico ausführen zu lassen. Dazu ergänzt man in der Taylor-Konfiguration /etc/uucp/sys folgende Zeilen:

system netserv
called-chat-program     /usr/lib/bsmtp/sbsmtp netserv
chat-program            /usr/lib/bsmtp/sbsmtp netserv

Smail

Smail wurde für die direkte Zusammenarbeit mit UUCP entwickelt und kann schon von Haus aus mit BSMTP umgehen. Wie die Konfiguration im einzelnen funktioniert, kann man z.B. im Buch UUCP - Mail und News von Michael Brunnbauer, Pflaum Verlag, ISBN 3-7905-1506-X nachgelesen werden.

Qmail

Qmail ist ein relativ neuer MTA, für den es ein Zusatzpaket gibt, um auch BSMTP nutzen zu können. Wie die Konfiguration im einzelnen Funktioniert, ist mir leider nicht bekannt.

Postfix

Postfix, früher bekannt als VMailer, ist ein schneller und modularer MTA, der weitestgehend zu sendmail kompatibel ist, was Programmaufrufe betrifft. Die Konfigurationsdateien sind jedoch wesentlich übersichtlicher und besser zu konfigurieren. Die Vorgehensweise ist wie folgt:

In /etc/postfix/master.cf ergänzt man den neuen Transportmechanismus bsmtp:

bsmtp   unix  -       n       n       -       -       pipe
        flags=F user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender $recipient

Ist BSMTP die einzige Methode zum Versenden von Mails (zum Beispiel auf einem Arbeitsplatzrechner), so genügt das setzen von folgender Optionen in /etc/postfix/main.cf:

default_transport = bsmtp
relayhost = netserv

Auf einem Gateway-Rechner fügt man stattdessen in /etc/postfix/transport folgende Zeile hinzu:

host.lahn.de    bsmtp:netserv

Debian

In der GNU/Debian Linux Distribution ist das Packet bsmtpd bereits vorhanden und enthält weitere Informationen zur Konfiguration von BSMTP.

Links