Настройка его величества Postfix

Posted by admin on Jan 26, 2010 in Почта на Postfix |

Установка Postfix, отключение Sendmail, настройка аутентификации, инициализация БД псевдонимов, создание файлов алиасов и папок для хранения почты

Postfix


Ну а теперь собираем сердце нашей системы – Postfix

отмечаем

устанавливаем

В конце установки на вопрос

Отвечаем yes.

Отключить sendmail

# cat /etc/rc.conf | grep sendmail
sendmail_enable=”NO”
sendmail_submit_enable=”NO”
sendmail_outbound_enable=”NO”
sendmail_msp_queue_enable=”NO”

# touch /etc/periodic.conf
# cat /etc/periodic.conf
daily_clean_hoststat_enable=”NO”
daily_status_mail_rejects_enable=”NO”
daily_status_include_submit_mailq=”NO”
daily_submit_queuerun=”NO”

/usr/local/etc/postfix/main.cf – файл конфигурации;

Аутентификация пользователей в Postfix

# cat /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: auxprop
mech_list: PLAIN LOGIN CRAM-MD5
auxprop_plugin: sql
sql_usessl: yes
sql_engine: mysql
sql_hostnames: localhost
sql_user: postfix
sql_passwd: postfix
sql_database: postfix
sql_select: select password from mailbox where username = ‘%u@%r’
log_level: 3

Инициализация БД псевдонимов

# /usr/local/bin/newaliases

Создаем необходимые файлы

# cd /usr/local/etc/postfix
# touch hello_access
# touch sender_access
# touch recipient_access
# touch client_access

# postmap hello_access
# postmap sender_access
# postmap recipient_access
# postmap client_access

# mkdir /usr/local/etc/postfix/mysqlLookupMaps

# cat /usr/local/etc/postfix/mysqlLookupMaps/alias.conf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address

# cat /usr/local/etc/postfix/mysqlLookupMaps/domain.conf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active = ‘1’ and backupmx = ‘0’

# cat /usr/local/etc/postfix/mysqlLookupMaps/mailbox.conf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
additional_conditions = and active = ‘1’

# cat /usr/local/etc/postfix/mysqlLookupMaps/quota.conf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
additional_conditions = and active = ‘1’

# cat /usr/local/etc/postfix/mysqlLookupMaps/sender.conf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = username
where_field = username
additional_conditions = and active = ‘1’

Создаем папку, где будет храниться почта

# chown -R root:postfix /usr/local/etc/postfix/mysqlLookupMaps/
# chmod 440 /usr/local/etc/postfix/mysqlLookupMaps/*.conf
# chmod 550 /usr/local/etc/postfix/mysqlLookupMaps/

# pw group add virtual -g 1981
# pw user add virtual -g virtual -s /sbin/nologin -u 1981

# mkdir /var/spool/mail
# chown virtual:virtual /var/spool/mail/
# chmod 740 /var/spool/mail/

Запуск postfix вместе с системой

# echo ‘postfix_enable=”YES”‘ >> /etc/rc.conf

Запуск

# /usr/local/etc/rc.d/postfix start

Проверка

# cat /var/log/maillog | grep postfix

Copyright © 2018 Заметки по UNIX All rights reserved.
Desk Mess Mirrored v1.4.3.1 theme from BuyNowShop.com.