Re: [exim] Non ascii characters in recipient address creates frozen bounce

2013-01-02 Thread Marcin Mirosław
W dniu 29.11.2012 22:54, Phil Pennock pisze:
 On 2012-11-29 at 17:51 +0100, Marcin Mirosław wrote:
 W dniu 29.11.2012 16:15, Marcin Mirosław pisze:
 Configuration of virtual_delivery transport is defined as below:
 virtual_user:
 driver  = accept
 domains = +local_domains
 condition   = ${lookup pgsql{SQL_CZY_ISTNIEJE_UZYTK}}
 transport   = virtual_delivery
 dsn_process

 SQL_CZY_ISTNIEJE_UZYTK = SELECT 1 FROM exim_users \
 WHERE login=lower(E'${quote_pgsql:$local_part}')
 AND aktywny = true AND tylko_wysylanie = false


 I've wrote and sent email too fast:/
 Transport configuration is:
 virtual_delivery:
 driver  = pipe
 command = /usr/libexec/dovecot/deliver -d
 $local_part
 delivery_date_add
 envelope_to_add
 return_path_add
 user= mail
 log_output
 temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78
 shadow_condition=${if {$spam_score_int}{0}}
 shadow_transport=ham_transport_kopia
 
 Bear with me as I pick apart what's going on.  I might have made a
 mistake and perhaps one of the other developers can point it out.
 
 So, when Exim creates a bounce message, it creates a child Exim process
 and generates the bounce message to feed to it on stdin.  Process
 failed (1) when writing error message is saying that Exim process
 exited non-zero.
 
 Assuming that you have not set the bounce_sender_authentication main
 option, then the child Exim is invoked:
   exim -t -oem -oi -f  -E$original_message_id
 
 This seems strange, the use of -oem with -f , because the point of
 -oem is that errors will be sent to the sender as a new message, which
 can't happen, and it seems that the actual cause of the complaint will
 then never get logged.  Plus, -oem supposedly results in Exim always
 exiting non-zero, which means we'd always see that error message!
 Apparently, the documentation isn't write and it means that Exim always
 exits non-zero, unless the message was successfully received and parsed,
 in which case it always exits success.
 
 The receiving Exim forks again for the delivery, after receiving the
 message, and the return value from the delivery affects the exit code of
 that delivery process, but Exim doesn't care about that exit code, it's
 not looked at ever.  (The delivery Exim process will have forked a third
 time, because you're using a pipe to run an external command, and _that_
 exit code will be looked at).
 
 A full flow to completion:
 
   Process 1: Exim which generates the bounce message
   Process 2: Exim which receives the bounce message
   Process 3: Exim which delivers the bounce message, much like any delivery
   Process 4: Pipe transport command used for the delivery
 
 Exit code of P4 is reported/recorded; exit code of P3 is ignored; Exit
 code of P2 is the one which causes P1 to generate the log message.
 
 Per docs, P2 should always exit non-zero, because of -oem, although the
 local_scan API docs note that child_open_exim() should normally return
 0, despite documenting that it uses -oem.  (And not documenting the -E
 for passing the original message id).
 
 The delivery status of P3 doesn't matter, and by that point, I think
 that P2 is destined to exit 0, thus we can assert that Exim is not
 getting as far as trying to deliver the bounce message, so P2 is failing
 during message reception.
 
 I wonder if this is the X-Failed-Recipients: header causing issues for
 containing unescaped non-ASCII?  I'm not seeing what would cause that.
 
 I think I must have missed something here.

Hi!
On the begin I'd like to wish you all the best in 2013 year!

I've tried to follow you but I'm afraid this description is too low
level for my understanding of exim. Should I assume this is potential
bug in exim or bug in my configuration? Or maybe I can provide some
other information about it?
Thanks,
Marcin.

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Re: [exim] Non ascii characters in recipient address creates frozen bounce

2012-11-29 Thread Marcin Mirosław
W dniu 29.11.2012 02:17, Phil Pennock pisze:

