LINUX.ORG.RU
ФорумAdmin

Копии пользовательской почты на Exim


0

0

Значит имеем Exim настроенный по доке в комплекте с
http://silverwraith.com/vexim/ . Нужно настроить автоматическое
сохранение копий пользовательской почты. Вот что написано в транспорте
последние два блока взял из доки
http://www.devco.net/archives/2006/03/24/saving_copies_of_all_email_using_exi..
. почему не работает не пойму,
пока работает только сохранение исходящий почты. Помогите друзья!!!!

######################################################################
# TRANSPORTS CONFIGURATION #
######################################################################
# ORDER DOES NOT MATTER #
# Only one appropriate transport is called for each delivery. #
######################################################################

# A transport is used only when referenced from a router that successfully
# handles an address.

begin transports


# This transport is used for delivering messages over SMTP connections.

remote_smtp:
driver = smtp

# This transport is used for local delivery to user mailboxes in traditional
# BSD mailbox format. By default it will be run under the uid and gid of the
# local user, and requires the sticky bit to be set on the /var/mail directory.
# Some systems use the alternative approach of running mail deliveries under a
# particular group instead of using the sticky bit. The commented options below
# show how this can be done.

# local_delivery:
# driver = appendfile
# file = /var/mail/backup/mail
# delivery_date_add
# envelope_to_add
# return_path_add
# group = vexim
# user = vexim
# mode = 0660
# no_mode_fail_narrower

virtual_delivery:
driver = appendfile
envelope_to_add
return_path_add
mode = 0600
maildir_format = true
create_directory = true
directory = ${lookup mysql{select smtp from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.domain_id = domains.domain_id}}
user = ${lookup mysql{select users.uid from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.domain_id = domains.domain_id}}
group = ${lookup mysql{select users.gid from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.domain_id = domains.domain_id}}
quota = ${lookup mysql{select users.quota from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.domain_id = domains.domain_id}{${value}M}}
quota_is_inclusive = false
#quota_size_regex = ,S=(\d+):
quota_warn_threshold = 75%
maildir_use_size_file = false
quota_warn_message = "To: $local_part@$domain\n\
Subject: Mailbox quota warning\n\n\
This message was automatically generated by the mail delivery software.\n\n\
You are now using over 75% of your allocated mail storage quota.\n\n\
If your mailbox fills completely, further incoming messages will be automatically\n\
returned to their senders.\n\n\
Please take note of this and remove unwanted mail from your mailbox.\n"

virtual_vacation_delivery:
driver = autoreply
from = "${local_part}@${domain}"
to = ${sender_address}
subject = "Autoreply from ${local_part}@${domain}"
text = ${lookup mysql{select vacation from users,domains \
where domain='${quote_mysql:$domain}' \
and localpart='${quote_mysql:$local_part}' \
and users.domain_id=domains.domain_id}}
mailman_transport:
driver = pipe
command = MAILMAN_WRAP \
'${if def:local_part_suffix \
{${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
{post}}' \
$local_part
current_directory = MAILMAN_HOME
shadow_transport = local_copy_incoming
home_directory = MAILMAN_HOME
user = MAILMAN_USER
group = MAILMAN_GROUP

# This transport is used for handling pipe deliveries generated by alias or
# .forward files. If the pipe generates any standard output, it is returned
# to the sender of the message as a delivery error. Set return_fail_output
# instead of return_output if you want this to happen only when the pipe fails
# to complete normally. You can set different transports for aliases and
# forwards if you want to - see the references to address_pipe in the routers
# section above.

