The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации

6. Configuring Postfix

Postfix needs two major config files: main.cf and master.cf. Both needs your attention.

6.1. master.cf

You need to change just one line:

old:

flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}

new:

flags= user=cyrus argv=/usr/cyrus/bin/deliver -r ${sender} -m ${extension} ${user}

What affect that changes?

A look to the cyrus man-pages man deliver clears that issue:

The Postfix default setup uses a wrong path to cyrus deliver, this is the first change. The parameter ╩-r╚ Inserts a proper return path, without that mail rejected/retured by sieve will be sent to the cyrus user at yourdomain.

6.2. main.cf

Here you need to change some more things like hostname, relaying, alias-lookups etc.

First change hostname:

myhostname = foo.bar.org

mydestination

Here you have to put all domainnames that are local (corresponding to sendmail's /etc/mail/sendmail.cw). If you have multiple domains separate them with comma.

mydestination = foo.bar.org, example.com, furchbar-grausam.ch, 
 whatever.domain.tld, mysql:/etc/postfix/mysql-mydestination.cf

Relayhost

Here you define where to deliver outgoing mails. If you do not provide any host. mails are delivered directly to the destination smtp host. Usually your relayhosts are your providers smtp-server.

relayhost = relay01.foobar.net relay02.foobar.net relay03.foobar.net

Mailtransport

Here you define how the mails accepted for local delivery should be handled. In your situation mails should be delivered by the cyrus delivery-program.

mailbox_transport = cyrus

At the end of file you need to add:

virtual_maps = hash:/etc/postfix/virtual, mysql:/etc/postfix/mysql-virtual.cf

If you dont want to have a overriding /etc/postfix/virtual, skip the hash entry

Outgoing addresses should be rewritten from i.e test0002 at domain to user.name at virtualhost.com. This is important if you like to use a webmail interface.

sender_canonical_maps = mysql:/etc/postfix/mysql-canonical.cf 

Now you need to create the file /etc/postfix/mysql-virtual.cf:

#
# mysql config file for alias lookups on postfix
# comments are ok.
#

# the user name and password to log into the mysql server
hosts = localhost
user = mail
password = secret

# the database name on the servers
dbname = mail

# the table name
table = virtual

#
select_field = dest
where_field = alias
additional_conditions = and status = '1'

The file /etc/postfix/mysql-canonical.cf:

# mysql config file for canonical lookups on postfix
# comments are ok.
#

# the user name and password to log into the mysql server
hosts = localhost
user = mail
password = secret

# the database name on the servers
dbname = mail

# the table name
table = virtual
#
select_field = alias
where_field = username
# Return the first match only
additional_conditions = and status = '1' limit 1

Finally the file /etc/postfix/mysql-mydestination.cf:

# mysql config file for local domain (like sendmail's sendmail.cw) lookups on postfix
# comments are ok.
#

# the user name and password to log into the mysql server
hosts = localhost
user = mail
password = secret

# the database name on the servers
dbname = mail

# the table name
table = domain
#
select_field = domain_name
where_field = domain_name

SMTP Authentication with SASL and PAM

Put the following in your /etc/postfix/main.cf

smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = example.com
broken_sasl_auth_clients = yes

You also need to create the file /usr/local/lib/sasl2/smtpd.conf with the following content:

pwcheck_method: saslauthd

The next step is make the saslauthd socket being found by postfix:

mv /var/run/sasl2 /var/run/sasl2-old
ln -s /var/run/saslauthd /var/run/sasl2



Спонсоры:
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2022 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру