Previous Contents Next

4. Postfix

4.1 Installation

Installation is quite easy if you use Redhat. Either grab the postfix rpm from the Powertools CD or download the rpm from Redhat's FTP server. Then install the rpm on your server by typing

rpm -ihv <postfix-rpm>

4.2 Modify main.cf

Most of the configuration for postfix is done in the file "main.cf" in the /etc/postfix directory. The directives below must be changed to match your configuration. Additional explanation can be found in main.cf. Parameter with a "$" sign in front are variables, which are replaced by its contents by postfix. $myhostname will be replaced by mail.linuxnetworks.de through the directive below.

Internet Hostname

The name of your mail server also known by the DNS. It is the same full qualified domain name as in the MX record of your (or your provider's) DNS server.

myhostname = mail.linuxnetworks.de

Domain Name

Your domain name is usually the combination of the second and top level domain. Replace the example below with your domain name.

mydomain = linuxnetworks.de

Mail Origin

Locally posted emails appears to come from this address. All email accounts will look like account@secondleveldomain.tld.

myorigin = $mydomain

Network interfaces

Postfix can be configured to listen on all or only on certain interfaces. It will accept connections (and emails) only on those interfaces. Possible are "all" interfaces or hostnames and IP addresses.

inet_interfaces = all

Destination

A list of domain names that this server consider itself as final destination.

mydestination = $myhostname, localhost.$mydomain, $mydomain

Trusted Networks

Clients in this networks are allowed to send emails to recipients outside our mail domain. This will block relaying of spam from outside. If you use this directive, disable the mynetworks_style line. They have the same functionality, but mynetworks gives you a finer control. Exchange the first parameter by our subnet.

mynetworks = 192.168.1.0/24, 127.0.0.0/8

Mail accounts

If an email arrives, postfix will look in its alias databases for entries matching this address. If an entry is found, than the mail is accepted, othervise it will be bounced. The "ldap:ldapaliases" parameter points to the LDAP server defined in the next section.

alias_maps = hash:/etc/postfix/aliases ldap:ldapaliases

Cyrus Imap Server

Drops all emails to the corresponding accounts of the Cyrus Imap server.

local_transport = cyrus

4.3 Configure LDAP

The following explanations of the parameter are taken directly from the postfix LDAP example file and extended by some additional comments. Append this lines on /etc/postfix/main.cf after you applied your modifications.

LDAP Hostname

The ldapaliases_server_host parameter specifies the LDAP server hostname. This is usually "localhost" as long as your LDAP server doesn't run on a different machine.

ldapaliases_server_host = localhost

Port

The ldapaliases_server_port parameter specifies the LDAP server port number. Not encrypted connections are acceptable, if postfix and OpenLDAP runs on the same server, otherwise change to 636 to encrypt the transport.

ldapaliases_server_port = 389

Search Base

The ldapaliases_search_base parameter specifies the LDAP tree to search. Replace the top and second level domain by your domain code.

ldapaliases_search_base = ou=user,dc=linuxnetworks,dc=de

Search Scope

The ldapaliases_scope parameter specifies the LDAP search scope: sub, base, or one. The LDAP server searches all subtrees under ldapaliases_ldap_search_base if "sub" is specified.

ldapaliases_scope = sub

Bind

The ldapaliases_bind parameter specifies whether or not to bind to the server. LDAP v3 implementations don't require it, which saves some overhead.

ldapaliases_bind = no

Email Addresses

The ldapaliases_query_filter parameter specifies the filter used for queries. It returns the object (user) which matches the mail address. MailLocalAddress can contain several email addresses at once for different mail aliases.

ldapaliases_query_filter = (maillocaladdress=%s)

Email Account

The ldapaliases_result_attribute parameter specifies the attribute returned by the search. The message will be sent to this email account (or maybe it is possible to send it to more than one account, if there are more email addresses included).

ldapaliases_result_attribute = mailroutingaddress

Alias Handling

The ldapaliases_deference parameter specifies how to handle LDAP aliases. See the ldap_open(3) man page. "3" means to always dereference an alias.

ldapaliases_dereference = 3

Timeout

The ldapaliases_lookup_timeout parameter specifies the timeout for LDAP database lookups.

ldapaliases_timeout = 10

Cache

The ldapaliases_cache parameter specifies whether or not to turn on client-side caching.

ldapaliases_cache = yes

Cache Expiration

The ldapaliases_cache_expiry parameter specifies how many seconds to cache results for (if ldapaliases_cache=yes)

ldapaliases_cache_expiry = 30

Cache Size

The ldapaliases_cache_size parameter specifies the cache size, in bytes.

ldapaliases_cache_size = 32768


 

Previous Contents Next