Hi Phil, hi Jeremy, hi all!
Jeremy, I thought that MUA received 550 in session. I was wrong, my
fault, MUA session was completed without error. So it's completly ok for
me that exim generated bounce. Now I'm concentrating on error code 1.

 On 2012-11-28 at 16:08 +0100, Marcin Mirosław wrote:
 2012-11-28 15:40:45 1Tdiof-0007d2-JV ** zzzńz...@.pl: Unknown user /
 Nie ma takiego uzytkownika
 2012-11-28 15:40:46 1Tdiof-0007d2-JV Process failed (1) when writing
 error message to yyy...@.pl (frozen)

 Hex values for character ń in exim_main.log are: C5 84

 I don't understand what happend after rejecting message, at a line with
 time 15:40:46. Why exim wanted create bounce message and why process
 failed with error code 1?



 Just tried that to a friend's system, it bounced just fine.
 
 2012-11-29 01:10:59 [71195] 1TdseY-000IWI-Kl ** zzzńz...@firedrake.org
   F=phil.penn...@spodhuis.org P=prvs=0680ff0160=phil.penn...@spodhuis.org
   R=outbound_signed T=remote_dksign:
   SMTP error from remote mail server after RCPT 
 TO:zzz\305\204...@firedrake.org:
   host mx0.firedrake.org [193.201.200.77]: 550 Unrouteable address
 2012-11-29 01:10:59 [71198] 1TdseZ-000IWM-Eo =  R=1TdseY-000IWI-Kl
   U=exim P=local S=806 for phil.penn...@spodhuis.org
 2012-11-29 01:10:59 [71195] 1TdseY-000IWI-Kl Completed QT=1s
 2012-11-29 01:10:59 [71200] 1TdseZ-000IWM-Eo = phil 
 phil.penn...@spodhuis.org
   F= P= R=imap_user T=imap_inject QT=0s DT=0s
 2012-11-29 01:10:59 [71200] 1TdseZ-000IWM-Eo Completed QT=0s


 It seems likely that the error depends upon the transport used for
 delivering the bounce message.  If you use 'exim -bt yyy...@.pl' to
 determine that, and grab the configuration for the Transport used, then
 could you please paste that configuration into a reply here?

