Вот и мои конфиги в догонку:
EXIM:
---------------
primary_hostname = serge.lc.test.net
# DB connection in format host/DBname/user/passwd
hide pgsql_servers = 10.x.x.x/postfix/xxxxxxxxxxx/xxxxxxxxxxxxxx
domainlist local_domains = ${lookup pgsql{SELECT domain FROM domain WHERE \
domain='${domain}' AND active='1'}}
domainlist relay_to_domains = ${lookup pgsql{SELECT domain FROM domain WHERE \
domain='${domain}' AND active='1'}}
hostlist relay_from_hosts = localhost:127.0.0.0/8:10.0.0.0/24
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
av_scanner = clamd:/var/run/clamav/clamd.sock
qualify_domain = test.net
# qualify_recipient =
never_users = root
rfc1413_query_timeout = 0s
sender_unqualified_hosts = +relay_from_hosts
recipient_unqualified_hosts = +relay_from_hosts
ignore_bounce_errors_after = 45m
# This option cancels (removes) frozen messages that are older than a week.
timeout_frozen_after = 7d
helo_accept_junk_hosts = 10.0.0.0/24
auto_thaw = 1h
smtp_banner = "test.net , ESMTP ready"
smtp_accept_max = 50
smtp_accept_max_per_connection = 25
smtp_connect_backlog = 30
smtp_accept_max_per_host = 20
split_spool_directory = true
remote_max_parallel = 15
return_size_limit = 70k
message_size_limit = 10M
helo_allow_chars = _
smtp_enforce_sync = true
log_selector = \
+all_parents \
+connection_reject \
+incoming_interface \
+lost_incoming_connection \
+received_sender \
+received_recipients \
+smtp_confirmation \
+smtp_syntax_error \
+smtp_protocol_error \
-queue_run
syslog_timestamp = no
tls_advertise_hosts = *
tls_certificate = /usr/share/ssl/certs/exim.pem
tls_privatekey = /usr/share/ssl/private/exim.pem
begin acl
acl_check_rcpt:
accept hosts = :
deny message = Restricted characters in address
domains = +local_domains
local_parts = ^[.] : ^.*[@%!/|]
deny message = Restricted characters in address
domains = !+local_domains
local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
deny message = "HELO/EHLO require by SMTP RFC"
condition = ${if eq{$sender_helo_name}{}{yes}{no}}
accept hosts = +relay_from_hosts
control = submission
accept authenticated = *
control = submission
deny message = "Your IP in HELO - access denied, get out!"
hosts = * : !+relay_from_hosts
condition = ${if eq{$sender_helo_name}{$sender_host_address}{true}{false}}
deny condition = ${if eq{$sender_helo_name}{$interface_address}{yes}{no}}
hosts = !127.0.0.1 : !localhost : *
message = "Your HELO contains my IP! Fuck off, spamer."
deny condition = ${if match{$sender_helo_name}{\N^\d+$\N}{yes}{no}}
hosts = !127.0.0.1 : !localhost : *
message = "HELO contains numbers only - bad trick, buddy."
deny condition = ${if match{$sender_address}{\N^\s+$\N}{yes}{no}}
hosts = !127.0.0.1 : !localhost : *
message = "Why HELO contains whitespaces only?! Non-RFC... get out!"
deny condition = ${if eq{$sender_address}{}{yes}{no}}
hosts = !127.0.0.1 : !localhost : *
message = "Where is sender of this mail?! Get out!"
deny message = "your hostname is bad (adsl, poll, ppp & etc)."
condition = ${if match{$sender_host_name}{adsl|dialup|pool|peer|dhcp}{yes}{no}}
warn
set acl_m0 = 10s
warn
hosts = +relay_from_hosts:80.253.9.18/32
set acl_m0 = 0s
warn
logwrite = Delay $acl_m0 for $sender_host_name \
[$sender_host_address] with HELO=$sender_helo_name. Mail from $sender_address to $local_part@$domain. delay = $acl_m0
deny message = "rejected because $sender_host_address is blacklisted in $dnslist_domain\n$dnslist_text
dnslists = relays.ordb.org : cbl.abuseat.org
accept domains = +local_domains
endpass
verify = recipient
accept domains = +relay_to_domains
endpass
verify = recipient
accept hosts = +relay_from_hosts
deny message = relay not permitted
acl_check_data:
deny message = "Nobody speaks chinese here. This is spam - fuck off!"
condition = ${if match{$message_body} \
{105[-_]*51[-_]*86|778[-_]*98[-_]*94} \
{yes}{no}}
deny malware = *
message = This message contains a virus ($malware_name).
accept
acl_check_mime:
warn decode = default
deny message = Blacklisted file extension detected
condition = ${if match \
{${lc:$mime_filename}} \
{\N(\.exe|\.pif|\.bat|\.scr|\.lnk|\.com)$\N} \
{1}{0}}
accept
acl_check_content:
deny message = This message contains malware ($malware_name)
malware = *
warn message = X-Spam-Score: $spam_score ($spam_bar)
spam = nobody:true
warn message = X-Spam-Report: $spam_report
spam = nobody:true
warn message = X-Spam-Flag: YES
spam = nobody
deny message = This message scored $spam_score points. Congratulations!
spam = nobody:true
condition = ${if >{$spam_score_int}{100}{1}{0}}
# finally accept all the rest
accept
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup pgsql{SELECT goto FROM alias WHERE \
address='${quote_pgsql:$local_part@$domain}' OR \
address='${quote_pgsql:@$domain}'}}
# Всё что осталось - это локальные адресаты.
# Доставляем почту в dovecot
dovecot_user:
driver = accept
condition = ${lookup pgsql{SELECT goto FROM alias WHERE \
address='${quote_pgsql:$local_part@$domain}' OR \
address='${quote_pgsql:@$domain}'}{yes}{no}}
transport = dovecot_delivery
begin transports
remote_smtp:
driver = smtp
dovecot_delivery:
driver = pipe
command = /usr/libexec/dovecot/deliver -d $local_part@$domain
message_prefix =
message_suffix =
delivery_date_add
envelope_to_add
return_path_add
log_output
user = mail
address_pipe:
driver = pipe
return_output
address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
address_reply:
driver = autoreply
begin retry
* * F,2h,15m; G,16h,1h,1.5; F,4d,6h
begin rewrite
begin authenticators
auth_plain:
driver = plaintext
public_name = PLAIN
server_condition = ${lookup pgsql{SELECT username FROM mailbox WHERE \
username = '${quote_mysql:$1}' AND \
password = '${quote_mysql:$2}'}{yes}{no}}
server_set_id = $2
server_prompts = :
auth_login:
driver = plaintext
public_name = LOGIN
server_condition = ${lookup pgsql{SELECT username FROM mailbox WHERE \
username = '${quote_mysql:$1}' AND \
password = '${quote_mysql:$2}'}{yes}{no}}
server_prompts = Username:: : Password::
server_set_id = $1
auth_cram_md5:
driver = cram_md5
public_name = CRAM-MD5
server_secret = ${lookup pgsql{SELECT password FROM mailbox WHERE \
username = '${quote_pgsql:$1}'}{$value}fail}
server_set_id = $1
# Усе. Конфиг кончился.
# - serge 29-12-2006, 17:03
************************************************
## Dovecot configuration file
base_dir = /var/run/dovecot/
protocols = imap pop3
listen = *
disable_plaintext_auth = no
shutdown_clients = yes
log_timestamp = "%b %d %H:%M:%S "
syslog_facility = mail
ssl_disable = yes
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_process_size = 32
login_process_per_connection = yes
login_processes_count = 3
login_max_processes_count = 64
login_max_connections = 128
login_greeting = Mail System ready.
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l %c
login_log_format = %$: %s
mail_location = maildir:/var/spool/mail/%d/%n
mail_extra_groups = mail
mail_debug = yes
verbose_proctitle = yes
first_valid_uid = 500
umask = 0077
protocol imap {
imap_client_workarounds = delay-newmail outlook-idle netscape-eoh tb-extra-mailbox-sep
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol lda {
postmaster_address =
postmaster@test.net
mail_plugins = cmusieve
mail_plugin_dir = /usr/lib/dovecot/lda
auth_socket_path = /var/run/dovecot/auth-master
}
auth_executable = /usr/libexec/dovecot/dovecot-auth
auth_debug = yes
auth_debug_passwords = yes
auth default {
mechanisms = plain
passdb sql {
args = /etc/dovecot-sql.conf
}
userdb sql {
args = /etc/dovecot-sql.conf
}
user = root
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
user = mail
#group = mail
}
}
}
plugin {
}
============================
driver = pgsql
connect = host=10.x.x.x dbname=postfix user=xxxxxxxxxxxxxxx password=xxxxxxxxxxxxxxxx
default_pass_scheme = PLAIN
password_query = SELECT username as user, password FROM mailbox WHERE username = '%n@%d' AND active='1'
user_query = SELECT maildir AS home, 500 AS uid, 12 AS gid FROM mailbox WHERE username = '%n@%d' AND active='1'