Postfix je efektivní a na funkce bohatý poštovní server, který navrhl Wietse Venema v IBM T.J. Watson Research Center. Mělo to být náhrada za populární sendmail. Zatímco Sendmail byl po mnoho let nejoblíbenějším poštovním serverem, popularita Postfixu pravděpodobně vzrostla nad rámec Sendmailu, a to díky jeho jednoduché konfiguraci, historicky bezpečné implementaci a vysoce výkonné architektuře. Protože je Postfix navržen tak, aby se navenek choval jako sendmail, jde většinou o náhradu staršího, většího a pomalejšího poštovního serveru. Postrádá některé nejasné funkce sendmailu, ale funkce, které postrádá, používá velká většina uživatelů jen zřídka, takže je často nezmeškáte. A má některé další vlastní funkce, které na jiných poštovních serverech nenajdete.
- Postfix Mail Server
Projekt Postfix, původně pojmenovaný VMailer (naštěstí pro všechny, název byl před vydáním změněn kvůli právním zapletením názvu VMailer), je navržen jako skupina souvisejících, ale samostatných spustitelných komponent, které poskytují bezpečnost prostřednictvím segmentace. Menší části se také snáze ladí. Internetový domov Postfixu je www.postfix.org. Postfix je ideální volbou poštovního serveru pro nové správce pošty a dokonce i zkušení správci Sendmailu mohou považovat jeho jednoduchost za přitažlivou. Protože poskytuje docela kompatibilní exteriér typu Sendmail a poskytuje programy se stejnými názvy (např. sendmail
pro odesílání pošty mailq
pro správu fronty atd.) a může využívat stejný typ aliasů a přeposílání souborů, které používá Sendmail, je možné nahradit Sendmail bez překonfigurování stávajících nástrojů souvisejících s poštou nebo přepisování lokálních skriptů. Po takovémto přepnutí si místní uživatelé ani nemusí všimnout rozdílu.
Obsah
Obecné možnosti
Obecné možnosti stránka konfiguruje řadu voleb týkajících se obecného chování Postfixu. Konkrétně se zde konfiguruje většina možností konfigurace, které ovlivňují všechny uživatele a všechny zprávy. Postfix, v souladu se svou filozofií jednoduchosti, obvykle vyžaduje pouze několik změn konfiguračního souboru, aby poštovní server fungoval efektivně a bezpečně.
Obecné možnosti stránka je rozdělena na dvě části. Horní část je označena Nejužitečnější obecné možnosti a ve spodní části Další obecné možnosti . V mnoha standardních instalacích může být možné spustit instalaci Postfixu pouze konfigurací jedné nebo více ze tří direktiv v horní části. Pokud není uvedeno jinak, všechny možnosti na této stránce odpovídají příkazům v main.cf
soubor v konfiguračním adresáři Postfixu.
Nejužitečnější obecné možnosti
Tři možnosti v této části jsou v některých instalacích jediné možnosti, které je třeba změnit, aby Postfix běžel pro odesílání i přijímání e-mailů.
- Nejužitečnější obecné možnosti
- Jakou doménu použít pro odchozí poštu
- Zde můžete zadat název domény nebo hostitele, který se má použít k identifikaci zdroje odchozí pošty. Postfix standardně používá název hostitele serveru, ale pravděpodobně budete chtít, aby místo toho identifikoval poštu jako poštu z názvu vaší domény. Pokud váš poštovní server bude přijímat poštu pro velký počet uživatelů pod jedním názvem domény, s největší pravděpodobností zde nakonfigurujete název domény a vytvoříte databázi aliasů pro celou doménu pro mapování uživatelských jmen na jejich příslušné místní poštovní servery. Tato možnost koreluje s
myorigin
Direktiva Postfix. - Pro jakou doménu chcete přijímat poštu
- Tato možnost přijímá seznam domén a adres pro příjem pošty jako konečné místo určení. Jinými slovy, když pošta dorazí na server určený pro adresy v tomto poli, doručí poštu místnímu uživateli, místo aby ji přeposlala na jiný poštovní server. Ve výchozím nastavení se jedná o všechny nakonfigurované adresy na počítači a také
localhost
v rámci lokální domény. Můžete zadat libovolný počet domén nebo názvů hostitelů oddělených čárkami nebo můžete poskytnout úplnou cestu k souboru obsahujícímu podobné položky. Proměnné$myhostname
a$mydomain
mohou být použity k automatické reprezentaci těchto konceptů pro Postfix. Schopnost Postfixu používat takové proměnné ve svých konfiguračních souborech usnadňuje údržbu řady Postfixových serverů s velmi podobnými konfiguracemi. Tato možnost koreluje smydestination
směrnice. - Jaké potíže nahlásit vedoucímu pošty
- Postfix poskytuje možnost vybrat, jaké typy chybových zpráv budou zaslány určenému postmasterovi poštovního serveru. Za předpokladu, že jste nastavili
postmaster
alias, který přesměrovává poštu skutečné osobě, bude Postfix posílat zprávy o všech typech problémů zde uvedených. Dostupné třídy jsou:-
bounce
- Když je vybrána tato možnost, vždy, když je zpráva nedoručitelná, zobrazí se vrácená zpráva (tzv. jedna vrácená zpráva bude zasláno odesílateli zprávy a místnímu poštmistrovi. Z důvodu ochrany soukromí budou ve zprávě poštmistrovi zaslány pouze hlavičky. Pokud je první vrácené oznámení odesílateli vráceno jako nedoručitelné, zobrazí se zpráva s dvojitým nedoručením bude zasláno poštmistrovi s celým obsahem první jediné vrácené zprávy.
-
2bounce
- Způsobí, že zprávy s dvojitým nedoručením budou odeslány vedoucímu pošty.
-
delay
- Pokud je doručení zprávy zpožděno, poštmistr obdrží upozornění spolu s hlavičkami zpožděné zprávy.
-
policy
- Upozorňuje správce pošty na zprávy, které byly odmítnuty kvůli omezením zásad nevyžádaných komerčních e-mailů. Odešle se úplný přepis relace SMTP.
-
protocol
- Upozorňuje správce pošty na chyby protokolu nebo požadavky klientů, které obsahovaly neimplementované příkazy. Úplný přepis relace SMTP je součástí zprávy.
-
resource
- Informuje správce pošty o nedoručené poště kvůli problémům se zdroji, jako je chyba zápisu do souboru ve frontě.
-
software
- Upozorňuje správce pošty na poštu, která nebyla doručena z důvodu selhání softwaru.
-
Tato možnost koreluje s notify_classes
a ve výchozím nastavení hlásí pouze problémy, které obvykle naznačují nesprávnou konfiguraci nebo vážný problém (konkrétně resource
a software
). V některých prostředích s vysokou zátěží může změna tohoto nastavení tak, aby zahrnovala oznámení o nedoručení, vést k velkému počtu oznámení. Tuto možnost je potřeba měnit jen zřídka, s výjimkou odstraňování problémů..
Další obecné možnosti
Spodní část této stránky je věnována globálním možnostem, u kterých je méně pravděpodobné, že bude potřeba je měnit. V mnoha instalacích zůstanou tyto možnosti ve výchozím nastavení.
- Další obecné možnosti
- Odesílat odchozí poštu přes
- Tato možnost nastavuje, zda má být odchozí pošta doručována přímo na poštovní server příjemce, nebo zda má být jako prostředník použita nadřazená poštovní brána. Pokud je server za firewallem, za síťovou adresou překládající směrovač/bránu nebo podobně, může být nutné použít zprostředkující server k dosažení spolehlivé služby. Mnoho poštovních serverů na internetu nepřijme poštu ze serveru, který nemá funkční záznam DNS a směrovatelnou IP adresu, aby se zabránilo spamu z padělaných adres. Zásady používání místní sítě mohou také vyžadovat použití prostředníka pro protokolování, skenování virů nebo jiné účely, které vyžadují agregaci odchozí pošty na centrální server. Tato možnost odpovídá
relayhost
a výchozím nastavením je odesílání pošty přímo na poštovní server označený záznamem MX (mail exchanger) pro cílovou doménu. - Adresa, která přijímá skrytou kopii každé zprávy
- S touto volbou lze zadat volitelnou e-mailovou adresu, která bude dostávat kopii každé zprávy, která vstoupí do systému Postfix, s výjimkou místně generovaných vrácených zpráv. To může za mnoha okolností představovat porušení soukromí a v některých zemích to může být nezákonné. Při využívání této možnosti je vhodné být obzvláště obezřetný. Může to být užitečné v některých prostředích, kde je centrální archivace e-mailů cenná z právních nebo technických důvodů. Tato možnost koreluje s
always_bcc
direktiva a výchozí hodnota je žádná. - Časový limit pro zpracování požadavků
- Tato volba určuje, jak dlouho bude démon Postfixu čekat na dokončení požadavku, než bude předpokládat, že se démon zablokoval, v tu chvíli bude démon zabit. Tato možnost odpovídá
daemon_timeout
a výchozí hodnota je 18 000 sekund. - Výchozí typ databáze
- Tato možnost určuje typ databáze, která se má použít v
postalias
apostmap
příkazy. Tato možnost odpovídádefault_database_type
a výchozí nastavení závisí na OS a nainstalovaných systémových knihovnách v době sestavování Postfixu. Obvykle na systémech UNIX to budehash
nebodbm
. - Výchozí přenos doručování zpráv
- Termín doručovací doprava odkazuje na protokol nebo jazyk používaný k doručení zprávy z jednoho poštovního serveru na druhý. Přenos na moderních systémech je téměř vždy
smtp
a toto je výchozí nastavení v Postfixu, ale stále existuje několik staršíchuucp
používané systémy. Tato možnost je pouze výchozí volbou, pokud není ve volitelné přepravní tabulce explicitně vybrána žádná přeprava pro cíl. Tato možnost odpovídádefault_transport
směrnice. - Adresa odesílatele pro nedoručenou poštu
- V případě, že se zpráva vrátí dvakrát nebo se nejprve vrátí od příjemce a poté se vrátí od odesílatele, když je odesláno první oznámení o nedoručení, bude zpráva odeslána na tuto adresu. Všechny zprávy na tuto adresu budou tiše zahozeny. Tímto způsobem se lze vyhnout odrazovým smyčkám. Tato možnost koreluje s
double_bounce_sender
a výchozí jedouble-bounce
. Název může být libovolný, ale musí být jedinečný. - Počet úrovní podadresáře pod adresářem fronty
- Tato volba konfiguruje počet úrovní podadresářů pod nakonfigurovanými adresáři fronty, které bude Postfix používat pro ukládání pošty. Kvůli návrhu tradičního souborového systému UNIX, který zahrnuje UFS používaný některými staršími BSD a některými dalšími staršími souborovými systémy UNIX, se výkon znatelně zpomalí, když je v jednom adresáři uložen extrémně velký počet souborů. Programy, které generují velké množství souborů, tedy často poskytují možnost rozdělit soubory do několika podadresářů, aby bylo vyhledávání rychlé. Tato možnost koreluje s
hash_queue_depth
a výchozí je 2, která je vhodná pro většinu středně velkých a dokonce i relativně velkých instalací. Protože počet používaných adresářů prodlužuje dobu hledání pro hledání objektů, použití příliš vysoké hodnoty zde může být škodlivé pro výkon. Tato a další možnost se z velké části stala irelevantní díky moderním návrhům souborových systémů, které zvládají mnoho milionů souborů bez výrazného snížení výkonu. - Název adresářů fronty rozdělených mezi podadresáře
- Postfix používá řadu front k uspořádání zpráv s různými stavy a cíli. Každá z těchto front může být nakonfigurována tak, aby používala hashované podadresáře nebo ne. Pokud je zde vybrána fronta, bude uložena v hašovaném podadresáři. V některých případech zde fronta nemusí být uvedena, protože to bude mít vážný dopad na výkon, konkrétně do adresáře s možností zápisu pošty. Adresář odložit log souboru musí být na druhou stranu uložen v hašovaných adresářích, jinak utrpí výkon. Tato možnost odpovídá
hash_queue_names
direktiva a výchozí hodnota jeincoming,active,deferred,bounce,defer,flush
a na moderních systémech je zřídka nutné nebo výhodné tuto konfiguraci měnit. - Maximální počet
Received:
záhlaví - Zpráva, která obsahuje více
Received:
hlavičky, než se to odrazí. Extrémně velký počet této hlavičky může indikovat poštovní smyčku nebo nesprávně nakonfigurovaný poštovní server někde v cestě této zprávy. Tato možnost koreluje shopcount_limit
direktiva a výchozí hodnota je 50. Tuto hodnotu je zřídka nutné změnit oproti výchozí hodnotě. - Čas v hodinách před odesláním upozornění na nedoručení
- Pokud zprávu nelze doručit okamžitě, bude zařazena do fronty pro pozdější doručení. Pokud ani po tomto počtu hodin nelze zprávu doručit, bude odesílateli zasláno varování, že server nemohl zprávu odeslat po stanovenou dobu. To koreluje s
delay_warning_time
direktiva a výchozí nastavení neposílat varování. - Síťová rozhraní pro příjem pošty
- Tato možnost konfiguruje síťové adresy, na kterých bude Postfix přijímat doručování pošty. Ve výchozím nastavení bude Postfix přijímat poštu na každém aktivním rozhraní. Zde Postfix přijme proměnné, o kterých jsme hovořili dříve. Tato možnost konfiguruje
inet_interfaces
směrnice. - Doba nečinnosti po odpojení interního klienta IPC
- Tato možnost nastavuje čas v sekundách, po kterém se interní klient IPC odpojí. To umožňuje serverům dobrovolné ukončení. Tuto funkci využívají klienti pro rozlišení adres a přepisování. Tato možnost koreluje s
idle_time
direktiva a výchozí hodnota je 100s. Za normálních okolností by tato možnost pravděpodobně nikdy neměla být měněna. - Časový limit pro I/O na interních komunikačních kanálech
- Tato možnost určuje dobu v sekundách, po kterou bude server čekat na I/O na interních komunikačních kanálech, než dojde k přerušení. Pokud je časový limit překročen, server se přeruší s fatální chybou. Tato direktiva odpovídá
ipc_timeout
a výchozí hodnota je 3600 sekund nebo 60 minut. - Název poštovního systému
- Tato možnost identifikuje systém poštovního serveru, který se používá pro připojení uživatelů. Bude použit v
smtpd_banner
který je odeslán vReceived:
hlavičky, uvítací banner SMTP a v vrácené poště. Někteří bezpečnostní experti, kteří prosazují zabezpečení prostřednictvím nejasností, doporučují anonymizovat veškerý serverový software, aby potenciální crackeři nemohli identifikovat software používaný na serveru. Ve většině prostředí to však pravděpodobně není nejlepší využití času nebo úsilí administrátorů a mnoho dalších bezpečnostních taktik je účinnějších, aniž by negativně ovlivnily schopnost sledovat softwarové problémy. Tato možnost koreluje smail_name
a výchozí jePostfix
. - Vlastník pošty
- Tato volba určuje vlastníka poštovní fronty Postfixu a většinu procesů démona Postfixu. Tento uživatel by měl být v systému jedinečný a neměl by sdílet žádné skupiny s jinými účty ani vlastnit žádné jiné soubory nebo procesy v systému. Po navázání na port SMTP (25) může postfix zrušit oprávnění root a stát se zde uvedeným uživatelem pro všechny nové procesy démona. Z tohoto důvodu, pokud bude démon Postfix někdy kompromitován, bude mít exploiter přístup pouze k poště a několika dalším souborům. Samozřejmě je dobré se tomu také vyhnout, ale rozhodně je to lepší než exploit roota, který by exploiterovi umožnil přistupovat a měnit cokoli v systému. Tato možnost koreluje s
mail_owner
a výchozí jepostfix
. - Oficiální verze poštovního systému
- Tento parametr mimo jiné konfiguruje číslo verze, které bude Postfix hlásit v uvítacím banneru SMTP. To koreluje s
mail_version
a výchozím nastavením je verze Postfixu, která je nainstalována. Ještě jednou, zabezpečení ze strany propagátorů nejasností může povzbudit zamlžení této hodnoty. - Čas čekat na další servisní požadavek
- Proces démona Postfixu se ukončí po zde uvedené době, pokud během této doby neobdrží nový požadavek na službu. Tato možnost odpovídá parametru
max_idle
a výchozí hodnota je100s
. Tato direktiva nemá vliv na proces démona správce front. - Maximální počet servisních požadavků zpracovaných před ukončením
- Tato volba konfiguruje maximální počet požadavků, na které jeden proces démona Postfixu odpoví před ukončením. Tato možnost konfiguruje
max_use
a výchozí hodnota je100
. - Internetový název hostitele tohoto poštovního systému
- Tato možnost určuje název internetového hostitele poštovního serveru. Ve výchozím nastavení bude tato hodnota nastavena na plně kvalifikovaný název hostitele serveru, jak je určeno voláním funkce
gethostname()
. Tato možnost nastavuje$myhostname
proměnná, která se používá ve výchozím nastavení pro mnoho dalších možností. Tato možnost koreluje smyhostname
směrnice. - Název místní internetové domény
- Tato možnost odpovídá
mydomain
a výchozím nastavením je obsah$myhostname
proměnná mínus první složka. Tato možnost definuje$mydomain
proměnná a používá se v řadě dalších výchozích možností konfigurace. - Místní sítě
- Postfix poskytuje flexibilní sadu možností, které pomáhají zabránit UCE nebo jinému neoprávněnému použití poštovního serveru. Tato volba definuje, které sítě budou Postfixem považovány za místní. Hodnota se používá k určení, zda je klient lokálním klientem nebo vzdáleným klientem. Zásady mohou být pro místní klienty uvolněnější. Tato možnost konfiguruje
mynetworks
a výchozím nastavením je seznam všech sítí připojených k serveru. Pokud má například server IP adresu 192.168.1.48 a masku sítě 255.255.255.0, bude celá síť 192.168.1.0 považována za místní. Pokud byste chtěli přísnější kontrolu nebo možnost zacházet s jinými síťovými bloky jako s místními klienty, můžete je zde zadat ve formě párů síť/maska (tj.172.16.0.0/16
. Páry síť/maska mohou být vloženy ze samostatného souboru, pokud to dáváte přednost, zadáním absolutní cesty k souboru zde. - Odeslat oznámení vedoucímu pošty o bounce na...
- Tato možnost konfiguruje uživatelské jméno nebo e-mailovou adresu, na kterou se budou zasílat oznámení o nedoručení. Tato možnost koreluje s
bounce_notice_recipient
a je nastaven napostmaster
ve výchozím nastavení. - Odeslat oznámení poštmistra na 2bounce na...
- Tato možnost konfiguruje uživatelské jméno nebo e-mailovou adresu, na kterou budou zasílány druhé vrácené zprávy. To umožňuje správci sledovat varování o druhém nedoručení podrobněji než zprávy o prvním nedoručení, protože první nedoručení jsou mnohem častější a méně pravděpodobně indikují vážné problémy. Tato možnost konfiguruje
2bounce_notice_recipient
a výchozí jepostmaster
. - Zašlete poštmistrovi oznámení o zpoždění na...
- Tato možnost konfiguruje, kam se budou odesílat upozornění na zpoždění. Tato možnost koreluje s
delay_notice_recipient
a výchozí jepostmaster
. - Odeslat upozornění správce pošty o chybě na...
- Určuje, kam se budou odesílat chybová upozornění. Tato možnost koreluje s
error_notice_recipient
a výchozí jepostmaster
. - Adresář poštovní fronty
- Toto určuje adresář, kam bude Postfix ukládat poštu ve frontě. Toto bude také kořenový adresář pro démony Postfixu, které běží v prostředí chroot. Fronta je místo, kde se ukládají zprávy, které čekají na doručení, takže v tomto adresáři by měl být dostatek místa pro zatížení vaší uživatelské pošty. Tato možnost koreluje s
queue_directory
direktiva a obvykle výchozí umístění na rozumné umístění pro váš OS. Mnoho systémů Linux bude mít frontu pošty v/var/spool/mail
nebo/var/spool/postfix
. - Zamknout adresář souboru, vzhledem k adresáři fronty
- Tato volba konfiguruje umístění adresáře zámku Postfixu. Měl by být specifikován relativně k adresáři fronty a obecně to bude jednoduše podadresář adresáře fronty. Tato možnost konfiguruje
process_id_directory
a výchozí jepid
. - Oddělovač mezi uživatelskými jmény a příponami adres
- Tato možnost určuje oddělovací znak mezi uživatelskými jmény a příponami adresy. Tato možnost koreluje s
recipient_delimiter
direktiva a výchozí nepoužívá žádný oddělovač. Tato možnost má vliv na kanonické mapování , Přemístěné mapování a virtuální domény . - Programy podpory Postfixu a adresář démonů
- Tato volba určuje adresář, kde bude Postfix hledat různé podpůrné programy a démony. Adresář by měl vlastnit
root
. Tato možnost koreluje sprogram_directory
direktiva a výchozí hodnoty se liší v závislosti na metodě instalace a variantě OS. Na mnoha systémech Linux to bude/usr/libexec/postfix
. - Přemístěné vyhledávací tabulky mapování
- Postfix může poskytnout upozornění na přemístění v reakci na zprávy zaslané uživatelům, kteří již nedostávají poštu z tohoto serveru. Pokud je tato možnost povolena, určuje umístění souboru obsahujícího tabulku kontaktních informací pro uživatele, kteří již v tomto systému neexistují. Ve výchozím nastavení je tato funkce zakázána. Tato možnost koreluje s
relocated_maps
směrnice. Pokud je povoleno, rozumnou volbou pro tuto možnost může být/etc/postfix/relocated
. - Zakázat zámek souborů jádra u poštovních schránek
- Na pracovních stanicích Sun mohou zámky souborů jádra způsobovat problémy, protože
mailtool
program má výhradní zámek, kdykoli je jeho okno otevřené. Uživatelé jiných variant OS nebo systémů Sun, kde se nepoužívá žádný poštovní software Sun, mohou tuto možnost ignorovat. Tato možnost koreluje ssun_mailtool_compatibility
a výchozí jeNo
. - Maximální doba pro odeslání spouštěče do démona
- Tato volba určuje maximální dobu povolenou pro odeslání spouštěče démonovi Postfixu. Toto omezení pomáhá zabránit tomu, aby programy byly zablokovány, když je poštovní systém extrémně zatížen. Tato možnost koreluje s
opts_trigger_timeout
a výchozí je10s
.
Přepisování a maskování adresy
Postfix nabízí relativně snadno použitelný a flexibilní systém přepisování adres, který mu umožňuje fungovat jako poštovní brána pro velkou síť nebo jako brána mezi staršími poštovními systémy a Internetem obecně.
- Přepisování a maskování adres
Poznámka: | Možnosti na této stránce jsou také diskutovány na stránce Konfigurace Postfixu - Přepisování adresy na domovské stránce Postfixu. Stojí za přečtení, pokud je ve vašem poštovním systému vyžadováno pokročilé přepisování adres. |
- Přepište "user%domain" na "user@domain"
- Tato možnost je užitečná pro některé starší systémy, které používaly podivné podvody s adresou, jako je uživatel%doména@jiná doména . V moderních prostředích to není obecně užitečné, ale není to škodlivé, takže je obvykle výchozí
Yes
. Tato možnost koreluje sallow_percent_hack
směrnice. - Přepište "user" na "user@$mydomain"
- Tato volba konfiguruje, jak bude Postfix zpracovávat adresu, která nemá v cíli žádné doménové jméno. Pokud je povoleno, připojí hodnotu
$mydomain
na adresu. Tato možnost koreluje sappend_at_myorigin
a výchozí jeYes
. Protože většina komponent Postfixu očekává, že adresy budou ve tvaruuser@domain
pravděpodobně není nikdy vhodné tuto funkci zakázat. - Přepište "user@hostitel" na "user@host.$mydomain"
- Tato možnost nastavuje, zda jednoduché adresy hostitelů budou mít hodnotu
$mydomain
k nim připojené. Tato možnost koreluje sappend_dot_mydomain
a výchozí jeYes
. Někteří administrátoři mohou zjistit, že toto explicitní přepsání má neočekávané důsledky, ale velmi zřídka je to problém. - Přepište „site!user“ na „user@site“
- Starší sítě UUCP používají jiný formát adresování než moderní systémy SMTP. Tato možnost umožňuje Postfixu převést adresu starého stylu na moderní adresu pro doručení prostřednictvím standardního protokolu SMTP. Tato možnost konfiguruje
swap_bangpath
a výchozí jeYes
. - Odeslat e-mail s prázdným příjemcem na...
- Určuje cíl pošty, která je nedoručitelná. Obvykle se bude jednat o oznámení o nedoručení a další chybové zprávy. Tato možnost koreluje s
empty_address_recipient
a výchozí jeMAILER-DAEMON
, což je ve výchozím nastavení jednoduše aliaspostmaster
. - Maskování adresy
- Maskování adresy je metoda, při které mohou být hostitelé za poštovním serverem brány skryti a veškerá pošta bude vypadat, jako by pocházela ze serveru brány. Je-li tato možnost povolena, část adresy hostitele a/nebo subdomény bude odstraněna a adresa bude zahrnuta pouze zde uvedená doména. Například pokud
$mydomain
je zde uvedeno, odchozí pošta z[email protected]
bude jednoduše[email protected]
, za předpokladu, že proměnná $mydomain obsahujeswelltech.com
. Tato možnost koreluje smasquerade_domains
a ve výchozím nastavení je zakázána. - Masquerade výjimky
- U některých uživatelských jmen je možné přeskočit výše definovaná pravidla maškarády. Zde můžete zadat jména, která mají být z těchto pravidel vyjmuta. Tato možnost odpovídá
masquerade_exceptions
a ve výchozím nastavení se nedělají žádné výjimky.
Poštovní aliasy
Poštovní aliasy poskytují prostředky k přesměrování pošty místním příjemcům. Konkrétně umožňuje doručovat poštu určenou na několik různých adres do jedné poštovní schránky. Běžně se to používá k přesměrování pošty pro uživatele, jako je postmaster
skutečnému člověku. Tato stránka je rozdělena do dvou částí. Horní část označená Možnosti aliasů obsahuje umístění a formát souborů aliasů, které by měl Postfix použít k vytvoření svých databází aliasů, a specifikuje typ databáze, která se má použít. Spodní část obsahuje seznam všech nakonfigurovaných aliasů v systému a toho, na co se alias mapuje.
Možnosti aliasů
- Databáze aliasů používané místním doručovacím agentem
- Tato volba nastavuje názvy souborů, které bude Postfix používat pro místní překlad aliasů doručení. K názvu souboru bude připojena přípona podle typu souboru. Tato možnost koreluje s
alias_maps
a výchozí nastavení je závislé na systému. Mezi běžné výchozí hodnoty patříhash:/etc/aliases
nebohash:/etc/postfix/aliases
. První část záznamu před dvojtečkou je typ databáze, která se má použít, což bude jeden zhash
pro systémy s moderní implementací Berkeley DB,dbm
pro starší stylové systémy, které mají pouzedbm
dostupné, nebonis
pro systémy se systémem NIS. Část záznamu za dvojtečkou je cesta k názvu souboru, ze kterého je odvozen název databáze. Databáze budou vytvořeny z obsahu plochých souborů Postfixem při spuštění nebo při spuštěnínewaliases
příkaz. - Alias databáze vytvořené Postfixem
- Tato možnost, která úzce souvisí s výše uvedeným, určuje soubor(y) databáze aliasů, které se vytvoří při
newaliases
nebosendmail -bi
jsou spuštěny příkazy. Tyto příkazy generují databázi aliasů z plochého souboru ve výše uvedené volbě, aby urychlily vyhledávání aliasů prováděné Postfixem. Protože na velkém poštovním serveru mohou být tisíce aliasů, je pro udržení efektivity nezbytný jejich import do databáze. Tato možnost koreluje salias_database
směrnice. Výchozí hodnoty jsou závislé na systému, ale obvykle budou stejné jako výše uvedená možnost, s příslušnou příponou databázového souboru.
Aliasy
Tato část stránky obsahuje seznam všech nakonfigurovaných aliasů. Chcete-li upravit alias, klikněte na název aliasu. Chcete-li vytvořit alias, klikněte na Vytvořit nový alias a vyplňte alias Name
a Alias to...
pole. Kdykoli byly soubory aliasů změněny, je nutné znovu vytvořit soubory databáze aliasů, aby se změny projevily. Při používání Webminu se tento krok provádí automaticky a nejsou vyžadovány žádné další kroky.
Poznámka: | Pokud přidáváte aliasy z příkazového řádku, je možné znovu vygenerovat databázi aliasů pomocí příkazu postalias . Manuálová stránka tohoto příkazu je užitečným zdrojem pro pochopení toho, jak se v Postfixu zachází s databázemi aliasů. |
Kanonické mapování
Kanonické mapování v Postfixu se používá pro úpravu pošty v příchozí frontě a mění jak záhlaví zpráv, tak informace o obálce zpráv pro místní nebo vzdálenou poštu. Toto mapování může být užitečné při nahrazení přihlašovacích jmen pomocí Jméno.Příjmení styl adres nebo k vyčištění lichých adres vytvořených staršími poštovními systémy.
Kanonické mapovací tabulky
Pokud používáte nějaké kanonické mapovací tabulky, musí být specifikovány v první sekci Kanonického mapování modul. Po jejich definování je můžete upravovat z druhé části modulu.
- Vyhledávací tabulky mapování adres
- Tato možnost určuje umístění volitelného souboru tabulky mapování kanonických adres. Toto mapování se aplikuje na adresy odesílatele i příjemce, a to jak v obálkách, tak v záhlavích. Tato možnost konfiguruje
canonical_maps
direktiva a je ve výchozím nastavení zakázána. Much like the aliases files discussed in the last section, canonical mapping files are specified by a database type and a filename. The accepted database types depend on your operating system, and installed components. Usuallyhash
anddbm
are used as the database type. A common choice for this value, then, might behash:/etc/postfix/canonical
. - Tables for RECIPIENT addresses
- This parameter configures address mapping only on recipient addresses, and not sender addresses. Mapping is performed on both envelopes and headers. These lookups are performed before the above configured Address mapping lookup tables . This option correlates to the
recipient_canonical_maps
directive and is disabled by default. - Tables for SENDER addresses
- Similar to the previous option, this configures mapping for sender addresses only, and not recipient addresses. Both envelope and header information is modified. This option correlates to the
sender_canonical_maps
directive and by default is disabled.
Editing Canonical Mappings
Once a filename is selected for any of the canonical mapping tables, it may be edited by clicking the appropriate Edit... buttons. A new page will open, listing any existing mappings and allowing creation of new mappings. The format of mappings in all files is the same.
Canonical mappings may seem, on the surface, to be similar to aliases or virtual domains. However, they are quite distinct and are useful for other purposes. While aliases merely make a decision about which user will receive an email, and virtual domains only impact the envelope address, the canonical mapping alters both the envelope address and the SMTP header address. This change can be used to make mail appear to come from a different user or domain, or direct mail to a different user or domain by changing the address on the message.
For example, if I have a number of local subdomains, but would like all mail to appear to originate from a single domain, it is possible to create a canonical mapping to make the translations. In the Edit a Map page, the Name
will be a subdomain that is to be mapped to the domain, such as @lab.swelltech.com
. The Mapts to...
value will simply be the domain I'd like this subdomain converted to, @swelltech.com
. After saving the mapping and applying changes, all outgoing mail from lab.swelltech.com
will appear to originate from swelltech.com
.
Virtual Domains
Virtual domains functionality in Postfix provides a means to redirect messages to different locations by altering the message envelope address. The header address is not altered by a virtual domain mapping. While some functionality of virtual domains overlaps with features available in aliases, virtual domains can be used for local or non-local addresses, while aliases can only be used for local address.
- Domain mapping lookup tables
- Much like aliases tables and canonical mapping tables discussed in the previous sections, this is simply the path to a file containing the mapping tables for virtual domains. This is usually something along the lines of
hash:/etc/postfix/virtual
, and must be converted to a database format for use in Postfix. Webmin will perform the database generation step for you.
Transport Mapping
The term transport refers to the mechanism used to deliver a piece of email. Specifically, SMTP and UUCP are mail transports that are supported by Postfix. Transport mapping can be used for a number of purposes, including SMTP to UUCP gatewaying, operating Postfix on a firewall with forwarding to an internal mail server, etc.
- Transport mapping lookup tables
- This option configures the path to a file containing one or more transport mappings. These tables are much like the mapping tables discussed already, and are converted to a database and used by Postfix in the same way. This option correlates to the
transport_maps
directive. This feature is disabled by default. A common value for this option is/etc/postfix/transport
.
To create a new mapping, first define the mapping file. Then click Add a mapping . If your goal is to redirect mail to an protected internal host from Postfix running on a firewall, for example, you could enter the outside domain name into the Name field, swelltech.com
and then enter into the Maps to... field the address of the internal machine, smtp:privatehost.swelltech.com
. To further improve upon this, local delivery on this machine could be disabled, and increased controls over where and to whom mail should be accepted. There are more examples of such a configuration in the tutorial section of this chapter.
Relocated Mapping
Using this option it is possible to notify senders if a local user has moved to another address. For example, if a user leaves an organization but still receives occasional mail at her local address, it may be convenient to notify anyone sending mail to the user of the move and new contact information for that user. Usage is just like the previous types of mappings and so won't be documented specifically here, though and example of a relocated mapping will be given to display the types of information that can be provided by this feature.
As an example, let's say I move from my current company to the far more relaxed atmosphere of the Oval Office. To make sure all of my friends and clients can keep in touch with me, I could provide a relocated mapping with a Name of [email protected]
with a Maps to... of [email protected]
. While this won't redirect mail to me at my new home, it will notify the people trying to contact me that I've changed email addresses. Hopefully they will all update their address books and resend their mail to my new address.
Local delivery
Local delivery is what Postfix does when it reaches the end of all of its list of mappings and access controls, and still finds that the message is allowed and destined for a user on the local machine (i.e., a mapping could potentially send the message elsewhere for final delivery, so all mappings as well as various access checks are performed before reaching this stage). This page configures a number of options relating to how Postfix handles the delivery of mail for local users.
- Local Delivery
- Name of the transport for local deliveries
- This configures the name of the transport that will be used for delivery to destination that match the $mydestination or $inet_interfaces variables. This can be a simple mailbox drop handled by the Postfix local delivery agent, or any appropriate delivery command. This option correlates to the
local_transport
directive and defaults to the defined transport type namedlocal
. - Shell to use for delivery to external command
- If a command shell is required to communicate properly with your chosen local delivery transport, this option selects the shell that will be used. By default no shell is used, and the transport command will be executed directly. However, if the command contains shell meta-characters or shell built-in commands they will be passed to
/bin/sh
or whatever shell you configure here. A popular choice for this issmrsh
, or Sendmail's Restricted Shell , which is included in recent Sendmail distributions.smrsh
allows for more precise control over what commands users can execute from their.forward
files. This option corresponds to thelocal_command_shell
and defaults to/bin/sh
. - Search list for forward
- This is a comma-separated list of possible locations for user forward files. Postfix will try each entry in the list until a forward file is found, or until all have been checked and no match is found. The forward file allows users to configure delivery options for themselves, including delivery-time processing by a program like
procmail
as well as forwarding of messages to a different server. A number of variable expansions are performed on the entries. The expansions are currently:
Forward search path variable expansions
-
$user
- The user name of the recipient.
-
$shell
- The shell of the recipient.
-
$home
- Recipient's home directory.
-
$recipient
- The full recipient address.
-
$extensions
- Recipient address extensions. This is a separate part of the email address, separated by the Separator between user names and address extensions defined on the General Options page.
-
$domain
- The recipient's domain name.
-
$local
- The entire local part of the recipient address.
-
$recipient_delimiter
- The separation delimiter for the recipient.
- Valid mail delivery to external commands
- This parameter restricts mail delivery to only those commands specified here. The default is to disallow delivery to commands specified in
:include:
files, and allow execution of commands inalias
andforward
files. This option correlates to theallow_mail_to_command
directive. - Valid mail delivery to external files
- This option restricts mail delivery to external files. The default is to disallow delivery to files specified in
:include:
but to allow delivery to files specified inaliases
andforward
files. This option correlates to theallow_mail_to_files
directive. - Default rights of the local delivery agent
- This option configures the privileges that the delivery agent will have for delivery to a file or a command. This option should never be a privileged user or the postfix owner. This option corresponds to the
default_privs
directive and defaults tonobody
. - Pathname of user mailbox file
- When delivering mail locally, Postfix will drop mail in the directory configured here, or in its default mail spool directory. If you wish to use the maildir format for mail storage, this value can be appended with a trailing slash. For example, to store mail in the users home directory in the
Maildir
subdirectory, the value would beMaildir/
. This option correlates to thehome_mailbox
directive and usually defaults to some location under/var/spool/mail
or/var/spool/postfix
. - Destination address for unknown recipients
- If a message is received for a recipient that does not exist, the message is normally bounced. However, it is possible to instead have the message delivered to an alternate address. This option corresponds to the
luser_relay
directive. Variable expansions matching those discussed for the Search list for forward are also valid for this directive. - Spool directory
- This option specifies the directory where UNIX-style mailboxes are stored. Defaults vary depending on OS variant and version, but a common choice is
/var/spool/mail
. This option correlates to themail_spool_directory
option. - External command to use instead of mailbox delivery
- This option defines a command to use for delivery instead of delivering straight to the users mailbox. The command will be run as the recipient of the message with appropriate
HOME
,SHELL
andLOGNAME
environment variables set. This option is commonly used to set up system-wide usage of procmail. Beware that if you use a command to deliver mail to all users, you must configure an alias forroot
, as the command will be executed with the permissions of the$default_user
. This option correlates to themailbox_command
directive and is disabled by default. - Optional actual transport to use
- This option configures the message transport to use for all local users, whether they are in the UNIX passwd database or not. If provided, the value will override all other forms of local delivery, including Destination address for unknown recipients . This option corresponds to the
mailbox_transport
directive and is disabled by default. This option may be useful in some environments, for example, to delegate all delivery to an agent like the cyrus IMAPD. - Optional transport for unknown recipients
- If a user cannot be found in the UNIX passwd database, and no alias matches the name, the message will ordinarily be bounced, or handled via the Destination address for unknown recipients volba. However, if you would like unknown users to be handled by a separate transport method. This option overrides the Destination address for unknown recipients option above. This option correlates to the
fallback_transport
directive and is disabled by default. - Max number of parallel deliveries to the same local recipient
- This option limits the number of simultaneous deliveries to a single local recipient. If
.forward
files are allowed for users, a user may run a time-consuming command or shell script, leading to overload caused by several such processes being started up at once. This option correlates to thelocal_destination_concurrency_limit
directive and the default is2
. A low value is recommended for this option, unless it is certain that no complex.forward
files will be in use. - Max number of recipients per local message delivery
- This option configures the maximum number of recipients per local message delivery. This option correlates to the
local_destination_recipient_limit
and is set to the value ofMax number of recipients per message delivery
by default. - Prepend a Delivered-To
- when...
- This parameter determines when Postfix should insert a
Delivered-to:
message header. By default Postfix inserts this header when forwarding mail and when delivering to a file. The defaults are recommended, and it is generally preferable not to disable insertion into forwarded mail. This option corresponds to theprepend_delivered_header
directive.
General resource control
This page provides access to the various memory and process limits for the Postfix processes ([ch10.html#figpfgeneralresource Figure 10.6, General resource control]. It is rarely necessary to alter the values on this page, except for highly loaded servers or very low resource machines.
General resource control- Max size of bounced message
- This option limits the amount of the original message content in bytes that will be sent in a bounce notification. This option correlates to
bounce_size_limit
and defaults to 50000. - Max time for delivery to external commands
- When delivering mail to an external command (rather than via direct mailbox delivery), Postfix will wait this amount of time for the delivery to complete. If this value is to be set to a high limit (3600s or more) the value of Timeout for I/O on internal comm channels in General Options must also be increased. This option correlates to the
command_time_limit
directive and defaults to1000s
. - Max number of Postfix child processes
- This option limits the number of child processes that Postfix will spawn. On high load servers the default may be too low, and may need to be raised to as much as
500
or more. More likely, for most environments, 50 is more than adequate and may even be overkill. For example on dial-up, or consumer broadband serving one to ten users, a more appropriate limit might be10
. If in doubt, leave it at its default unless it causes problems. This option correlates to thedefault_process_limit
directive and defaults to50
. - Max number of addresses remembered by the duplicate filter
- While expanding aliases and
.forward
files Postfix will remember addresses that are being delivered to and attempt to prevent duplicate deliveries to the same address. This option limits the number of recipient addresses that will be remembered. It corresponds to theduplicate_filter_limit
directive and defaults to1000
. There is probably no compelling reason to increase this value. - Max attempts to acquire file lock
- This option limits the number of attempts Postfix will make when attempting to obtain an exclusive lock on a mailbox or other file requiring exclusive access. It corresponds to the
deliver_lock_attempts
directive and defaults to20
. - Time in seconds between file lock attempts
- Postfix will wait a specified time between attempts to lock a given file, after a failed lock attempt. This option configures the
deliver_lock_delay
directive and defaults to1s
. - Max attempts to fork a process
- If Postfix attempts to fork a new process and fails, due to errors or a lack of available resources, it will try again a specified number of times. This option correlates to the
fork_attempts
directive and defaults to5
. - Time in seconds between fork attempts
- Postfix will try to spawn a new process a specified time after a failed attempt. This option correlates to the
fork_delay
directive and defaults to1s
. - Max memory used for processing headers
- This option limits the amount of memory in bytes that Postfix will use to process message headers. If a message header is too large to fit into the memory specified, the headers that do not fit into memory will be treated as part of the message body. This option correlates to the
header_size_limit
directive and defaults to102400
. - Max memory used for handling input lines
- This option limits the amount of memory in bytes that Postfix will use to handle input lines. And input line is any line read from an
:include:
or.forward
file. In order to prevent the mail server from using excessive amounts of memory, it will break up these files into chunks of this length. This option correlates to theline_length_limit
directive and defaults to2048
. - Max size of a message
- This option limits the size in bytes of a message that will be delivered, including the message envelope information. This limit should be set high enough to support any email messages your users will need to be able to send or receive. This option correlates to the
message_size_limit
directive and defaults to10240000
. - Max number of messages in the active queue
- This option limits the number of messages that can exist in the message queue at any given time. It correlates to the
qmgr_message_active_limit
directive and defaults to10000
. - Max number of in-memory recipients
- This parameter limits the number of in-memory recipient data structures. This memory contains the short-term dead list , which indicates a destination was unavailable when last contacted, among other things. This option correlates to the
qmgr_message_recipient_limit
directive and defaults to1000
. - Min free space in the queue file system
- Postfix will refuse mail if the filesystem on which the queue is located has less available space in bytes than the value set in this option. This option correlates to the
queue_minfree
directive and defaults to0
. - Max time after which stale lock is released
- This option configures how old an external lock file may be before it is forcibly removed. This option correlates to the
stale_lock_time
and defaults to500s
. - Time in seconds between attempts to contact a broken MDT
- This option configures the time in seconds between the queue manager attempts to contact an unresponsive mail delivery transport. This option correlates to the
transport_retry_time
and defaults to60s
.
SMTP server options
This page configures the majority of the options that directly effect the behavior of the SMTP server portion of Postfix, specifically the portions of Postfix that impact how the server behaves towards an SMTP client that connects to the server.
- SMTP greeting banner
- When a client connects to an SMTP server a greeting banner will be sent to the client (note the term client in this context is not the end user, but rather the email software program that is being used to make the connection). This option configures the text that will follow the status code in the banner. It is possible to use a number of variable expansions, for example, to display the specific version of the server software, though Postfix does not include the version by default. If configuring this option to be other than the default, you must include
$myhostname
at the start of this line, as it allows Postfix to report and respond to a mailer loop rather than overloading the system with many multiple deliveries. This option correlates to thesmtpd_banner
directive and contains$myhostname ESMTP $mail_name
by default.
Note: | A proposed federal law in the US would make it illegal to send unsolicited commercial email through a mail server if the server included in its SMTP greeting the words NO UCE. Since spammers are generally of a criminal mindset anyway, it is unlikely that many of them will respect the new law if it is ever passed. Nonetheless, it is worth mentioning in hopes that sometime soon, all Americans will have legal protection against the stolen resources and time that UCE represents. |
- Max number of recipients accepted for delivery
- This option limits the number of recipients that may be specified in a single message header. It is usually rare for legitimate messages to have an extremely large number of recipients specified in a single message header, but it is often done in UCE messages. The legitimate exception is messages to a mailing list (possibly sent by mailing list software like
majordomo
ormailman
. This option correlates to thesmtpd_recipient_limit
and defaults to1000
. - Disable SMTP VRFY command
- Normally, the SMTP VRFY command is used to verify the existence of a particular user. However, it is also illegitimately used by spammers to harvest live email addresses. Thus it is sometimes useful to disable this command. This option correlates to
disable_vrfy_command
and defaults toNo
. - Timeout in seconds for SMTP transactions
- This option sets the timeout in seconds for a client to respond to the SMTP servers response with an SMTP request. The connection process involves the client opening a connection to the server, the server replies with a greeting, and then the client makes its request. If the client request does not come within the time specified here, the connection will be closed. This option correlates to the
opts_smtpd_timeout
directive and defaults to300s
. - Timeout before sending 4xx/5xx error response
- When sending an error response to a client, the server will sleep a specified time. The purpose of this feature is to prevent certain buggy clients from hitting the server with repeated requests in rapid succession. This option correlates to the
smtpd_error_sleep_time
directive and defaults to5s
. - Error count for temporarily ignore a client
- This option configures the number of errors that a client may generate before Postfix will stop responding to requests for a specified time. Some buggy mail clients may send a large number of requests, while ignoring or responding incorrectly to, the error messages that result. Postfix attempts to minimize the impact of these buggy clients on normal service. This option correlates to the
smtpd_soft_error_limit
and defaults to10
. - Error count for closing connection
- If the number exceeds this limit the connection will be closed. This option correlates to the
smtpd_hard_error_limit
and defaults to100
. - HELO is required
- Enabling this option causes Postfix to require clients to introduce themselves with a
HELO
header at the beginning of an SMTP session. This may prevent some UCE software packages from connecting, though it may also impact other legitimate clients from connecting. This option correlates to thesmtpd_helo_required
and defaults toNo
. - Allow untrusted routing
- This option configures whether Postfix will forward messages with sender-specified routing from untrusted clients to destinations within the accepted relay domains. This feature closes a sneaky potential loophole in access controls that would normally prevent the server from being an open relay for spammers. If this behavior is allowed, a malicious user could possibly exploit a backup MX mail host into forwarding junk mail to a primary MX server which believes the mail has originated from a local address, and thus delivers it as the spammer intended. This option correlates to the
allow_untrusted_routing
and is disabled by default. Enabling this option should only be done with extreme caution and care to prevent turning your Postfix installation into an open relay. - Restrict ETRN command upon...
- The SMTP
ETRN
command is a rather clumsy means for a client that is not always connected to the Internet to retrieve mail from the server. The usage of this command is rather outdated, and rarely used, as POP3 and IMAP are better suited to solve this problem in the general case. This option correlates to thesmtpd_etrn_restrictions
directive and the default is to allowETRN
from any host. This option accepts the following directives:check_etrn_access maptype:mapname
,permit_naked_ip_address
,reject_invalid_hostname
,check_helo_access maptype:mapname
,reject_maps_rbl
,reject_unknown_client
,permit_mynetworks
,check_client_access
,permit
,reject
,warn_if_reject
, andreject_unauth_pipelining
.
This option, as well as the following three Restrictions... options accept one or all of the following values in the text field. Each is described only once here and the specific entry will include the list of accepted directives for the option. The impact of some of these choices depends on configuration performed elsewhere, and could potentially open security holes if not configured carefully.
-
permit_mynetworks
- Permit the message if the relevant address (sender or recipient depending on the restriction) is within the local network.
- reject_unknown_client
- The request will be refused is the client IP has no PTR record in the DNS. This means that a client with an IP address that cannot be resolved to a host name cannot send mail to this host.
-
check_client_access maptype:mapname
- This option requires the inclusion of an already configured map, as discussed earlier. This will restrict based on the contents of the map, allowing only clients that are allowed by the map. The map may contain networks, parent domains, or client addresses, and Postfix will strip off unnecessary information to match the client to the level of specificity needed.
-
check_sender_access maptype:mapname
- This will restrict based on the contents of the map, allowing only senders that are allowed by the map. The map may contain networks, parent domains, or
localpart@
. - reject_maps_rbl
- An RBL is a relay domain black hole list. By testing a reverse domain lookup against a name server that receives a domain black hole list transfer, the server can know if the mail was sent through a known open mail relay. There are a number of free and for-fee services providing black hole data. The largest and longest lasting is the service operated by MAPS, while two new similar services are operated by the Open Relay Database and by Distributed Sender Boycott List. All operated on the principle of allowing administrators to choose to refuse mail sent from open mail relays. If this option is listed, the client will be checked against the available RBL domains, and if any match the mail will be refused.
-
reject_invalid_hostname
- If the client host name is invalid, due to bad syntax, the request will be rejected.
-
permit_naked_ip_address
- If the client
HELO
orEHLO
command contains a naked IP address without the enclosing[]
brackets as require by the mail RFC, the message will be rejected. Beware that some popular mail clients send aHELO
greeting that is broken this way. -
reject_unknown_hostname
- Reject the request if the host name in the client
HELO
command has no A or MX record in the DNS. -
reject_non_fqdn_hostname
- If the client host name is not in the form of a fully-qualified domain name, as required by the RFC, the message will be rejected.
-
check_helo_access maptype:mapname
- The server will search the named access database map for the
HELO
host name or parent domains. If the result from the database search isREJECT
or a4xx
text
or5xx
text
error code the message will be refused, while a response ofOK
orRELAY
or an all numerical response the message will be permitted. -
permit
- This simply permits anything. Generally this will be at the end of a set of restrictions in order to allow anything that has not been explicitly prohibited.
-
reject
- Rejects everything. This can be used at the end of a chain of restrictions to prohibit anything that has not be explicitly permitted.
-
warn_if_reject
- This is a special option that changes the meaning of the following restriction, so that a message that would have been rejected will be logged but still accepted. This can be used for testing new rules on production mail servers without risk of denying mail due to a problem with the rules.
-
reject_unauth_pipelining
- If the client sends commands ahead of time without first confirming that the server support SMTP command pipelining, the message will be rejected. This will prevent mail from some poorly written bulk email software that improperly uses pipelining to speed up mass deliveries.
-
- Restrictions on client hostnames/addresses
- This restriction applies to the client host name and/or address. By default, Postfix will allow connections from any host, but you may add additional restrictions using the following:
reject_unknown_client
,permit_mynetworks
,check_client_access
maptype:mapname
,reject_maps_rbl
,maps_rbl_reject_code
,permit
,reject
,warn_if_reject
,reject_unauth_pipelining
. - Restrictions on sends in HELO commands
- This option specifies additional restrictions on what information can be sent by client in the
HELO
andEHLO
příkazy. This option correlates to thesmtpd_helo_restrictions
directive. By default Postfix accepts anything, and the following restrictions may be added:reject_invalid_hostname
,permit_naked_ip_address
,reject_unknown_hostname
,reject_non_fqdn_hostname
,check_helo_access
maptype:mapname
,reject_maps_rbl
,reject_unknown_client
,check_client_access
maptype:mapname
,permit
,reject
,warn_if_reject
,reject_unauth_pipelining
. - Restrictions on sender addresses
- This option restricts what can be contained in the
MAIL FROM
command in a message. It may be used to prevent specific email addresses from sending mail, reject clients without a resolvable host name, etc. This option correlates to thesmtpd_sender_restrictions
directive and may contain any of the following restrictions:permit_mynetworks:
,reject_unknown_client
,reject_maps_rbl
,reject_invalid_hostname
,reject_unknown_hostname
,reject_unknown_sender_domain
,check_sender_access
maptype:mapname
,check_client_access
maptype:mapname
,check_helo_access
maptype:mapname
,reject_non_fqdn_hostname
,reject_non_fqdn_sender
,reject
,permit
. - Restrictions on recipient addresses
- This parameter places restrictions on the recipients that can be contained in the
RCPT TO
command of a sent message. It can be used to dictate where email may be sent. This option correlates to thesmtpd_recipient_restrictions
, and may contain any of the following restrictions:permit_mynetworks
,reject_unknown_client
,reject_maps_rbl
,reject_invalid_hostname
,reject_unknown_hostname
,reject_unknown_sender_domain
,check_relay_domains
,permit_auth_destination
,reject_unauth_pipelining
,permit_mx_backup
,reject_unknown_recipient
,check_recipient_access
,check_client_access
,check_helo_access
,check_sender_access
,reject_non_fqdn_hostname
,reject_non_fqdn_sender
,reject_non_fqdn_recipient
,reject
,permit
. - DNS domains for blacklist lookups
- This option configures the optional blacklist DNS servers that will be used for all RBL checks that have been specified in all access restrictions. It may contain any number of servers in a whitespace separated list. These services can be used to help prevent spam, as discussed earlier in this section, with the Restrict ETRN command upon... parameter. This option configures the
maps_rbl_domains
directive and is empty, by default. - Restrict mail relaying
- This option specifies from which hosts, networks, domains, etc. Postfix will relay email for. This option correlates to the
relay_domains
directive, and defaults to$mydestination
. - SMTP server response on access map violation, SMTP server response on RBL domains violation, SMTP server response on forbidden relaying, SMTP server response on unknown client reject, SMTP server response on invalid hostname reject, SMTP server response on unknown domain reject, SMTP server response on unknown hostname reject
- These options configure the error result code that will be sent to the client when any of the specified restrictions are being applied. These errors have sensible default values and generally should not need to be changed. Consult with RFC 822 if you wish to understand more about the SMTP error codes, or have a reason to change any of these values.
SMTP Client Options
The SMTP client options configures how Postfix will behave when dealing with other mail servers as a client, i.e., when sending mail on behalf of a user. This portion of the configuration primarily dictates how the server will respond to certain error conditions.
- Action when listed as best MX server
- As discussed in the BIND chapter, a mail server performs a name server query to find the MX, or mail server, record for the destination domain. If this record indicates that the local server is the server to which mail should be sent, it can respond in a couple of ways. The default is to bounce the message with an error indicating a mail loop. If the field is selected and
local
is entered, the mail will be directed to the local delivery agent instead of bouncing the mail. This option correlates to thebest_mx_transport
directive. - Hosts/domains to hand off mail to on invalid destination
- By default, a mail that cannot be delivered because the destination is invalid will be bounced with an appropriate error message. However, it is possible to configure
postfix
to hand off email to another server instead. This option correlates to thefallback_relay
directive. - Ignore MX lookup error
- If a name server query fails to provide an MX record, the server defaults to deferring the mail and trying again later. If
Yes
is selected instead, an A record query will be done and an attempt will be made to deliver to the resulting address. This option correlates to theignore_mx_lookup_error
directive. - Skip 4xx greeting
- If a remote server responds to a connection with a 4XX status code,
postfix
will, by default, select the next available mail exchanger specified by the MX records. If set toNo
, mail delivery will be deferred after the first mail delivery attempt and another attempt will be made later. This option correlates to thesmtp_skip_4xx_greeting
directive. - Skip wait for the QUIT command
- This option configures whether Postfix will wait for the receiving mail server to respond to the
QUIT
command. This option correlates to thesmtp_skip_quit_response
directive and defaults to no. - Max number of parallel deliveries to the same destination
- This option specifies the maximum number of deliveries that Postfix will perform to the same destination simultaneously. This option correlates to the
smtp_destination_concurrency_limit
directive and defaults to the system-wide limit for parellel deliveries configured in the Delivery Rates page documented in the next section. - Max number of recipients per delivery
- Limits the number of recipients per delivery. This option correlates to the
smtp_destination_recipient_limit
directive and defaults to the system-wide limit for recipients per delivery. - Timeout for completing TCP connections
- Specifies the time in seconds that the Postfix delivery agent will wait before timing out a TCP connection. This option correlates to the
smtp_connect_timeout
directive and defaults to 0, which disables connection timeouts. - Timeout on waiting for the greeting banner
- Limits how long Postfix will wait for a greeting banner to be received from the destination server. This option corresponds to the
smtp_helo_timeout
directive and defaults to 300 seconds. - Timeout on waiting for answer to MAIL FROM
- Sets the timeout in seconds for sending the
SMTP MAIL FROM
command and for receiving the destination servers response. This option correlates to thesmtp_mail_timeout
, and defaults to 300 seconds. - Timeout on waiting for answer to RCPT TO
- Sets the timeout in seconds for sending the
SMTP RCPT TO
command and for receiving the destination servers response. This option correlates to thesmtp_rcpt_timeout
directive and defaults to 300 seconds. - Timeout on waiting for answer to DATA
- Sets the timeout in seconds sending the
SMTP DATA
command and for receiving the destination servers response. This option correlates to thesmtp_data_init_timeout
and defaults to 120 seconds. - Timeout on waiting for answer to transmit of message content
- Specifies the SMTP client timeout in seconds for sending the contents of the message. If the connection stalls for longer than this timeout, the delivery agent will terminate to transfer. This option corresponds to the
smtp_data_xfer_timeout
directive and defaults to 180 seconds. - Timeout on waiting for answer to ending "."
- Specifies the SMTP client timeout in seconds for sending the closing SMTP "." and receiving the destination servers reply. This option correlates to the
smtp_data_done_timeout
directive and defaults to 600 seconds. - Timeout on waiting for answer to QUIT
- Sets the timeout in seconds sending the
SMTP QUIT
command and for receiving the destination servers response. This option correlates to thesmtp_quit_timeout
and defaults to 300 seconds
Delivery Rates
This page contains the options for setting the default rate and concurrency limits for all Postfix components. These rates can usually be overridden within their respective configuration sections.
- Max number of parallel deliveries to the same destination
- This option specifies the maximum number of deliveries that Postfix will perform to the same destination simultaneously. This option correlates to the
default_destination_concurrency_limit
directive and defaults to10
. - Max number of recipients per message delivery
- Limits the number of recipients per delivery. This option correlates to the
default_destination_recipient_limit
directive and defaults to50
. - Initial concurrency level for delivery to the same destination
- Specifies the initial number of simultaneous deliveries to the same destination. This limit applies to all SMTP, local, and pipe mailer deliveries. A concurrency of less than two could lead to a single problem email backing up delivery of other mail to the same destination. This option configures the
initial_destination_concurrency
directive and defaults to5
. - Max time (days) in queue before message is undeliverable
- Defines the number of days a message will remain queued for delivery in the event of delivery problems before the message is sent back to the sender as undeliverable. This option configures the
maximal_queue_lifetime
directive and defaults to 5 days. - Min time (secs) between attempts to deliver a deferred message
- In the event of a delivery deferral, Postfix will wait the specified amount of time before reattempting delivery. This value also specifies the time an unreachable destination will remain in the destination status cache. This option correlates to the
minimal_backoff_time
directive and defaults to 1000 seconds. - Max time (secs) between attempts to deliver a deferred message
- Specifies the maximum amount of time between delivery attempts in the event of a deferred delivery. This option configures the
maximal_backoff_time
directive and defaults to 4000 seconds. - Time (secs) between scanning the deferred queue
- Specifies the time in seconds between queue scans by the queue management task. This option correlates to the
queue_run_delay
and defaults to 1000 seconds. - Transports that should not be delivered
- This field specifies which delivery transports, if any, of the transports defined in the Transport Mapping section will not have their messages sent automatically. Instead the messages for these transports will be queued, and can be delivered manually using the
sendmail -q
command. This option correlates to thedefer_transports
directive, and contains nothing by default.
Debugging features
Postfix has two levels of logging. The first level is the normal maillog
, which reports on all normal mail activities such as received and sent mail, server errors, shutdowns and startups. The second level is more verbose, and can be tuned to log activity relating to specific SMTP clients, host names, or addresses. This page contains the configuration for the second level of logging.
- List of domain/network patterns for which verbose log is enabled
- This is a list of patterns or addresses that match the clients, hosts, or addresses whose activity you would like to have more verbose logging for. Values here could be an IP address like
192.168.1.1
or a domain name likeswelltech.com
. This option correlates to thedebug_peer_list
directive and is empty by default. - Verbose logging level when matching the above list
- Specifies the level of verbosity of the logging for the activity that matches the above patterns. This option correlates to the
debug_peer_level
directive and defaults to 2. The above field must have at least one value for this debug level to have any impact.
Postfix, Unsolicited Commercial Email and Access Controls
Postfix offers an extremely flexible set of access controls, primarily targeted at preventing unsolicited commercial email from being delivered through the server. In order to construct a suitable set of controls it is necessary to understand the order in which rules are checked, and how they interact. By default Postfix will accept mail for delivery from or to any client on your local network and any domains that are hosted by Postfix. So, by default, Postfix is not an open relay. This is a good beginning, and may be all that is needed in many environments. However, because UCE is such a nuisance for users and network administrators, it may be worthwhile to implement more advanced filtering. This section will address the basics of the Postfix UCE control features.
Access Control List Order
Every message that enters the smtpd
delivery daemon will be processed by a number of access control lists and checked against a number of rules to insure that the message is one that the administrator actually wants delivered. The goal for most administrators is to prevent unsolicited commercial email from passing through these rules, yet allow every legitimate email to be delivered. This is a lofty goal, and a delicate balance. No perfect solution exists, as long as people are willing to steal the resources of others for their own commercial gain and go to great lengths to overcome the protections in place to prevent such abuse. However, in most environments it is possible to develop a reasonable set of rules that prevents most spam and allows most or all legitimate mail through unharmed.
It is important to understand the order of processing if complex sets or rules are to be used, as attempting to use a particular rule too early in the chain can lead to subtle errors, or strange mail client behavior. Because not all clients react exactly correctly to some types of refusals, and not all clients create correctly formed SMTP requests, it is not unlikely that a misplaced rule will lock out some or all of your clients from sending legitimate mail. It could also just as easily lead to opening a hole in your spam protections early in the rule set, which would allow illicit mail to pass.
The Postfix UCE controls begin with a couple of simple yes or no checks, called smtpd_helo_required
and strict_rfc821_envelopes
, both configured in the SMTP Server Options page. The first, if enabled, requires a connecting mail client to introduce itself fully by sending a HELO command. This can stop some poorly designed bulk email programs. The second option requires for the envelope to fit the SMTP specification precisely, thus enforcing complete headers. Though the envelope and HELO can be forged by a bulk mailer, it may stop the more hastily implemented variants (well, how many good programmers do you know that write tools to help spammers?).
The next stage is the four SMTP restrictions also found on the SMTP Server Options page. These further limit from where and to where mail will be delivered. The order of traversal for these four lists of rules is:
- Restrictions on client hostnames/addresses or
smtpd_client_restrictions
- Restrictions on sends in HELO commands or
smtpd_helo_restrictions
- Restrictions on sender addresses or
smtpd_sender_restrictions
- Restrictions on recipient addresses or
smtpd_recipient_restrictions
Each of these checks can return REJECT
, OK
, or DUNNO
. If REJECT
, the message will be refused, and no further rules will be checked. If OK
, no further rules in the given restriction will be checked, and the next restriction list will be checked. If DUNNO
, the list will continue to process the current restriction until it gets another result (OK
or REJECT
) or until the list end is reached, which is an implicit OK
. If all lists return OK
, the message will be passed to the regular expressions checks, otherwise it will be rejected.
Next come the regular expression-based header_checks
and body_checks
. These options, if enabled, provide a means to test the actual contents of the headers and the body of the email, respectively. Both operate in the same way, though they should be used somewhat differently. Header checks can be used to prevent well-known spamming domains from sending you email, or for stopping some well-known bulk-mailer software. By entering some signature of the offender, like the domain name, or the X-mailer field identifying the software, the mail can be rejected before the body is even sent. Body checks, though the use the same regular expressions and file format as header checks, should be used more sparingly, as the mail must be accepted before it can be checked. Thus bandwidth is wasted on receipt of the mail, and worse, the server will be occupied for a potentially long while with processing the entire contents of every email. In short, use header checks whenever is convenient, and use body checks only when an effective header check cannot be devised. Only REJECT
or OK
are permitted for the returned values.
See also
- Postfix Basic Configuration
- Postfix Virtual Hosting