Статья содержит настройки такой связки: Postfix+dovecot+mysql+amavis+sa+postgrey+mailman+roundcube+postfixadmin
Здесь буду приводить лишь конфиги и краткие объяснения, ибо и так всё понятно, что оно и зачем. Почта храниться в /var/spool/vmail. Права на папку vmail:vmail,0770
1)Postfix.
Версия postfix-2.6.5,1. Собирал с такими опциями:
[X] PCRE Perl Compatible Regular Expressions
[X] DOVECOT Dovecot SASL authentication method
[X] TLS Enable SSL and TLS support
[X] MYSQL MySQL maps (choose version with WITH_MYSQL_VER)
[X] CDB CDB maps lookups
[X] NIS NIS maps lookups
[X] VDA VDA (Virtual Delivery Agent 32Bit)
При установке задаётся такой вопрос:
Would you like to activate Postfix in /etc/mail/mailer.conf [n]?
отвечаем Y. После установки пишем такое в /etc/periodic.conf (если его нет, создаём вручную)
daily_clean_hoststat_enable=”NO”
daily_status_mail_rejects_enable=”NO”
daily_status_include_submit_mailq=”NO”
daily_submit_queuerun=”NO”
daily_status_mailq_shorten=”YES” # Shorten output
daily_status_include_submit_mailq=”NO” # Also submit queue
Этим мы отключаем специфические опции для sendmail и немного оптимизируем формат ежедневного отчёта по части почты
$cat main.cf
queue_directory = /var/spool/postfix
smtpd_client_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_pipelining,
permit
smtpd_helo_restrictions =
permit
smtpd_sender_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
check_sender_access hash:/usr/local/etc/postfix/sender_list,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
reject_unverified_sender,
reject_rbl_client bl.spamcop.net,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client dul.dnsbl.sorbs.net,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client zen.spamhaus.org,
permit
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
check_recipient_access hash:/usr/local/etc/postfix/recipient_list,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unknown_recipient_domain,
reject_unverified_recipient,
reject_rbl_client bl.spamcop.net,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client dul.dnsbl.sorbs.net,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client dul.ru,
reject_rbl_client zen.spamhaus.org,
check_policy_service inet:127.0.0.1:10023,
permit
smtpd_data_restrictions =
permit
smtpd_end_of_data_restrictions =
permit
smtpd_etrn_restrictions =
permit
$cat master.cf
2)Dovecot
Версия dovecot-1.2.8. Собирал с такими опциями:
[X] KQUEUE kqueue(2) support
[X] SSL SSL support
[X] LDA LDA support
[X] MANAGESIEVE ManageSieve support
[X] MYSQL MySQL support
$cat dovecot.conf
#cat dovecot-sql.conf
driver = mysql
connect = host=localhost user=dovecot password=dovecot dbname=postfix
default_pass_scheme = MD5-CRYPT
password_query = SELECT password FROM mailbox WHERE username = ‘%u’ AND active=’1′
user_query = SELECT CONCAT(‘/var/spool/vmail/’,domain,’/’,maildir) AS home FROM mailbox WHERE username = ‘%n@%d’
3) Amavis
Версия amavisd-new-2.6.4_2,1. Собирал с такими опциями:
[X] MYSQL Use MySQL for lookups/logging/quarantine
[X] SASL Use SASL authentication
[X] MILTER Sendmail milter support
[X] SPAMASSASSIN Use mail/p5-Mail-SpamAssassin
[X] FILE Use newer file(1) utility from ports
[X] RAR RAR support with archivers/rar
[X] UNRAR RAR support with archivers/unrar
[X] ARJ ARJ support with archivers/arj
#cat amavisd.conf
4) SpamAssasin
Перед тем, как собирать, нужно немного подправить исходники, а именно файл72_active.cf, который лежит в папке rules относительно исходников. Править нужно в блоке:
##{ FH_DATE_PAST_20XX
header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/
describe FH_DATE_PAST_20XX The date is grossly in the future.
##} FH_DATE_PAST_20XX
фрагмент Date =~ /20[1-9][0-9]/ на Date =~ /20[2-9][0-9]/ (то есть заменить 1на 2), иначе письма отосланные в 2010 году будут автоматом помечаться как спам. Не знаю, может уже эту проблему решили, но лучше проверить.
Версия p5-Mail-SpamAssassin-3.2.5_4. Собирал с такими опциями:
[X] AS_ROOT Run spamd as root (recommended)
[X] SPAMC Build spamd/spamc (not for amavisd)
[X] SACOMPILE sa-compile
[X] SSL Build with SSL support for spamd/spamc
[X] GNUPG Install GnuPG (for sa-update)
[X] MYSQL Add MySQL support
[X] RAZOR Add Vipul’s Razor support
[X] RELAY_COUNTRY Relay country support
cat /usr/local/etc/mail/spamassassin/local.cf
rewrite_header Subject *****SPAM*****
report_safe 1
required_score 7.0
use_bayes 1
bayes_auto_learn 1
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
use_razor2 1
razor_config /var/spool/mqueue/razor/razor-agent.conf
5) razor
#cat /var/spool/mqueue/razor/razor-agent.conf
debuglevel = 3
identity = identity
ignorelist = 0
listfile_catalogue = servers.catalogue.lst
listfile_discovery = servers.discovery.lst
listfile_nomination = servers.nomination.lst
logfile = /var/log/razor-agent.log
logic_method = 4
min_cf = ac
razordiscovery = discovery.razor.cloudmark.com
rediscovery_wait = 172800
report_headers = 1
turn_off_discovery = 0
use_engines = 4,8
whitelist = razor-whitelist
razorhome = /var/spool/mqueue/razor
6) clamav
Версия clamav-0.95.3. Собирал с такими опциями:
[X] ARC Enable arch archives support
[X] ARJ Enable arj archives support
[X] LHA Enable lha archives support
[X] UNZOO Enable zoo archives support
[X] UNRAR Enable rar archives support
[X] MILTER Compile the milter interface
[X] ICONV Enable ICONV support
#cat /usr/local/etc/clamd.conf
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 1M
LogTime yes
LogSyslog yes
LogVerbose yes
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /var/db/clamav
LocalSocket /var/run/clamav/clamd
FixStaleSocket yes
MaxThreads 32
User clamav
AllowSupplementaryGroups yes
ScanMail yes
7) postgrey
Версия postgrey-1.32.
$cat postgrey_whitelist_clients
domain.com.ua
domain.net
google.com
8) postfixadmin
Версия postfixadmin-2.3. Собирал с такими опциями:
[X] MYSQL MySQL back-end (use mysql PHP extension)
Приведу лишь значимые опции, остальные можно глянуть в конфиге из предыдущих статей:
$CONF[‘default_language’] = ‘ru’;
$CONF[‘encrypt’] = ‘md5crypt’;
$CONF[‘authlib_default_flavor’] = ‘md5’;
$CONF[‘dovecotpw’] = “/usr/local/sbin/dovecotpw”;
$CONF[‘min_password_length’] = 0;
$CONF[‘generate_password’] = ‘YES’;
$CONF[‘show_password’] = ‘YES’;
$CONF[‘transport_default’] = ‘virtual’;
9) roundcube
Версия roundcube-0.3.1,1. Собирал с такими опциями:
[X] MYSQL Use MySQL backend
[X] SSL Enable SSL support (imaps or google spellcheck)
[X] PSPELL Enable PSpell support (internal spellcheck)
[X] NSC Install network spellchecker
Приведу лишь значимые опции, остальные можно глянуть в дефолтном конфиге :
$rcmail_config[‘auto_create_user’] = TRUE;
$rcmail_config[‘imap_auth_type’] = plain;
$rcmail_config[‘smtp_auth_type’] = ‘LOGIN’;
$rcmail_config[‘default_charset’] = ‘UTF-8’;
$rcmail_config[‘language’] = ru_RU;
$rcmail_config[‘max_recipients’] = 20
10) mailman
Версия mailman-with-htdig-2.1.12. Собирал с такими опциями:
[X] POSTFIX for use with postfix
[X] HTDIG htdig integration patches
Значимые опции из конфига:
DEFAULT_CHARSET = ‘koi8-u’
MTA = ‘Postfix’
POSTFIX_STYLE_VIRTUAL_DOMAINS = [‘domain.com.ua’, ‘mail.domain.com.ua’]
add_virtualhost(‘mail.domain.com.ua’)
DEFAULT_SERVER_LANGUAGE = ‘ru’
DEFAULT_DEFAULT_MEMBER_MODERATION = Yes
=========================================================
Вот ещё опции, которые нужно добавить в /etc/rc.conf, что бы всё это вместе заработало:
sendmail_enable=”NONE”
postfix_enable=”YES”
dovecot_enable=”YES”
amavisd_enable=”YES”
mailman_enable=”YES”
postgrey_enable=”YES”
clamav_clamd_enable=”YES”
clamav_freshclam_enable=”YES”
apache22_enable=”YES”
apache22_http_accept_enable=”YES”
spamd_enable=”YES”
spamd_flags=”-u vscan”
==========================================================
Забыл привести содержимое файлов /usr/local/etc/postfix/mysql/*. Ниже привожу их:
#cat virtual.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address=’%s’ AND active = ‘1’
#cat virtual_mailbox.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT CONCAT(domain,’/’,maildir) FROM mailbox WHERE username=’%s’ AND active = ‘1’
cat virtual_mailbox_limit.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT quota FROM mailbox WHERE username=’%s’ AND active = ‘1’
#cat virtual_mailbox_domains.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain=’%u’
Это уже всё.