address_pipe:
driver = pipe
return_output
user = ${lookup mysql{select users.uid from users,domains where localpart = '${quote_mysql:$local_part}' and domain = '${quote_mysql:$domain}' and users.do
group = ${lookup mysql{select users.gid from users,domains where localpart = '${quote_mysql:$local_part}' and domain = '${quote_mysql:$domain}' and users.d

address_pipe_catchall:
driver = pipe
return_output
user = ${lookup mysql{select users.uid from users,domains where localpart = '*' and domain = '${quote_mysql:$domain}' and users.domain_id = domains.domain_
group = ${lookup mysql{select users.gid from users,domains where localpart = '*' and domain = '${quote_mysql:$domain}' and users.domain_id = domains.domain

address_pipe_local:
driver = pipe
return_output


# This transport is used for handling deliveries directly to files that are
# generated by aliasing or forwarding.
address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add


# This transport is used for handling autoreplies generated by the filtering
# option of the userforward router.

address_reply:
driver = autoreply

local_copy_outgoing:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
group = vexim
user = vexim
mode = 0660
maildir_format = true
create_directory = true

address_directory:
driver = appendfile
create_directory
delivery_date_add
directory_mode = 770
envelope_to_add
maildir_format
return_path_add
shadow_transport = local_copy_incoming
shadow_condition = ${if eq {$domain}{pupkin.ru}{yes}{no}}

local_copy_incoming:
driver = appendfile
directory = /var/mail/pupkin.ru/.${tr{$sender_address}{.}{_}}.outgoing/
delivery_date_add
envelope_to_add
return_path_add
group = vexim
user = vexim
mode = 0660
maildir_format = true
create_directory = true


ну если просто задача хранить копию входящих меседжей, то можно проще

bcc_router:
driver = redirect
data = log@domain.com
domains = +relay_to_domains
unseen = yes

где unseen = yes говорит екзиму, чтобы после копии был нормальный процессинг письма.

chocholl ★★
()
Ответ на: комментарий от chocholl

Да задача именно такая, а можно для тупых расшифровать что есть что. А то я тупо скопировал что ты мне написал, заменил только data = log@domain.com на нужное мыло и ничего не произошло, тоесть желаемого результата нету.

osipen
() автор топика
Ответ на: комментарий от osipen

для раутеров важен их порядок в конфиге.

sdio ★★★★★
()
Ответ на: комментарий от osipen

Нужно что бы копии входящей почты куда нибудь сохранялись, а как это будет абсолютно не важно. Просто на самом деле это достаточно актуальная проблема ибо у юзеров часто что нибудь случается, иногда случается что письмо они то теряют, то удаляют, то падает ихний email клиент и т.д. Ну а почту должен админ восстановить.

osipen
() автор топика
Ответ на: комментарий от Anoxemian

Т.е. централизованное хранение почты и централизованный бэкап imap-server'a это не этично?

А админ и так в почту юзера залезть может.

Т.е. утверждать что копирование почты неэтично -- глупо, неэтично эту почту читать в личных целях.

sdio ★★★★★
()
Ответ на: комментарий от osipen

в общем мне лениво чиитать весь твой конфиг :)
беглым взглядом посмотрел, и понял что он очень похож на дефолтный.
там лишнего много, советую почитстить, заодно разберешся чего какие директивы делают.
в мануале есть раздел default config file или как-то так :) там все описано.
а если тебе тоже лениво это читать :) то пихни мой строки в самый верх определения роутеров, только смоти чтобы был транспорт на domain.com

chocholl ★★
()
Ответ на: комментарий от chocholl

Я так и сделал только не понял что значит "чтобы был транспорт на domain.com" Почту читать никто не собирается!!! Это требуется сугубо в административных целях. А по поводу конфига он взят из доки vexim. он просто достаточно сложный(там юзеры виртуальные в mysql и как что там работает остается для меня загадкой), и в силу своей неграмотности в даном вопросе я столкнулся с даной проблемой и понятия не имею как ее решить. Не сочтите за наглость, я понимаю что разобравшись полностью я смогу решить задачу, посто я думал что кто то сталкивался такой же проблемой и знает ее решение.

osipen
() автор топика
Ответ на: комментарий от osipen

решение это вставить тот конфиг, что я написал.
а "чтобы был транспорт на domain.com" означает присутствие транспорта в конфиге екзима на domain.com или существование дефолтного dnslookup.

с екзимом все таки разберись, хоть основные понятия, потому что админить систему, не зная как она работает - это грех :)
тем более, что ты, судя по лого.ю бздун. а бздуны так не поступают :)

chocholl ★★
()
Ответ на: комментарий от chocholl

Да я знаю мне самому стыдно задавать такие вопросы, кокраз в данный момент изучаю. Да я бздун!!!
Ну смотри я написал
в ROUTERS CONFIGURATION
# То что по дефолту
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more

# твой блок
bcc_router:
driver = redirect
data = vasya@pupkin.ru
domains = +relay_to_domains
unseen = yes

А то что в транспорте можно увидеть в моем первом сообщении. Почта все равно на vasya@pupkin.ru не приходит, валится все в виртуальный каталог.

osipen
() автор топика
Ответ на: комментарий от chocholl

Большое спасибо Всем за участие в особенности chocholl * (*), я решил проблему. Значит рассказываю для начала надо было понять как ходит почта, для этого я залез в /var/log/exim/mainlog
2007-12-10 19:11:43 1J1lEN-00036m-48 => /usr/local/mail/pupkin.ru.ru/vasya/Maildir (vasya@pupkin.ru) <vasya@pupkin.ru> R=virtual_domains T=virtual_delivery
тут я обратил внимание на R=virtual_domains T=virtual_delivery (Это значит что при приеме почты используется в ROUTERS CONFIGURATION блок virtual_domains, а в TRANSPORTS блок virtual_delivery) Я скопировал блок virtual_domains и вставил сразуже после него только поменял название на virtual_domains_backup, тоже самое я сделал с virtual_delivery изменил название на virtual_delivery_backup. Дальше в virtual_domains добавил unseen = yes, а в virtual_domains_backup изменил file_transport = virtual_delivery_backup и добавил в directory = /var/mail/pupkin.ru/input/$local_part@$domain . Вот что получилось:

В ROUTERS CONFIGURATION
virtual_domains:
driver = redirect
allow_fail
data = ${lookup mysql{select smtp from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and domains.enabled = '1' \
and users.enabled = '1' \
and users.domain_id = domains.domain_id}}
headers_add = ${if >{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = '1' \
and users.domain_id=domains.domain_id }{$value}fail}} {X-Spam-Flag: YES\n}{} }
headers_remove = ${if or { { <{$spam_score_int}{1} } \
{ <{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = 1 \
and users.domain_id=domains.domain_id}{$value}fail}} } \
{ eq {0}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = 0 \
and users.domain_id=domains.domain_id}{$value}fail}}} \
} {X-Spam-Score:X-Spam-Report} }
local_part_suffix = -*
local_part_suffix_optional
retry_use_local_part
file_transport = virtual_delivery
reply_transport = address_reply
pipe_transport = address_pipe
unseen = yes

