Postfix, written by Wietse Venema, is one of the most serious alternatives to Sendmail, along with Qmail and Exim. Because it is much more recent, it was built from the ground up to be as secure as possible. Postfix supports features such as ESMTP, ETRN (eg. two-way SMTP connections), LMTP (uses the LHLO command and expects to receive an ACK to check that the message is correctly delivered to each recipient), UUCP (to deliver mail between two servers with no access to the Net), AUTH to authenticate MATs at both ends (Cyrus-SASL supports AUTH), etc.
Postfix uses multiple programs to handle emails; The main process is called master, and uses its own configuration file called master.cf . Unlike Sendmail, and thanks to "postfix reload", there is no need to restart the whole of Postfix after a change is made to its configuration files. Postfix relies on three main configuration files: install.cf (generated when installing Postfix the first time; useful if you want to re-install it later), master.cf (used by the main process master), and main.cf (the meat).
In addition, Postfix relies heavily on hashed lookup tables: access, aliases, canonical, relocated, transport, virtual. Three binary formats are available: btree, hash, and dbm (BSD uses dbm; Linux usually uses hash). In addition, Postfix can use regex files, and information from external sources like NIS, LDAP, or MySQL. Two standards for regular expressions are available: regexp (POSIX), and Perl Compatible Regular Expressions (PCRE). Older Unices might not be available, so download PCRE.
The core programs are: master, bounce, cleanup, error, local, pickup, pipe, postdrop, qmgr, showq, smtp, smtpd, trivial-rewrite. Utilities are: mailq, postaliases, postcat, postconf, postfix, postkick, postlock, postlog, postmap, postsuper, sendmail. Postfix uses "postfix flush" to deliver spooled emails when receiving the ETRN command; Other commands used with the postfix program are abort, check, reload, start, and stop. Postfix uses different queues, in /var/spool/postfix, to reflect the different states an email find itself until it is finally delivered; a new file is created for each message; Queues are: maildrop, incoming, active, deferred, mail.
Postfix supports different ways to deliver emails:
If you wish to use mailboxes different from the default Sendmail scheme, the following directives are used: mail_spool_directory, home_mailbox, mail_box_command.
To enhance security, create a postfix.maildrop user under which to run postix, make this account the owner of the maildrop/ directory to make sure no other user can mess up with the files located in its sub-directories, and use the postdrop program to write messages. Messages are delivered by the programs local, smtp, pipe, or bounce.
Take advantage of the fact that Postfix can run chrooted (a script is provided in examples/chroot-setup).
Editing master.cf makes it possible to limit use of a service from a given host, eg. using "localhost: smtp", Postfix only accepts connection to the SMTP service from localhost.
By default, any remote MTA can run the ETRN command to download spooled emails for that domain. You can restrict which hosts are granted or refused access with the "smtpd_etrn_restrictions" directive.
Postfix offer good granularity on what data is accepted for any SMTP command:
Each of those directives can be defined by one or more values that either permit or deny access.
Postfix can search for any string in an incoming email:
Relaying means that a sender whose host lives in domain A, connects to your mailer in domain B to send an email to a user in domain C. A great aid to spammers. The easiest way to control relaying is to use the "smtpd_recipient_restrictions" directive; If this directive is left undefined, Postfix uses the information given in the directives "permit_mynetworks" and "check_relay_domains":
Note: permit_mynetwork is enough for most uses.
This restrictions comes before relaying: It tells Postfix which hosts are allowed to even connect to the SMTPd program. To limit access to your mailer, edit the access table (in main.cf: access???). Here's a sample:
user@domain
OK
hostname.domain
OK
domain
OK
a.b.c.d //full IP network address
REJECT
a.b.c //prefix of IP network address
XXX Go away
XXX stands for an SMTP error message. Some samples:
Possible restrictions come aplenty in Postfix. See the samples/sample-smtpd.cf for more information.
Edit main.cf, and set "alias_maps = /etc/postfix/mysql_alias.cf".
Edit /etc/postfix/mysql_alias.cf:
postconf (-n)
To force users to use either FTP or WebDAV to send big files, limit the size of allowed messages: message_size_limit (unit is 1K).
It's a good idea to hide the name of the MTA you are running and its version. To do this, edit main.cf, and set "smtpd_banner = $myhostname ESMTP". Also check if the name of the MTA is revealed by typing HELP.
Important: To avoid message loops, the FQDN hostname must be included in the login banner.
Either bounce the message, or forward it to another user or domain by editing main.cf, and setting "luser_relay = $user@other.host".
This lets users receive email in the form jdoe+mysoftware@acme.com without admins having to do anything. Edit main.cf, and set "recipient_delimiters = +". Next, have user jdoe create a file named .forward+mysoftware in his home directory, which contains a list of e-mail addresses that will receive a copy of any email addresses to that user-defined mailing list.
Two directives are supported in main.cf: alias_maps (both independent and Postfix-controlled files), and alias_database (Postfix-controlled files only).
The aliases file is used to forward incoming messages from a fake, public address (John.Doe) to a real, internal user account (jdoe). The canonical file is used to rewrite addresses in outgoing messages, either the From field, the To field, or both. This is useful to make sure that the names used match corporate rules, eg. rewrite jdoe as John.Doe. Edit main.cf, and change the following directives: canonical_maps, recipient_canonical_maps, and sender_canonical_maps .
Edit main.cf:
This file can be edited either directly (vi /etc/postfix/aliases ; newaliases (or postalias /etc/postfix/aliases) ; postfix reload), or through the postalias program: To check whether a key exists, use "postalias -q jdoe /etc/postfix/aliases". To insert a new key, run "echo jdoe | postalias -i /etc/postfix/aliases". To remove a key, run "postalias -d jdoe /etc/postfix/aliases".
Warning: When running the postalias command above, the text-based file /etc/postfix/aliases file is not updated, so I recommend doing it the manual way instead.
Just like the above, you can modify the content of main.cf either manually (vi /etc/postfix/main.cf ; postfix reload), or through a dedicated program: "postconf -e mykey=myvalue", or "postconf -n".
Besides manually editing the file, you can manipulate its content with: postmap -q katie virtual (to query), postmap -d katie virtual (to delete), echo katie katie@otherhost.net | postmap -i virtual (to include).
In case the server or Postfix crashed, it's a good idea to run postsuper -v before proceeding, so as to recover messages that were not properly handled because of the crash.
It is faster to look up keys and values in an indexed file than /etc/password. To force Postfix to first use a binary file, edit main.cf: local_recipient_maps=$alias_maps unix:passwd.byname .
Create a hash file, eg. /etc/postfix/relocated, and edit main.cf:
Edit main.cf, and set relayhost to the IP address of the mail server over at your ISP that will forward your outgoing emails to the Internet. By not requiring DNS lookups, using IP addresses offers better performance, and protects your mailer from a DNS failure.
If no mapping is required (ie. the user account used in the virtual address matches a unique account in /etc/passwd), you can simplify things by editing /etc/postfix/transport, and tell it to just deliver any email meant for virtual accounts locally. The latter is dangerous, however, because eg. any email for mike@abc.com and mike.@xyz.com will be delivered to the same mailbox.
In the following example, we'll create a Unix user account, tell Postfix to accept accounts for the virtual domain "testcompany.com", and have it forward any email meant for jdoe@testcompany.com to the real Unix account janed.
Here, we don't want to bother keeping an up-to-date mapping between virtual email addresses and Unix user accounts. This is OK if any user account is unique, regardless of the domain to which it belongs:
Important: Again, this shortcut only works if Unix user accounts are unique!
For instance, suppose that...
Now, any email meant for janed@acme.com or janed@testcompany.com is delivered into a single /var/spool/mail/janed (or whatever mailbox scheme you are using). For this reason, it is recommended to use The Standard Way.
If your network has no permanent connection to the Net, your ISP provides a relay mailer where emails for your team are spooled until you connect and download them. Likewise, any email sent through your Postfix intranet mailer to emails addresses on the Internet must be spooled locally, and sent when Postfix is connected to the Net.
A Postfix server is running in your public network, in front of a firewall, and forwards any emails from the Internet to a server in the private network, without storing emails locally.
Here, we have one Postfix mailer through which all incoming and outgoing emails are sent.
Emails meant for user joe is sent to host spoke1.small.org, where his mailbox lives:
All spokes must forward non-local emails to the hub, and masquerade address so that email address use the @small.org domain instead of the spoke's hostname.
I don't have a permanent connection to the Net, and my acts as smart host, ie. all incoming emails for my domain are temporarily spooled on the ISP's mail server. How do I tell Postfix to connect to it, and run the ETRN command to download spooled emails instead of using Fetchmail, which requires that users tell me their password?
Because each file has a different structure: For backward compatibility with Sendmail, /etc/postfix/aliases requires a ": " separator between two tokens; main.cf uses a "=" sign to separate a key and its value; Files like virtual use a space or tab character to separate a key and its value.
mydomain only rewrites headers, while masquerade_domain directive can rewrite headers and envelops.
In main.cf, the mydestination parameter does not include all the possible tokens right of the @ sign. This should include $myhostname, localhost.$mydomain, $mydomain, mail.$mydomain, and possibly others. Any email with a different token on the right side of the @ sign is considered to be meant for another mailer, and will be routed, ie. not delivered locally.
If you set up your intranet to use a fake domain name with no dot in it, eg. acme, Postfix gets confused:
The solution is to use a domain name with a dot in it, eg. intranet.acme .
# For various security reasons, postfix WILL NOT deliver mail as root, so ensure that the root alias is aliased to a HUMAN user, as otherwise # mail may get delivered to the $default_privs user (nobody).
(snip)
root: amy
Add the following to main.cf: biff = no
With hostname as mylinux.acme, and the following:
Logged locally on mailer, and sending email to ffaure:
In other words, in incoming emails that have no domain specified, Postfix makes up a domain by concatenating $myorigin and $mydomain.
... as an alternative to using FetchMail (requires asking users for their POP password)
/usr/man/man1/mailq.1.gz /usr/man/man1/newaliases.1.gz /usr/man/man1/postalias.1.gz /usr/man/man1/postcat.1.gz /usr/man/man1/postconf.1.gz /usr/man/man1/postdrop.1.gz /usr/man/man1/postfix.1.gz /usr/man/man1/postkick.1.gz /usr/man/man1/postlock.1.gz /usr/man/man1/postlog.1.gz /usr/man/man1/postmap.1.gz /usr/man/man1/postsuper.1.gz /usr/man/man1/sendmail.1.gz /usr/man/man5/access.5.gz /usr/man/man5/aliases.5.gz /usr/man/man5/canonical.5.gz /usr/man/man5/pcre_table.5.gz /usr/man/man5/regexp_table.5.gz /usr/man/man5/relocated.5.gz /usr/man/man5/transport.5.gz /usr/man/man5/virtual.5.gz /usr/man/man8/bounce.8.gz /usr/man/man8/cleanup.8.gz /usr/man/man8/defer.8.gz /usr/man/man8/error.8.gz /usr/man/man8/flush.8.gz /usr/man/man8/lmtp.8.gz /usr/man/man8/local.8.gz /usr/man/man8/master.8.gz /usr/man/man8/nqmgr.8.gz /usr/man/man8/pickup.8.gz /usr/man/man8/pipe.8.gz /usr/man/man8/qmgr.8.gz /usr/man/man8/showq.8.gz /usr/man/man8/smtp.8.gz /usr/man/man8/smtpd.8.gz /usr/man/man8/spawn.8.gz /usr/man/man8/trivial-rewrite.8.gz
D'apr鑚 la page Web d'AMaViS, il existe plusieurs antivirus pour Linux/Unix : MacAfee uvscan, version d'騅aluation limit馥 ? 30 jours d'utilisation. Le binaire continue ? fonctionner au bout des trente jours, mais c'est une question morale : il faut acheter une licence d'utilisation. Les fichiers .DAT, contenant les signatures des virus connus et la mani鑽e de s'en d饕arrasser, sont exactement les m麥es que pour DOS/Windows, il est donc facile de mettre ? jour r馮uli鑽ement l'antivirus, le moteur restant le m麥e. Dr Solomon Antivirus Toolkit, binaire SCO Unix, ? utiliser avec le module iBCS, non test? ; AntiVir/X, gratuit pour une utilisation non commerciale, prometteur car il s'int鑒re bien avec AMaViS, mais je n'ai pas r騏ssi ? le faire fonctionner -- probl鑪es de biblioth鑷ues partag馥s en version glibc -- peut-黎re que 軋 fonctionne bien en glibc 2.1 ; Sophos Antivirus, commercial, non test?. ftp://ftp.mcafee.com/pub/antivirus/unix/ Si on parle du meme Sanitize (a savoir celui de http://mailtools.anomy.net/sanitizer.html), c'est un script Perl appele par procmail (son appel et gere via le fichier procmailrc). Le processus est celui la : MTA --- MDA (aka procmail) --- Sanitize --- mailbox Amavis, lui, s'intercale entre le MTA et le MDA (procmail par defaut, et ca tombe bien, ca nous arrange), selon un schema de ce genre : MTA --- Amavis --- MDA --- mailbox Il n'y a donc aucune restriction a pouvoir utiliser Amavis et Sanitize en meme temps. On aura alors : MTA --- Amavis --- MDA --- Sanitize --- mailbox Donc, oui, on peut utiliser les deux en meme temps. Cependant, cela suppose que tu utilises procmail comme MDA. Or, dans sa configuration par defaut, Postfix inclue son propre MDA. Il te faudra donc faire deux choses : 1. dire a Postifx que son MDA est Amavis (ce qui doit deja etre fait). 2. dire a Amavis qu'il utilise procmail et non le MDA Postix (i.e. revenir a la configuration par defaut). 3. Installation du scruteur de courrier 駘ectronique
AMaViS est maintenant distribu? sous licence GPL. Ceci veut dire entre autres que nous disposons du code source du programme et que nous pouvons contr?ler ce qu'il fait (a contrario des programmes d'antivirus qui ne sont distribu駸 que sous forme binaire). Son installation est simple. Apr鑚 avoir d馗ompress? les sources, un script ./configure facilite la compilation. Il suffit d'effectuer les 騁apes suivantes : $ ./configure --prefix=/usr/local/antivirus $ make # make install L'騁ape de configuration recherche un antivirus sur le syst鑪e, en particulier elle cherche uvscan dans les r駱ertoires /usr/bin et /usr/local/bin. Vous vous souvenez des liens symboliques que nous avons faits tout ? l'heure ? Voici une explication de leur utilit? ! Assurez-vous aussi d'avoir install? le binaire metamail (g駭駻alement dans le paquet du m麥e nom dans votre distribution), car c'est le programme utilis? pour s駱arer les attachements des courriers re輹s. J'ai cherch? pendant pas mal de temps pourquoi 軋 ne marchait pas avant de comprendre ce qui manquait... Le principal 駘駑ent d'AMaViS est un script shell : scanmails, qui prend le courrier 駘ectronique sur l'entr馥 standard (c'est sendmail qui lui envoie), passe chaque attachement ? l'antivirus et, selon le r駸ultat, envoie le courrier ? l'agent de livraison s'il n'y a pas de virus d騁ect?, ou envoie un courrier ? l'administrateur en cas de probl鑪es. Assurez-vous ensuite d'avoir un alias nomm? virusalert dans les aliases de courrier 駘ectronique. C'est en effet l'adresse ? laquelle un courrier est envoy? en cas de d馗ouverte d'un virus dans un courrier. Toutefois, cette adresse est param騁rable dans le script scanmails. Ensuite, il faut penser au fichier de log, qui est situ? par d馭aut dans /var/log/scanmails/logfile. Il faut donc cr馥r le r駱ertoire /var/log/scanmails/ et peut-黎re m麥e le fichier logfile. Attention, avec sendmail l'agent de distribution (le programme sendmail lui-m麥e) tourne en tant que root, alors que pour Postfix, l'agent de distribution (le programme local) tourne en tant qu'utilisateur postfix. Il faut en tenir compte, car c'est cet utilisateur qui va 馗rire dans le fichier de log. Je pr馗onise donc les manipulations suivantes : # mkdir /var/log/scanmails # touch /var/log/scanmails/logfile # chown postfix:postfix /var/log/scanmails /var/log/scanmails/logfile Un dernier petit point ? r馮ler, c'est celui des logs g駻駸 avec syslog. En effet, scanmails envoie ? syslog (c'est param騁rable) une notification d'ex馗ution, avec la priorit? mail.info. Le fichier /var/log/mail.info grandira alors lui aussi. Il faudra penser ? regarder et purger p駻iodiquement les fichiers /var/log/mail.info et /var/log/scanmails/logfile.
4.1 Postfix La configuration de Postfix pour passer le courrier ? l'antivirus est la suivante : il y a une variable mailbox_command permettant de sp馗ifier ? Postfix un programme de livraison externe. G駭駻alement, cette variable n'est pas utilis馥 et on laisse Postfix g駻er lui-m麥e la livraison, ou bien, pour les sites utilisant procmail comme agent de livraison, la variable devient : mailbox_command = /usr/bin/procmail Pour utiliser AMaViS avec Postfix, il suffit de modifier cette variable en : mailbox_command = /usr/local/antivirus/sbin/scanmails dans le fichier /etc/postfix/main.cf. Le tour est jou? ! Un petit coup de postfix reload pour prendre cette modification en compte et Postfix pourra alors passer le courrier entrant ? l'antivirus.
5. Tests de l'installation Les tests ne sont pas trop p駭ibles et permettent de v駻ifier que l'installation fonctionne correctement : c'est la partie qu'il ne faut pas oublier, sinon il est difficile de voir ォ si 軋 marche サ et de comprendre pourquoi ォ 軋 ne marche pas サ. Si l'installation n'est pas effectu馥 correctement, il est possible que tous les courriers 駘ectroniques passent sans 黎re v駻itablement v駻ifi駸, et donc l'installation d馗rite ci-dessus ne sert ? rien ! (ヌa sent le v馗u, oui oui).
5.1 Un fichier contenant une signature de virus Comme il serait tr鑚 mal venu de faire les tests avec un vrai virus, il existe une signature de test permettant de tester sans douleur un antivirus. Cette signature est cit馥 sur le site Web d'AMaViS. Mettez dans le fichier eicar.com la cha?ne suivante : X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* Le fichier r駸ultant doit faire 69 octets. C'est ce fichier qui nous permettra de tester le syst鑪e.
5.2 Test de l'antivirus En premier lieu, nous allons tester l'antivirus. Pour cela, lancez simplement la commande suivante : $ uvscan eicar.com En plus des informations sur la licence du logiciel, uvscan doit vous donner le r駸ultat suivant : File eicar.com is infected with EICAR-STANDARD-AV-TEST-FILE Si ce n'est pas le cas, n'allez pas plus loin ! Vous avez d駛? un probl鑪e sur le fonctionnement de votre antivirus. Si vous avez un message tel que : Missing or invalid virus info file Check the location and integrity of your data files. c'est sans doute un probl鑪e avec les liens symboliques : v駻ifiez que /usr/local/lib/neta pointe sur le r駱ertoire dans lequel vous avez mis les fichiers .dat !
5.3 Test du scanner C'est sans doute l'op駻ation la plus d駘icate des tests, car il faut l'ex馗uter avec les droits du processus qui appelle scanmails. C'est root dans le cas de Sendmail, postfix dans le cas de Postfix... Si Postfix a 騁? install? correctement, son r駱ertoire HOME et son shell de login doivent 黎re invalides. J'ai perdu pas mal de temps ? modifier les permissions du fichier de log afin de faire les tests en tant qu'un autre utilisateur, avant de me rendre compte que le probl鑪e venait d'ailleurs : metamail n'騁ait pas install?... :-( A priori, scanmails fonctionne correctement, je sugg鑽e donc de continuer les tests avec le serveur de courrier.
5.4 Test du serveur de courrier C'est l'騁ape ultime. Ayez des fen黎res dans lesquelles vous ferez d馭iler (avec tail -f, par exemple) les fichiers de log divers, tels que /var/log/mail.log ou /var/log/scanmails/logfile. N'h駸itez pas ? num駻oter les courriers que vous envoyez, afin de les diff駻encier. Envoyez-vous un courrier normal, qui devrait vous parvenir sans encombre. Envoyez maintenant un courrier en attachant le fichier eicar.com construit pr馗馘emment. Le courrier doit 黎re refus?, root (ou la personne recevant le courrier destin? ? virusalert) doit recevoir une notification comme quoi un courrier contenait un virus, et le destinataire (local, donc) doit recevoir un courrier indiquant qu'il a failli recevoir un courrier v駻ol?, ? voir avec l'administrateur syst鑪e. Normalement, le courrier contenant le virus doit atterrir dans le r駱ertoire /root/virusmails, il serait judicieux de le cr馥r et d'en donner les droits au propri騁aire du processus qui fait la livraison (donc ? l'utilisateur postfix pour Postfix, ? root pour Sendmail). Si tout s'est bien pass?, votre syst鑪e fonctionne !
5.5 Si 軋 ne fonctionne toujours pas... Assurez-vous d'avoir lu tous les fichiers d'aide et les README que vous trouverez ; ce document est un guide d'installation, mais il ne vous dispense pas de lire les documentations fournies avec les programmes, pour vous permettre une compr馼ension plus approfondie qu'une simple ォ recette de cuisine サ.
This method has the advantage that it leaves the actual delivering of the mail to a server which is connected permanently to the Internet. This server has a better chance to deliver mail to servers which are hard to reach or are temporarily disconnected. The disadvantage is that you usually have to use the mail-address given to you by your provider. Most providers do not allow relaying mail using a self-made sender-address for spam-protect reasons.
Add this line to 'main.cf': relayhost = [mail.provider.com] [mail.provider.com] is the name of your provider's SMTP server. Edit '/etc/postfix/aliases' and change the second field of the last line (" Person who should get root's mail") to your user account. Now build 'aliases.db' with postalias /etc/postfix/aliases Important: Issue this command, even if you haven't made any changes to 'aliases'! Postfix won't work without a 'aliases.db' file!
If you use Dial-On-Demand, you want to prevent Postfix from delivering mail if you do not explicitely tell it to do so. Add this line to 'main.cf': defer_transports = smtp If your machine is part of a local network which doesn't provide DNS, you should turn off DNS lookups: disable_dns_lookups = yes To get the mail out every time you connect to the Internet, create the file 'ip-up.local' in '/etc/ppp' and put these lines in it: #!/bin/bash /usr/sbin/sendmail -q Save and run chmod +x /etc/ppp/ip-up.local to make the file executable.
Received: from bigfoot.com (bflitemail6.bigfoot.com [208.156.39.208]) by front2.grolier.fr (8.9.3/No_Relay+No_Spam_MGC990224) with SMTP id TAA03210 for; Mon, 4 Sep 2000 19:07:07 +0200 (MET DST) Received: from orlando.ftci.net ([62.161.120.245]) by BFLITEMAIL5.bigfoot.com (LiteMail v2.43(BFLITEMAIL5)) with SMTP id 04Sep2000_BFLITEMAIL5_33200_45452172; 2000年9月04日 13:07:06 -0400 EST Received: from ffaure.ftci.net (unknown [192.168.1.43]) by orlando.ftci.net (Postfix) with ESMTP id 1D4FB36D6A for ; Mon, 4 Sep 2000 19:00:08 +0200 (CEST) Message-Id: <5.0.0.13.0.20000904150304.00a28020@mail.ftci.net> X-Sender: ffaure@mail.ftci.net X-Mailer: QUALCOMM Windows Eudora Version 5.0.0.13 (Beta) Date: 2000年9月04日 17:25:32 +0200 To: ffaure@bigfoot.com From: Frederic Faure Subject: Postfix Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Status: X-Mmail: \Recent X-M-Uid: 0001071.968087227 1. Add cp -pf /etc/resolve.conf /var/spool/postfix/etc/ in /etc/cron.daily to avoid having to copy/paste whenever any change is made to the former. 2. [root@orlando /root]# less /etc/postfix/main.cf #Undocumented feature.... biff = no #So Postfix doesn't needlessly bounce to SPAMmers luser_relay = /dev/null On Mon, Sep 04, 2000 at 03:03:52PM +0000, Ralf Hildebrandt wrote: > >That's what local_recipient_maps is for. You can bounce emails for non-existant > >users before actually receiving it, just as with sendmail: > >local_recipient_maps = $alias_maps, $virtual_maps, unix:passwd.byname > > Note that unix:passwd.byname might give you some troubles when running > chrooted. At least on HP-UX I had some troubles with that. Probably. Actually I have all of my users in $virtual_maps (because their mails may be delivered to different maildrops), but getpwnam() may cause problems when running chrooted. It is the same problem that applies for SASL and /etc/passwd, as SASL also uses getpwnam when asked to work with /etc/passwd... 3. Still NOK #FF : warning: restriction `reject_maps_rbl' after `check_relay_domains' is ignored maps_rbl_domains = rbl.maps.vix.com, dul.maps.vix.com smtpd_recipient_restrictions = permit_mynetworks,check_relay_domains,reject_maps_rbl Sep 4 16:35:55 orlando postfix/smtpd[13316]: warning: restriction `reject_maps_rbl' after `check_relay_domains' is ignored
Soit directe (voir mail_spool_directory = /var/spool/mail)
Soit via un agent externe : mailbox_command = /usr/bin/procmail
Anti-relayage: Remplir mynetworks = 192.168.0.0/24, ... (ou via /etc/postfix/fichier)
Remplir relay_domains = (idem) smtpd_recipient_restrictions = permit_mynetworks,check_relay_domains
Eventuellement, ajouter "permit_mx_backup" si on ne connait pas tous les domaines dont on est MX secondaire.
Configuration anti-spam : utilisation de liste noire
Dans la connexion:
# Ne pas accepter les machines sans DNS inverse (stupide et dangereux)
# Spammers a mettre dehors ? la connexion smtpd_client_restrictions = reject_unkown_client, hash:/etc/postfix/Access
Dans le MAIL FROM: smtpd_sender_restrictions = hash:/etc/postfix/Access, reject_non_fqdn_sender, reject_unknown_address, reject_maps_rbl
Dans le RCPT TO: smtpd_recipient_restrictions = permit_mynetworks, check_recipient_access hash:/etc/postfix/accesseveryone, check_relay_domains
Par d馭aut, les erreurs sont renvoy馥s ? la fin de la phase (cf smtpd_delay_reject)
Autres param鑼res: smtpd_helo_required, smtpd_etrn_restrictions, ...
Recevoir les messages rejet駸 : notify_classes = resource,software,bounce,policy,protocol,delay error_notice_recipient = (postmaster par d馭aut)
Utilisation d'une table standard: transport_maps = hash:/etc/postfix/transport domaine.com smtp:[interne.domaine.com] pauvre.domaine.com uucp:pauvre .domaine.com smtp:[interne.domaine.com]
Utilisation de regexp: transport_maps = regexp:/etc/postfix/regtrans /(.*)\.anciendomaine\.com/ smtp:[1ドル.nouveaudomaine.com]
On peut dupliquer des transports dans master.cf (par exemple pour avoir un nombre fix? de d駑ons SMTP pour les machines internes). smtpint unix - - y - 10 smtp yoko.hsc.fr smtpint:[yoko.hsc.fr]
Masquerading: masquerade_domains = domaine.fr : r鳬crit tout user@machine.domaine.fr en user@domaine.fr masquerade_exceptions = root : permet de sp馗ifier que root n'est pas r鳬crit (comportement par d馭aut de sendmail).
Canonical: canonical_maps = hash:/etc/postfix/canonical user autreuser user@domaine1.fr autreutilisateur@domaine5.fr @domaine1.fr @domaine2.fr @domaine3.fr user@domaine4.fr Variantes : sender_canonical_maps et recipient_canonical_maps
On peut aussi utiliser les regexp, mysql, ...
Permet d'h饕erger plusieurs domaines sur la m麥e machine sans r鳬crire les headers (ne r鳬crit que l'enveloppe): virtual_maps = hash:/etc/postfix/virtual domaine0 nimportequoi user1@domaine1 adresse1,adresse2,... user2 adresse3,adresse4, .... (comme les alias) @domaine3.fr adresse5,adresse6,... @domaine4.fr @domaine5.fr (pas de changement de la partie gauche)
Utilisateur en dialup-ip
Contraintes: Envoie tout au serveur de son FAI A un domaine non existant ? cacher Re輟it par fetchmail a un r駸eau interne pour le reste de la famille.
Configuration: mydestination=machine.domaine.maison,localhost.domaine.maison,domaine.maison myorigin=machine.domaine.maison relayhost=smtp:[mailhost.fai.fr] disable_dns_lookups=yes deferred_transport=smtp sender_canonical_maps=hash:/etc/postfix/canonical mynetworks=192.168.3.0/24,127.0.0.1 La table /etc/postfix/canonical contient: monlogin monadresse@fai.fr papa adressedepapa@fai.fr maman adressedemaman@fai.fr # Pour inn et les groupes mod駻駸 news monadresse@fai.fr