daemon_smtp_ports 25 26 CONFIG_PREFIX etc exim ACL_PREFIX CONFIG_PREFI

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
daemon_smtp_ports = 25 : 26
CONFIG_PREFIX=/etc/exim
ACL_PREFIX=CONFIG_PREFIX/acls
CERTDIR=CONFIG_PREFIX/certs
primary_hostname = mail.postserver.ru
qualify_domain = postserver.ru
hide pgsql_servers = 127.0.0.1::1212/users/post/Halk
domainlist local_domains = postserver.ru: mail.postserver.ru
domainlist hosting_domains = postserver.ru: mail.postserver.ru
hostlist host_reject = ACL_PREFIX/hostreject
hostlist relay_from_hosts = localhost : postserver.ru: mail.postserver.ru: 0/0 : ACL_PREFIX/relayfromhosts
hostlist helo_accept_junk_hosts = postserver.ru
helo_allow_chars = _
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_mime = acl_check_mime
acl_smtp_data = acl_check_virus
av_scanner = clamd:127.0.0.1 3310
spamd_address = 127.0.0.1 783
exim_user = mailnull
exim_group = mailnull
never_users = root
spool_directory = /var/spool/exim
split_spool_directory
host_lookup = *
rfc1413_query_timeout = 0s
smtp_accept_max = 100
smtp_connect_backlog = 50
smtp_accept_max_per_host = 1
smtp_accept_queue = 100
smtp_accept_queue_per_connection = 30
recipients_max = 50
recipients_max_reject = true
message_size_limit = 100M
accept_8bitmime
ignore_bounce_errors_after = 1d
timeout_frozen_after = 3d
PGSQL_LIST = INSERT INTO "white_mail" ("mail", "info", "whost", "wip", "record_expires") VALUES ('$local_part@$domain', NULL, NULL, NULL, DATE_ADD(now()))
PGSQL_UPDATELIST = UPDATE "white_mail" SET record_expires=DATE_ADD(now()) WHERE "mail" = '$local_part@$domain'
PGSQL_TESTLIST = SELECT count(*) FROM white_mail WHERE mail = '$local_part@$domain'
PGSQL_BL = INSERT INTO "black_list" ("host", "record_expires", "count") VALUES ('$sender_host_address', DATE_ADD(now()), 1)
PGSQL_UPDATE_BL = UPDATE "black_list" SET count=count+1, record_expires=DATE_ADD(now()) WHERE "host" = '$sender_host_address'
PGSQL_TEST_BL = SELECT count(*) FROM black_list WHERE "host" = '$sender_host_address'
begin acl
acl_check_rcpt:
warn
authenticated = *
set acl_m19 = ${lookup pgsql{PGSQL_TESTLIST}{$value}{0}}
warn
authenticated = *
condition = ${if {!eq{$acl_m19}{0}}{yes}{no}}
set acl_m19 = ${lookup pgsql{PGSQL_UPDATELIST}}
warn
authenticated = *
condition = ${if {eq{$acl_m19}{0}}{yes}{no}}
set acl_m19 = ${lookup pgsql{PGSQL_LIST}}
accept
authenticated = *
accept
local_parts = job2
domains = +local_domains
accept
local_parts = hr
domains = +local_domains
accept
local_parts = job
domains = +local_domains
accept
local_parts = postmaster
domains = +local_domains
require
verify = sender
accept
hosts = :
deny
message = host is listed in $dnslist_domain\n$dnslist_text\nYou can contact to mail administrator by phone +7 495 476-75-56
dnslists = blackholes.mail-abuse.org:relays.mail-abuse.org:sbl.spamhaus.org:bl.spamcop.net:cbl.abuseat.org:list.dsbl.org:unconfirmed.dsbl.org:multihop.dsbl.org:combined.njabl.org:vote.drbl.vsu.su:vote.drbl.tomsknet.ru:vote.drbl.sub.ru:vote.drbl.sotcom.ru:vote.drbl.rinet.ru:dnsbl.sorbs.net:dul.ru:zen.spamhaus.org
deny
message = Restricted characters in address
domains = +local_domains
local_parts = ^[.] : ^.*[@%!/|]
deny message = Restricted characters in address.\nYou can contact to mail administrator by phone +7 495 476-75-56
domains = !+local_domains
local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
accept domains = +local_domains
deny
hosts = +host_reject
message = You are banned. Go away.\nYou can contact to mail administrator by phone +7 495 476-75-56
deny
message = relay not permitted\nYou can contact to mail administrator by phone +7 495 476-75-56
acl_check_mime:
warn
decode = default
deny message = Sorry, files with the ${lc:$mime_filename} extension doesn't allowed to be sent!!!\nYou can contact to mail administrator by phone +7 495 476-75-56
condition = ${if match \
{${lc:$mime_filename}} \
{\N(\.wav|\.cpl|\.pif|\.bat|\.scr|\.lnk|\.com|\.exe)$\N} \
{1}{0}}
deny message = Sorry, noone speaks chinese here\nYou can contact to mail administrator by phone +7 495 476-75-56
condition = ${if eq{$mime_charset}{gb2312}{1}{0}}
accept
acl_check_virus:
deny message = This message contains malware($malware_name)\nYou can contact to mail administrator by phone +7 495 476-75-56
demime = *
malware = */defer_ok
warn
spam = nobody:true
add_header = X-Spam-Score: $spam_score
add_header = X-Spam-Report: $spam_report
accept
condition = ${lookup pgsql{select mail from white_mail where lower(mail) = lower('$sender_address')}{yes}{no}}
accept
condition = ${lookup pgsql{select whost from white_mail where lower(whost) = lower('$sender_host_name')}{yes}{no}}
accept
condition = ${lookup pgsql{select wip from white_mail where lower(wip) = lower('$sender_host_address')}{yes}{no}}
spam = nobody:true
condition = ${if > {$spam_score_int}{45}}
warn
set acl_m8 = ${lookup pgsql {PGSQL_TEST_BL}{$value}{0}}
warn
condition = ${if {!eq{$acl_m8}{0}}{yes}{no}}
set acl_m8 = ${lookup pgsql {PGSQL_UPDATE_BL}}
warn
condition = ${if {eq{$acl_m8}{0}}{yes}{no}}
set acl_m8 = ${lookup pgsql {PGSQL_BL}}
deny
message= Your message were recognise as SPAM, spam score $spam_score spampoints.\nYou can contact to mail administrator by phone +7 495 476-75-56
spam = nobody:true
condition = ${if > {$spam_score_int}{45}}
accept
condition = ${if <> {$sender_host_authenticated}{0}}
deny
message=Error! Host lookup failed \nYou can contact to mail administrator by phone +7 495 476-75-56
condition = ${if = {$host_lookup_failed}{1}}
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 alias from aliases where lower(mail) = lower('$local_part@$domain')}{$value}fail}
user = mail
group = mailnull
file_transport = address_file
pipe_transport = address_pipe
userforward:
driver = redirect
data = ${lookup pgsql{select remotemail from forward where lower(localmail) = lower('$local_part@$domain')}{$value}fail}
no_verify
no_expn
check_ancestor
reply_transport = address_reply
condition = ${if eq{${lookup pgsql{select localmail from forward where lower(localmail) = lower('$local_part@$domain')}{$value}fail}}{${lookup pgsql{select lower('$local_part@$domain')}}}} {yes} {no} }
allmail:
driver = redirect
data = ${lookup pgsql{select login from accounts }{$value}fail}
no_verify
no_expn
check_ancestor
reply_transport = address_reply
condition = ${if eq{$local_part}{for__all} {${if eq{$domain}{postserver.ru} {yes} {no}} {no} }
localuser:
driver = accept
condition = ${lookup pgsql {select uid from accounts where lower(login) = lower('$local_part@postserver.ru')}{yes}{no}}
transport = local_delivery
cannot_route_message = Unknown user
begin transports
remote_smtp:
driver = smtp
interface = 124.111.112.26
local_delivery:
driver = appendfile
directory = ${lookup pgsql{select maildir from accounts where lower(login) = lower('$local_part@postserver.ru')}{$value}fail}
create_directory
directory_mode = 0770
maildir_format
delivery_date_add
envelope_to_add
return_path_add
group = ${lookup pgsql{select gid from accounts where lower(login) = lower('$local_part@postserver.ru')}{$value}fail}
user = ${lookup pgsql{select uid from accounts where lower(login) = lower('$local_part@postserver.ru')}{$value}fail}
mode = 0660
no_mode_fail_narrower
quota = ${lookup pgsql{select mailquota from accounts where lower(login) = lower('$local_part@postserver.ru')}{$value}fail}M
quota_warn_message = "\
To: $local_part@domain\n\
From: ithelp@postserver.ru\n\
Subject: Переполненение объема почтового ящика\n\
Это сообщение было сгенерировано автоматически почтовым сервером.\n\
Ваш ящик заполнен на 75%. Освободите почтовый ящик для того что-бы данное сообщение не было прислано вновь. \n\
\n"
quota_warn_threshold = 75%
host_check:
driver = pipe
command = /var/spool/scp
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
*@postserver.local $1@postserver.ru T
begin authenticators
lookup_cram:
driver = cram_md5
public_name = CRAM-MD5
server_secret = ${lookup pgsql {select password from accounts where lower(login)=lower('$1')}{$value}fail}
server_set_id = $1
login:
driver = plaintext
public_name = LOGIN
server_prompts = Username:: : Password::
server_condition = ${lookup pgsql {select login from accounts where lower(login)=lower('$1') and password='$2'}{yes}{no}}
server_set_id = $1