LinuxHowtoCourierConfig
Courier HOW TO konfigurace
Postupy
[+]
Doručení emailu
[+]
- Pokud je cílová doména uvedena v ESMTPACCEPTMAILFOR, email se přijme k dalšímu zpracování, jinak se odmítne RELAY
- Pokud je cílová doména uvedena v HOSTEDDOMAINS nebo v LOCAL, pokusí se email doručit lokálně:
- Vyhledá se alias, např. pomocí CourierLdapAliasD
- Po případném resolvování předá email k dalšímu doručení, buď na jiný server, nebo lokálně vyhledá cíl pomocí CourierAuthD, např. v LDAP.
- Pokud není email určen pro lokální stroj, předá se email k dalšímu doručení:
- Pokud je cílová doména uvedena v ESMTPROUTES, předá se email na zadaný stroj, jinak se provede vyhledání podle DNS (MX a A).
Příjem emailu
[+]
Přidat doménu do ESMTPACCESSPTMAILFOR a spustit makeacceptmailfor
Předání emailu na jiný server
[+]
Přidat pro doménu záznam do ESMTPROUTES
Doručení emailu lokálně
[+]
- Pro vyhledávání účtu pouze podle jména bez domény, zadat doménu do souboru LOCAL
- Pro vyhledávání účtu podle celé emailové adresy, zadat doménu do HOSTEDDOMAINS, spustit makehosteddomains a restartovat Courier
Povolit RELAY pro vybraný host nebo síť
[+]
Zadat adresu do SMTPACCESS a spustit makesmtpaccess (a možná restartovat Courier)
Vyhledávání uživatelů v LDAPu
[+]
- Nakonfigurovat authlib/authldaprc
- Do proměnné authmodulelist v authlib/authdaemonrc přidat položku authldap
Používání aliasů ze LDAPu
[+]
Nakonfigurovat ldapaliasrc a povolit v ldapaliasrc pomocí LDAP_ALIAS 1
Vypnuti AUTH
[+]
Do souboru
/etc/courier/esmtpd pridat paremetr -noidentlookup
TCPDOPTS="-stderrlogger=/usr/sbin/courierlogger -noidentlookup"
Konfigurační soubory
[+]
bofh
[+]
maxrcpts N [hard]
Accept the first N recipient addresses per message, maximum. The remaining recipients are rejected. An optional verbatim token "hard" specifies that the remaining recipients will immediately be returned as undeliverable (otherwise the remaining recipients are rejected as "temporary unavailable", and may be accepted on a later delivery attempt). If not specified, the first 100 recipients are accepted.
esmtpacceptmailfor
[+]
This file lists all domains that Courier accepts mail for via ESMTP. This file is in the same format as the locals file. If this file is missing, Courier uses the single domain specified in me (or the system machine name).
esmtproutes
[+]
This file is used by the ESMTP module, and it contains one or more lines in the following form:
domain:relay[,port][/SECURITY=STARTTLS][/SECURITY=NONE]
domain is any SMTP domain. relay specifies a fixed mail relay for this domain. relay is optionally followed by a comma and a port number, to specify a port other than the default port 25. If an address's domain is not found in esmtproutes, Courier looks for MX and A records as usual (and always delivers to port 25). If the domain is found in esmtproutes, however, any MX or A records for the domain are ignored; instead Courier delivers the message to the specified relay.
relay can be another domain, or an explicit IP address inside brackets. For example, if esmtproutes contains the following:
example.com: relay.domain.com
domain.com: [192.168.0.2]
Mail for example.com is delivered to relay.domain.com, ignoring any MX records for example.com. Mail for domain.com will be delivered to the machine at IP address 192.168.0.2. All other domains will have their MX and A records looked up.
NOTE:
Unlike Qmail, Courier looks up MX and A records for relay.example.com (Qmail only looks up A records).
esmtproutes may contain comments, any line that starts with the # character is ignored. Also, wildcards are allowed:
.example.com: [192.168.0.3],26
This specifies that any address of the form <anything@anything.example.com> will be delivered to the mail server at this IP address, but on port 26.
esmtproutes is read from top to bottom, stopping as soon as a first match is found.
domain may be empty, this specifies a smarthost for all domains. For example, if esmtproutes contains the following text:
example.com: relay.example.com
:[192.168.0.4]
This specifies that all mail to example.com is rerouted to relay.example.com. All other mail is routed to the IP address 192.168.0.4.
If relay is empty, Courier interprets it as an explicit directive to use MX and A records from DNS. For example:
example.com:
:[192.168.0.4]
This uses MX and A records for all messages to example.com. All other mail is rerouted to the IP address 192.168.0.4.
The optional /SECURITY=STARTTLS flag indicates that mail to this domain should be automatically upgraded to use the SECURITY ESMTP extension. See the Courier installation notes for a description of SECURITY, what it does, and how to configure it.
The /SECURITY=NONE flag prevents Courier from using the STARTTLS ESMTP extension even if the remote server claims to support it. Use this flag to deliver mail to misconfigured Microsoft Exchange relays that claim to support STARTTLS, but always report a failure to a STARTTLS request.
Changes to this file take effect immediately, more or less. Existing courieresmtp processes that already have an established connection will ignore any changes.
hosteddomains
[+]
This file lists locally-hosted domains. It is very similar in function to the locals control file. Any address with a domain listed in hosteddomains is considered to be a local address. The difference between hosteddomains and locals is that domains listed in hosteddomains are not removed from individual addresses before looking up the location of their mailboxes. For example, if the domain "example.com" appears in locals, the address user v(e) example.com will have example.com removed, and then Courier will look for a local mailbox named "user".
If the domain "example.com" appears in hosteddomains instead, Courier will look for a local mailbox named "user@example.com" instead.
The contents of the hosteddomains configuration file is a list of domains, one per line, in lowercase. You must run the makehosteddomains command for any changes to take effect.
Additionally, hosteddomains can specify simple domain aliases. See the complete description in the makehosteddomains(8) manual page.
locals
[+]
This file contains one or more lines of text, where each line contains a valid mail domain. Any E-mail address without @domain, or with a domain that can be found in locals will be considered to be an address of a local mailbox. A domain can be specified with a leading dot:
.domain.com
This is called a "wildcard". Any domain ending in domain.com, such as a.domain.com, b.domain.com, a.b.c.domain.com - but NOT somedomain.com - will be considered local. Note that domain.com is NOT included in this wildcard. Both "domain.com" and ".domain.com" should be listed.
Specific hosts can be excluded from the wildcard. Example:
!host.domain.com
.domain.com
anything.domain.com is considered to be a local domain, except for host.domain.com. Note that "!host.domain.com" must appear in locals before the .domain.com wildcard.
The "!hostname" syntax is also valid in the esmtpacceptmailfor control file.
If locals does not exist, Courier uses the contents of the me control file (note that me specifies only one domain, second and subsequent lines are ignored). Also, see hosteddomains.
maildropfilter
[+]
This file contains one line whose contents is a pathname to the maildrop(1) mail delivery agent. If Courier knows that the delivery agent used to delivery mail locally is maildrop(1) then certain delivery optimizations are possible. This configuration file does NOT actually specify that maildrop(1) should be used as a local mail delivery agent, it only specifies where maildrop(1) is installed. The default local mail delivery instructions are specified in the courierd configuration file. If the specified delivery instruction specify running an external program whose pathname matches the one specified by this configuration file, Courier assumes that it's maildrop(1), and will use maildrop-specific options to optimize mail delivery.
This configuration file is initialized, by default, to point to the version of maildrop(1) that's integrated with Courier. The integrated version of maildrop(1) is configured slightly differently than the standalone version of maildrop(1).
Although you can set the maildrop configuration file to point to some other version of the maildrop mail filter, you MUST set the maildropfilter configuration file (see below), to point to the integrated version of maildrop.
maildroprc
[+]
This file contains systemwide mail filtering instructions for maildrop(1) deliveries. This configuration file is optional, and is used by maildrop(1) when it is invoked as a traditional post-delivery mail filter. See maildropfilter(6) for more information.
me
[+]
This file contains one line whose contents is a valid machine name. When a single installation of Courier is shared over a network, each machine that's running Courier must have a unique me file. If me is missing, Courier uses the result of the gethostname() system call. NOTE: If you change the contents of this configuration file, you must run the makealiases command again, else your mail will promptly begin to bounce. If you don't have this configuration file defined, and you change the system's network host name, you also must run makealiases.
sizelimit
[+]
Maximum size of the message, in bytes, that Courier accepts for delivery. Courier rejects larger messages. If sizelimit is set to zero, Courier accepts as large message as available disk space permits. If the environment variable SIZELIMIT is set at the time a new message is received, it takes precedence and Courier uses the contents of the environment variable instead. Changes to this file take effect immediately. The SIZELIMIT environment variable is for use by individual mail submission agents. For example, it can be set by the smtpaccess configuration file (see makesmtpaccess(8) for more information) for mail from certain IP addresses. If sizelimit does not exist, and SIZELIMIT is not set, the maximum message size defaults to 10485760 bytes.
smtpaccess
[+]
netblock<tab>deny
192.68.0<tab>deny
192.68.0.10<tab>allow
192.68.0<tab>allow,RELAYCLIENT
192.68.0.10<tab>allow,RELAYCLIENT,SIZELIMIT=1000000
- BLOCK If this variable is set to a non-empty value, all mail will be rejected for this connection. The contents of the environment variable will be used as the error message. This is not the same as the couriertcpd access file setting that immediately drops the connection. The incoming connection is accepted, but every message will be rejected.
- FAXRELAYCLIENT Allow the client to send faxes via the courierfax(8) module. NOTE: When ESMTP authentication is enabled, a successful authentication automatically sets FAXRELAYCLIENT.
- RELAYCLIENT Allow the client to relay mail. NOTE: When ESMTP authentication is enabled, a successful authentication automatically sets RELAYCLIENT.