Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
postfix:postfix [2020-06-19 15:17] GreyWolf |
postfix:postfix [2024-04-14 14:22] (текущий) GreyWolf [Ссылки] |
||
---|---|---|---|
Строка 2: | Строка 2: | ||
====== Установка ====== | ====== Установка ====== | ||
- | <code>apt-get install postfix postfix-ldap</code> | + | |
+ | <code bash> | ||
+ | apt install postfix postfix-ldap | ||
+ | </code> | ||
====== Настройка ====== | ====== Настройка ====== | ||
Строка 92: | Строка 95: | ||
===== Команды ===== | ===== Команды ===== | ||
- | |Проверка синтаксиса|<code>postfix -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf check</code>| | + | Проверка синтаксиса: |
- | |Состояние очереди|<code>postqueue -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -p</code>| | + | <code>postfix -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf check</code> |
- | |Обработка очереди немедленно|<code>postqueue -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -f</code>| | + | |
- | |Очистка очереди |<code>postsuper -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -d ALL</code>| | + | Состояние очереди: |
- | |Тест адресации|<code>postmap -q address@domail.ru ldap:/etc/postfix/ldap-users.cf</code>| | + | <code>postqueue -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -p</code> |
+ | |||
+ | Обработка очереди немедленно: | ||
+ | <code>postqueue -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -f</code> | ||
+ | |||
+ | Очистка очереди: | ||
+ | <code>postsuper -c ПУТЬ_К_ФАЙЛУ_НАСТРОЕК_main.cf -d ALL</code> | ||
+ | |||
+ | Тест адреса доставки: | ||
+ | <code bash>postmap -q address@domail.ru ldap:/etc/postfix/ldap-users.cf</code> | ||
+ | тот-же тест с использованием ''ldapsearch'' | ||
+ | <code bash>ldapsearch -h 127.0.0.1 -p 389 -x -b "ou=users,dc=domain" -LLL '(&(!(l=disabled)) (|(mail=info@domain.ru)(maildrop=info@domain.ru))(objectclass=mailUser))' maildrop</code> | ||
Строка 126: | Строка 140: | ||
|Активация|<code>postmulti -i ИМЯ_ЭКЗЕМПЛЯРА -e enable</code>| | |Активация|<code>postmulti -i ИМЯ_ЭКЗЕМПЛЯРА -e enable</code>| | ||
|Управление экземпляром|<code>postmulti -i ИМЯ_ЭКЗЕМПЛЯРА -p КОМАНДА</code>| | |Управление экземпляром|<code>postmulti -i ИМЯ_ЭКЗЕМПЛЯРА -p КОМАНДА</code>| | ||
- | |||
---- | ---- | ||
[[http://www.postfix.org/MULTI_INSTANCE_README.html|Managing multiple Postfix instances on a single host]] | [[http://www.postfix.org/MULTI_INSTANCE_README.html|Managing multiple Postfix instances on a single host]] | ||
+ | |||
+ | |||
+ | ===== Удаление экземпляра ===== | ||
+ | |||
+ | При удалении экземпляра нужно удалить его папку: ''/var/spool/ИМЯ_ЭКЗЕМПЛЯРА'', иначе даже после того, как имя экземпляра удалено из переменной ''multi_instance_directories'' файла ''/etc/postfix/main.cf'' будет сообщение об ошибке: <code log /var/log/mail.err> | ||
+ | postmulti[...]: fatal: No matching instances | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
Строка 252: | Строка 275: | ||
===== AMaViSd-new ===== | ===== AMaViSd-new ===== | ||
+ | |||
[[amavisd-new:amavisd-new|AMaViSd-new]] — интерфейс между MTA и сканером вирусов/фильтром содержания | [[amavisd-new:amavisd-new|AMaViSd-new]] — интерфейс между MTA и сканером вирусов/фильтром содержания | ||
- | ==== main.cf ==== | + | <code ini main.cf> |
- | + | ||
- | <code> | + | |
content_filter=smtp-amavis:[127.0.0.1]:10024 | content_filter=smtp-amavis:[127.0.0.1]:10024 | ||
</code> | </code> | ||
- | + | <hidden master.cf> | |
- | ==== master.cf ==== | + | |
После транспорта ''pickup'': | После транспорта ''pickup'': | ||
- | <code> | + | <code ini> |
-o content_filter= | -o content_filter= | ||
-o receive_override_options=no_header_body_checks | -o receive_override_options=no_header_body_checks | ||
Строка 269: | Строка 290: | ||
В конец файла: | В конец файла: | ||
- | <code> | + | <code ini> |
smtp-amavis unix - - n - 2 smtp | smtp-amavis unix - - n - 2 smtp | ||
-o smtp_data_done_timeout=1200 | -o smtp_data_done_timeout=1200 | ||
Строка 296: | Строка 317: | ||
-o relay_recipient_maps= | -o relay_recipient_maps= | ||
</code> | </code> | ||
+ | </hidden> | ||
===== ClamAV ===== | ===== ClamAV ===== | ||
+ | |||
:!: Для работы через [[clamav:clamav#ClamSMTPd|ClamSMTPd]] | :!: Для работы через [[clamav:clamav#ClamSMTPd|ClamSMTPd]] | ||
- | ==== main.cf ==== | + | <code ini main.cf> |
- | <code> | + | |
content_filter = scan:127.0.0.1:10025 | content_filter = scan:127.0.0.1:10025 | ||
receive_override_options = no_address_mappings | receive_override_options = no_address_mappings | ||
</code> | </code> | ||
- | ==== master.cf ==== | + | <code ini master.cf> |
- | <code> | + | |
# AV scan filter (used by content_filter) | # AV scan filter (used by content_filter) | ||
scan unix - - n - 16 smtp | scan unix - - n - 16 smtp | ||
Строка 340: | Строка 361: | ||
</code> | </code> | ||
- | ====== Ссылки ====== | ||
- | https://wiki.debian.org/Postfix | + | ===== SpamAssassin ===== |
- | [[http://thewalter.net/stef/software/clamsmtp/postfix.html|ClamSMTP: Using with Postfix]] | + | Эта настройка позволяет работать с [[spamassassin:spamassassin|]] без использования [[#AMaViSd-new]] |
- | [[http://www.postfix.ru/viewtopic.php?p=39498|Postfix: документация postfix, ссылки, обмен опытом, форум :: Просмотр темы - Типовой конфиг для всех]] | + | В файл ''/etc/postfix/master.cf'' нужно добавить |
- | [[http://jskyworker.blogspot.ru/2012/07/postfix-warning-dictnisinit.html|Postfix, warning: dict_nis_init.]] | + | - <WRAP>Для ''smtp'' и ''submission'' строку: |
+ | <code ini> | ||
+ | -o content_filter=spamassassin | ||
+ | </code> | ||
+ | пример: | ||
+ | <code ini> | ||
+ | … | ||
+ | smtp inet n - y - - smtpd | ||
+ | -o content_filter=spamassassin | ||
+ | … | ||
+ | submission inet n - y - - smtpd | ||
+ | -o content_filter=spamassassin | ||
+ | … | ||
+ | </code> | ||
+ | </WRAP> | ||
+ | - В конец файла: <code ini> | ||
+ | spamassassin unix - n n - - pipe | ||
+ | user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient} | ||
+ | </code> | ||
+ | - Выполнить: <code bash>postfix reload</code> или <code bash>service postfix reload</code> | ||
- | https://wiki.debian.org/PostfixAndSASL | + | ===== SSL ===== |
+ | {{anchor:letsencrypt}} | ||
- | http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL | + | Пример настройки работы по порту 587, с использованием сертификатов [[letsencrypt:letsencrypt|]]: |
- | [[http://www.postfix.org/TLS_README.html|Postfix TLS Support]] | + | <code ini /etc/postfix/main.cf> |
+ | smtpd_tls_cert_file=/etc/letsencrypt/live/domain.ru/fullchain.pem | ||
+ | smtpd_tls_key_file=/etc/letsencrypt/live/domain.ru/privkey.pem | ||
- | **[[https://serveradmin.ru/ochistka-i-obsluzhivanie-pochtovoy-bazyi-postfix/|Очистка и обслуживание почтовой базы postfix]]** | + | smtpd_use_tls=yes |
+ | smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache | ||
+ | smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache | ||
+ | |||
+ | smtpd_sasl_type = dovecot | ||
+ | smtpd_sasl_path = private/auth | ||
+ | smtpd_sasl_local_domain = | ||
+ | smtpd_sasl_security_options = noanonymous | ||
+ | broken_sasl_auth_clients = yes | ||
+ | smtpd_sasl_auth_enable = yes | ||
+ | |||
+ | smtp_tls_security_level = may | ||
+ | smtpd_tls_security_level = may | ||
+ | smtp_tls_note_starttls_offer = yes | ||
+ | smtpd_tls_loglevel = 1 | ||
+ | smtpd_tls_received_header = yes | ||
+ | |||
+ | </code> | ||
+ | ====== Ссылки ====== | ||
- | **[[https://serveradmin.ru/zapret-pisem-s-poddelnyim-polem-from-ili-spam-ot-sebya-k-sebe-v-postfix/|Запрет писем с поддельным полем From или спам от себя к себе в postfix]]** | + | * https://wiki.debian.org/Postfix |
+ | * [[http://thewalter.net/stef/software/clamsmtp/postfix.html|ClamSMTP: Using with Postfix]] | ||
+ | * [[http://www.postfix.ru/viewtopic.php?p=39498|Postfix: документация postfix, ссылки, обмен опытом, форум :: Просмотр темы - Типовой конфиг для всех]] | ||
+ | * [[http://jskyworker.blogspot.ru/2012/07/postfix-warning-dictnisinit.html|Postfix, warning: dict_nis_init.]] | ||
+ | * https://wiki.debian.org/PostfixAndSASL | ||
+ | * http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL | ||
+ | * [[http://www.postfix.org/TLS_README.html|Postfix TLS Support]] | ||
+ | * **[[https://serveradmin.ru/ochistka-i-obsluzhivanie-pochtovoy-bazyi-postfix/|Очистка и обслуживание почтовой базы postfix]]** | ||
+ | * **[[https://serveradmin.ru/zapret-pisem-s-poddelnyim-polem-from-ili-spam-ot-sebya-k-sebe-v-postfix/|Запрет писем с поддельным полем From или спам от себя к себе в postfix]]** | ||
+ | * [[https://www.dmosk.ru/miniinstruktions.php?mini=postfix-limits|Лимиты в Postfix. Ограничение на размер сообщения. Лимит на количество сообщений]] | ||
+ | * [[https://blog.neofusion.ru/2018/11/18/configure-postfix-to-send-mail-using-external-smtp-server.html|Настройка Postfix для отправки почты через внешний SMTP]] | ||
{{tag>Linux Debian Email SMTP}} | {{tag>Linux Debian Email SMTP}} |