virtual_domains_backup:
driver = redirect
allow_fail
data = ${lookup mysql{select smtp from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and domains.enabled = '1' \
and users.enabled = '1' \
and users.domain_id = domains.domain_id}}
headers_add = ${if >{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = '1' \
and users.domain_id=domains.domain_id }{$value}fail}} {X-Spam-Flag: YES\n}{} }
headers_remove = ${if or { { <{$spam_score_int}{1} } \
{ <{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = 1 \
and users.domain_id=domains.domain_id}{$value}fail}} } \
{ eq {0}{${lookup mysql{select users.sa_tag * 10 from users,domains \
where localpart = '${quote_mysql:$local_part}' \
and domain = '${quote_mysql:$domain}' \
and users.on_spamassassin = 0 \
and users.domain_id=domains.domain_id}{$value}fail}}} \
} {X-Spam-Score:X-Spam-Report} }
local_part_suffix = -*
local_part_suffix_optional
retry_use_local_part
file_transport = virtual_delivery_backup
reply_transport = address_reply
pipe_transport = address_pipe

osipen
() автор топика
Ответ на: комментарий от osipen

В TRANSPORTS:

virtual_delivery_backup: driver = appendfile envelope_to_add return_path_add mode = 0600 maildir_format = true create_directory = true directory = /var/mail/pupkin.ru/input/$local_part@$domain user = ${lookup mysql{select users.uid from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}} group = ${lookup mysql{select users.gid from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}} quota = ${lookup mysql{select users.quota from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}{${value}M}} quota_is_inclusive = false #quota_size_regex = ,S=(\d+): quota_warn_threshold = 75% maildir_use_size_file = false quota_warn_message = "To: $local_part@$domain\n\ Subject: Mailbox quota warning\n\n\ This message was automatically generated by the mail delivery software.\n\n\ You are now using over 75% of your allocated mail storage quota.\n\n\ If your mailbox fills completely, further incoming messages will be automatically\n\ returned to their senders.\n\n\ Please take note of this and remove unwanted mail from your mailbox.\n"

virtual_delivery: driver = appendfile envelope_to_add return_path_add mode = 0600 maildir_format = true create_directory = true directory = ${lookup mysql{select smtp from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}} user = ${lookup mysql{select users.uid from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}} group = ${lookup mysql{select users.gid from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}} quota = ${lookup mysql{select users.quota from users,domains \ where localpart = '${quote_mysql:$local_part}' \ and domain = '${quote_mysql:$domain}' \ and users.domain_id = domains.domain_id}{${value}M}} quota_is_inclusive = false #quota_size_regex = ,S=(\d+): quota_warn_threshold = 75% maildir_use_size_file = false quota_warn_message = "To: $local_part@$domain\n\ Subject: Mailbox quota warning\n\n\ This message was automatically generated by the mail delivery software.\n\n\ You are now using over 75% of your allocated mail storage quota.\n\n\ If your mailbox fills completely, further incoming messages will be automatically\n\ returned to their senders.\n\n\ Please take note of this and remove unwanted mail from your mailbox.\n"

Вот что я увидел в логах после добавления: 2007-12-10 19:11:43 1J1lEN-00036m-48 => /var/mail/pupkin.ru/input/vasya@pupkin.ru (vasya@pupkin.ru) <vasya@pupkin.ru> R=virtual_domains_backup T=virtual_delivery_bakup 2007-12-10 19:11:43 1J1lEN-00036m-48 => /usr/local/mail/pupkin.ru/vasya/Maildir (vasya@pupkin.ru) <vasya@pupkin.ru> R=virtual_domains T=virtual_delivery

osipen
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.