I've looked into spool directory, I found another one message with
similar state. In second case the email was sended by authorized user to
external domain.
Snippet form log (again, sorry for obfuscation, it's not my email address):
# cat /var/spool/exim/msglog/1TdLJC-cu-26
2012-11-27 14:34:42 Received from c...@mydomain.pl H=(m) [192.168.2.134]
I=[192.168.2.1]:587 P=esmtpa A=fixed_login: S=1299332
id=B501EF8474E84AA7B23039BB
F62B18E3@m
2012-11-27 14:34:42 routing failed for d@pl.pepperl-fuchs:
Unrouteable address
Process failed (1) when writing error message to c...@mydomain.pl (frozen)


As we can see destination domain is wrong, it is a mistake made by user.
Exim -bt shows (in both cases):
  router = virtual_user, transport = virtual_delivery

Configuration of virtual_delivery transport is defined as below:
virtual_user:
driver  = accept
domains = +local_domains
condition   = ${lookup pgsql{SQL_CZY_ISTNIEJE_UZYTK}}
transport   = virtual_delivery
dsn_process

SQL_CZY_ISTNIEJE_UZYTK = SELECT 1 FROM exim_users \
WHERE login=lower(E'${quote_pgsql:$local_part}')
AND aktywny = true AND tylko_wysylanie = false

Meseems incorrect recipient address shouldn't be used in any place in
transport but there is high probability I'm wrong:)
Marcin

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Re: [exim] Non ascii characters in recipient address creates frozen bounce

2012-11-29 Thread Marcin Mirosław
W dniu 29.11.2012 16:15, Marcin Mirosław pisze:
 Configuration of virtual_delivery transport is defined as below:
 virtual_user:
 driver  = accept
 domains = +local_domains
 condition   = ${lookup pgsql{SQL_CZY_ISTNIEJE_UZYTK}}
 transport   = virtual_delivery
 dsn_process
 
 SQL_CZY_ISTNIEJE_UZYTK = SELECT 1 FROM exim_users \
 WHERE login=lower(E'${quote_pgsql:$local_part}')
 AND aktywny = true AND tylko_wysylanie = false


I've wrote and sent email too fast:/
Transport configuration is:
virtual_delivery:
driver  = pipe
command = /usr/libexec/dovecot/deliver -d
$local_part
delivery_date_add
envelope_to_add
return_path_add
user= mail
log_output
temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78
shadow_condition=${if {$spam_score_int}{0}}
shadow_transport=ham_transport_kopia

Sorry.
Marcin

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Re: [exim] Non ascii characters in recipient address creates frozen bounce

2012-11-29 Thread Phil Pennock
On 2012-11-29 at 17:51 +0100, Marcin Mirosław wrote:
 W dniu 29.11.2012 16:15, Marcin Mirosław pisze:
  Configuration of virtual_delivery transport is defined as below:
  virtual_user:
  driver  = accept
  domains = +local_domains
  condition   = ${lookup pgsql{SQL_CZY_ISTNIEJE_UZYTK}}
  transport   = virtual_delivery
  dsn_process
  
  SQL_CZY_ISTNIEJE_UZYTK = SELECT 1 FROM exim_users \
  WHERE login=lower(E'${quote_pgsql:$local_part}')
  AND aktywny = true AND tylko_wysylanie = false
 
 
 I've wrote and sent email too fast:/
 Transport configuration is:
 virtual_delivery:
 driver  = pipe
 command = /usr/libexec/dovecot/deliver -d
 $local_part
 delivery_date_add
 envelope_to_add
 return_path_add
 user= mail
 log_output
 temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78
 shadow_condition=${if {$spam_score_int}{0}}
 shadow_transport=ham_transport_kopia

Bear with me as I pick apart what's going on.  I might have made a
mistake and perhaps one of the other developers can point it out.

So, when Exim creates a bounce message, it creates a child Exim process
and generates the bounce message to feed to it on stdin.  Process
failed (1) when writing error message is saying that Exim process
exited non-zero.

Assuming that you have not set the bounce_sender_authentication main
option, then the child Exim is invoked:
  exim -t -oem -oi -f  -E$original_message_id

This seems strange, the use of -oem with -f , because the point of
-oem is that errors will be sent to the sender as a new message, which
can't happen, and it seems that the actual cause of the complaint will
then never get logged.  Plus, -oem supposedly results in Exim always
exiting non-zero, which means we'd always see that error message!
Apparently, the documentation isn't write and it means that Exim always
exits non-zero, unless the message was successfully received and parsed,
in which case it always exits success.

The receiving Exim forks again for the delivery, after receiving the
message, and the return value from the delivery affects the exit code of
that delivery process, but Exim doesn't care about that exit code, it's
not looked at ever.  (The delivery Exim process will have forked a third
time, because you're using a pipe to run an external command, and _that_
exit code will be looked at).

A full flow to completion:

  Process 1: Exim which generates the bounce message
  Process 2: Exim which receives the bounce message
  Process 3: Exim which delivers the bounce message, much like any delivery
  Process 4: Pipe transport command used for the delivery

Exit code of P4 is reported/recorded; exit code of P3 is ignored; Exit
code of P2 is the one which causes P1 to generate the log message.

Per docs, P2 should always exit non-zero, because of -oem, although the
local_scan API docs note that child_open_exim() should normally return
0, despite documenting that it uses -oem.  (And not documenting the -E
for passing the original message id).

The delivery status of P3 doesn't matter, and by that point, I think
that P2 is destined to exit 0, thus we can assert that Exim is not
getting as far as trying to deliver the bounce message, so P2 is failing
during message reception.

I wonder if this is the X-Failed-Recipients: header causing issues for
containing unescaped non-ASCII?  I'm not seeing what would cause that.

I think I must have missed something here.

-Phil

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/