Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Sean Durkin
Hello Wietse,

Am 10.09.2014 um 21:52 schrieb Wietse Venema:

> Slow performance is typical for TCP window scaling problems. Have
> you tried to turn it off in your kernel?

Yes, Viktor suggested that also and I tried it. It does not make a difference, 
the problem persists.

Regards,
Sean


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Wietse Venema
Sean Durkin:
> Hello Wietse,
> 
> Am 10.09.2014 um 21:52 schrieb Wietse Venema:
> 
> > Slow performance is typical for TCP window scaling problems. Have
> > you tried to turn it off in your kernel?
> 
> Yes, Viktor suggested that also and I tried it. It does not make
> a difference, the problem persists.

What is the distribution of DATA sizes before failure? In your
example I see numbers around 3kB, 9kB, 12kB.

Some failures are triggered by packet content, and may be replaced
only by replacing hardware that operates marginally. Does the problem
go away when you

- Replace the server (either the network card or the whole box)

- Replace the cable that connects the server to the network switch

- Replace the network switch that the server is plugged into.

- Replace the cable that connects the switch to the router

- Replace the router

- And so on...

If you think this is a stupid idea, then you haven't been around
long enough.

Wietse


Re: Positive DSN if delay_warning_time is reached?

2014-09-11 Thread A. Schulze


wietse:


This turned out to be easier than expected. Manpage fragment for
Postfix 2.12-20140907:

  confirm_delay_cleared (default: no)
After sending a "your message is delayed" notification,
inform the sender when the delay clears up. This can result
in a sudden burst of notifications at the end of a prolonged
network outage, and is therefore disabled by default.

Adding this required only minor extension of existing infrastructure.
The feature is also available as a patch for older Postfix versions at
ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/feature-patches/20140907-confirm_delay_cleared-patch


Hello,

thanks for the patch. I like to use it with postfix-2.11.1. At a first  
view it works as expected.


But imagine th following scenario: client <-> relay <-> destination

 - client send a message requesting DSN on success and failure.  
Explicit not for delay.


 - the relay has
   delay_warning_time 1h
   confirm_delay_cleared = yes

 - the destination if offline

 - the relay hold the message for two hours and do not send a "your  
message is delayed" notification


 - the destination go online

 - the relay forward the message

 - the destination send a "your messages is delivered"

But just here the relay also send a "your messages is delivered".  
That's unexpected to me. I'm unsure if I like this.
If I read the documentation, it may be a bug because no delay warning  
was sent.


Anyway: I checked, the relay do not send a success message if there  
was no delay at all.
Also interesting to test: what happen if relay is greylisted and  
deliver to a fallback_relay.

( that may have similar setting or not )

Andreas



Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Sean Durkin
Hi Viktor,

Am 10.09.2014 um 23:03 schrieb Viktor Dukhovni:
> This trace has an insane level of debugging turned on, to the point
> that syslogd is overwhelmed and is losing messages.  PLEASE DISABLE
> ALL VERBOSE logging.  NO "-v" options in master.cf, NO debug_peer_list,
> ...
Yes, sorry, I cranked up the debug level, since normal logging looks like this:

Sep 11 09:43:31 mail postfix/smtpd[25170]: connect from 
mail18-21.srv2.de[193.169.181.21]
Sep 11 09:43:31 mail postfix/smtpd[25170]: 2C076C4026A: 
client=mail18-21.srv2.de[193.169.181.21]
Sep 11 09:46:33 mail postfix/smtpd[25170]: lost connection after DATA (33290 
bytes) from mail18-21.srv2.de[193.169.181.21]
Sep 11 09:46:33 mail postfix/smtpd[25170]: disconnect from 
mail18-21.srv2.de[193.169.181.21]
...
Sep 11 10:10:59 mail postfix/smtpd[25537]: connect from 
quattuorocto.psi.cust-cluster.com[195.140.187.48]
Sep 11 10:10:59 mail postfix/smtpd[25537]: 8736FC40A7D: 
client=quattuorocto.psi.cust-cluster.com[195.140.187.48]
Sep 11 10:36:44 mail postfix/smtpd[25537]: lost connection after DATA (36809 
bytes) from quattuorocto.psi.cust-cluster.com[195.140.187.48]
Sep 11 10:36:44 mail postfix/smtpd[25537]: disconnect from 
quattuorocto.psi.cust-cluster.com[195.140.187.48]
..
Sep 11 10:38:48 mail postfix/smtpd[25913]: connect from 
smtp-out-127-108.amazon.com[176.32.127.108]
Sep 11 10:38:49 mail postfix/smtpd[25913]: 2558DC40458: 
client=smtp-out-127-108.amazon.com[176.32.127.108]
Sep 11 10:41:01 mail postfix/smtpd[25913]: lost connection after DATA (17511 
bytes) from smtp-out-127-108.amazon.com[176.32.127.108]
Sep 11 10:41:01 mail postfix/smtpd[25913]: disconnect from 
smtp-out-127-108.amazon.com[176.32.127.108]

I didn't think that info alone was particularly useful...

> Please make sure that the /dev/log syslog socket is a "dgram" not
> a "stream" socket, and that mail logging is not synchronous.
Logging is not synchronous, the socket is a datagram socket (it has all been 
set up that way all along).

No change, still the same problem, see above.

Meanwhile, I've managed to record a tcpdump of such a failed session. What 
exactly am I looking for there?
I don't see anything out of the ordinary, except increasing delays between 
received packets from the external host, until the host sends a "RST".
It seems I simply do not receive any packets. The ones I get are immediately 
ACK'd, but then there's seconds and later minutes until the next one even 
arrives, until finally the remote host gives up and terminates the connection.

I'll try to get more dumps for comparison, including some from hosts that have 
no problems delivering.

There's no packet filtering or rate limiting on port 25, at least not on my 
machine. The hosting provider might have something there, I'd have to ask 
them...

Regards,
Sean


Re: pipemap, multiple results [patch]

2014-09-11 Thread Roel van Meer

Roel van Meer writes:

What I am actually trying to do is a lookup with a single key in two maps.   
Maybe stackmap or concatmap?


Now, if you specify two maps somewhere, and the first map returns a result,  
there is no lookup done in the second map.  With concatmap, both lookups  
would happen, and the combined result would be returned.


Largely based on the code of pipemap, I now have something that does this.
It goes by the name of joinmap.

/etc/postfix/a:
a   res-a
c   res-ca
d   res-d

/etc/postfix/b:
b   res-b
c   res-cb
d   res-d

# postmap -q a 'joinmap:!hash:/etc/postfix/a!hash:/etc/postfix/b'
res-a

# postmap -q b 'joinmap:!hash:/etc/postfix/a!hash:/etc/postfix/b'
res-b

# postmap -q c 'joinmap:!hash:/etc/postfix/a!hash:/etc/postfix/b'
res-ca,res-cb

# postmap -q d 'joinmap:!hash:/etc/postfix/a!hash:/etc/postfix/b'
res-d,res-d

# postmap -q e 'joinmap:!hash:/etc/postfix/a!hash:/etc/postfix/b'


So far it does what I need: I can now use the output of two ldap lookups in  
virtual_alias_maps.


The patch is just code though.  If you're interested, I can write some  
documentation to make it more complete.  And although it seems to work on my  
test server, it hasn't been tested very thoroughly yet..


Thanks again (it's always a pleasure to work with Postfix),

Roel
diff -ruN a/.indent.pro b/.indent.pro
--- a/.indent.pro   2014-07-18 01:09:15.0 +0200
+++ b/.indent.pro   2014-09-11 12:29:49.298253498 +0200
@@ -77,6 +77,7 @@
 -TDICT_DEBUG
 -TDICT_ENV
 -TDICT_FAIL
+-TDICT_JOIN
 -TDICT_HT
 -TDICT_LDAP
 -TDICT_LMDB
diff -ruN b/src/util/Makefile.in c/src/util/Makefile.in
--- b/src/util/Makefile.in  2014-07-21 01:21:23.0 +0200
+++ c/src/util/Makefile.in  2014-09-11 11:54:25.868238221 +0200
@@ -38,7 +38,7 @@
dict_fail.c msg_rate_delay.c dict_surrogate.c warn_stat.c \
dict_sockmap.c line_number.c recv_pass_attr.c pass_accept.c \
poll_fd.c timecmp.c slmdb.c dict_pipe.c dict_random.c \
-   valid_utf8_hostname.c midna.c
+   valid_utf8_hostname.c midna.c dict_join.c
 OBJS   = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
@@ -78,7 +78,7 @@
dict_fail.o msg_rate_delay.o dict_surrogate.o warn_stat.o \
dict_sockmap.o line_number.o recv_pass_attr.o pass_accept.o \
poll_fd.o timecmp.o $(NON_PLUGIN_MAP_OBJ) dict_pipe.o dict_random.o \
-   valid_utf8_hostname.o midna.o
+   valid_utf8_hostname.o midna.o dict_join.o
 # MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf.
 # When hard-linking these, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ),
 # otherwise it sets the PLUGIN_* macros.
@@ -107,7 +107,7 @@
edit_file.h dict_cache.h dict_thash.h ip_match.h nbbio.h base32_code.h \
dict_fail.h warn_stat.h dict_sockmap.h line_number.h timecmp.h \
slmdb.h compat_va_copy.h dict_pipe.h dict_random.h \
-   valid_utf8_hostname.h midna.h
+   valid_utf8_hostname.h midna.h dict_join.h
 TESTSRC= fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
stream_test.c dup2_pass_on_exec.c
 DEFS   = -I. -D$(SYSTYPE)
@@ -1043,6 +1043,19 @@
 dict_ht.o: vbuf.h
 dict_ht.o: vstream.h
 dict_ht.o: vstring.h
+dict_join.o: argv.h
+dict_join.o: dict.h
+dict_join.o: dict_join.c
+dict_join.o: dict_join.h
+dict_join.o: htable.h
+dict_join.o: msg.h
+dict_join.o: myflock.h
+dict_join.o: mymalloc.h
+dict_join.o: stringops.h
+dict_join.o: sys_defs.h
+dict_join.o: vbuf.h
+dict_join.o: vstream.h
+dict_join.o: vstring.h
 dict_lmdb.o: argv.h
 dict_lmdb.o: dict.h
 dict_lmdb.o: dict_lmdb.c
@@ -1094,6 +1107,7 @@
 dict_open.o: dict_env.h
 dict_open.o: dict_fail.h
 dict_open.o: dict_ht.h
+dict_open.o: dict_join.h
 dict_open.o: dict_lmdb.h
 dict_open.o: dict_ni.h
 dict_open.o: dict_nis.h
diff -ruN b/src/util/dict_join.c c/src/util/dict_join.c
--- b/src/util/dict_join.c  1970-01-01 01:00:00.0 +0100
+++ c/src/util/dict_join.c  2014-09-11 12:02:19.538242235 +0200
@@ -0,0 +1,195 @@
+/*++
+/* NAME
+/* dict_join 3
+/* SUMMARY
+/* dictionary manager interface for pipelined tables
+/* SYNOPSIS
+/* #include 
+/*
+/* DICT*dict_join_open(name, open_flags, dict_flags)
+/* const char *name;
+/* int open_flags;
+/* int dict_flags;
+/* DESCRIPTION
+/* dict_join_open() opens a pipeline of one or more tables.
+/* Example: "\fBpipemap:\fI!type_1:name_1! ... !type_n:name_n\fR".
+/*
+/* Each "pipemap:" query is given to the first table.  Each
+/* lookup result becomes the query for the next table in the
+/* pipeline, and the last table produces the final result.
+/* When any table lookup produces no result, the pipeline
+/* produces no result.
+/*
+/* The first ASCII character after "pipemap:" will be used as
+/* the separator between the loo

Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 02:36:51PM +0200, Sean Durkin wrote:

> > PLEASE DISABLE
> > ALL VERBOSE logging.  NO "-v" options in master.cf, NO debug_peer_list,
>
> Yes, sorry, I cranked up the debug level, since normal logging looks like 
> this:
> 
> Sep 11 09:43:31 mail postfix/smtpd[25170]: connect from 
> mail18-21.srv2.de[193.169.181.21]
> Sep 11 09:43:31 mail postfix/smtpd[25170]: 2C076C4026A: 
> client=mail18-21.srv2.de[193.169.181.21]
> Sep 11 09:46:33 mail postfix/smtpd[25170]: lost connection after DATA (33290 
> bytes) from mail18-21.srv2.de[193.169.181.21]
> Sep 11 09:46:33 mail postfix/smtpd[25170]: disconnect from 
> mail18-21.srv2.de[193.169.181.21]

That's sufficient.  It shows you're likely not using TLS here, and
the time beetween message start and connection loss.  The number
of samples is rather small now.  I would expect the session duration
for each sending host to be essentially constant over multiple
deliveries (equal to the remote machine's TCP timeout).

Possibilities include a broken network interface somewhere or a
bad cable that corrupts IP or TCP packet headers given specific
input patterns.

If the problem is with the message payload, you could try enabling
inbound TLS, perhaps these sending servers support it.  Don't recall
whether you already have TLS.  If the problem is not with the
payload, then TLS won't make any difference (some hosts will still
fail even after TLS).

> I didn't think that info alone was particularly useful...

It is sufficient, and the verbose logs just add noise.

> Meanwhile, I've managed to record a tcpdump of such a failed
> session. What exactly am I looking for there?

Retransmissions from the sender of data with the same sequence
number...

Post "tcpdump" output (without packet content is fine), containing
packets from just a single failed session.

> There's no packet filtering or rate limiting on port 25, at least
> not on my machine. The hosting provider might have something there,
> I'd have to ask them...

They probably have middle boxes, which might be the cause of the
problem.

-- 
Viktor.


About mynetworks

2014-09-11 Thread Feel Zhou
Hello, my friend
This is tom, I'm sending my greeting from China.
My customer send mail via my postfix server
main.cf
mynetworks = hash:/etc/postfix/mynetworks_table
/etc/postfix/mynetworks_table
ip1 PERMIT
ip2 PERMIT
Today, one of my customer send mail via the new ip.
And this new ip not in the /etc/postfix/mynetworks_table
Can you help me to resolve it.
Thanks for your time.
Tom


Re: About mynetworks

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 09:11:01PM +0800, Feel Zhou wrote:

> My customer send mail via my postfix server
>
> main.cf:
> mynetworks = hash:/etc/postfix/mynetworks_table
>
> mynetworks_table:
> ip1 PERMIT
> ip2 PERMIT
>
> Today, one of my customer send mail via the new ip.
> And this new ip not in the /etc/postfix/mynetworks_table

Was the mail accepted or rejected?

> Can you help me to resolve it.

What did you want to happen?  Please follow instructions at:

http://www.postfix.org/DEBUG_README.html#mail

Post configuration and log information, and explain what it is that
you want to happen.

-- 
Viktor.


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Sean Durkin
Hi Wietse,

Am 11.09.2014 um 13:49 schrieb Wietse Venema:
> What is the distribution of DATA sizes before failure? In your
> example I see numbers around 3kB, 9kB, 12kB.

At the moment, I see these sizes:

- always exactly 17511 bytes from smtp-out-127-*.amazon.com (today, seems to be 
only 3 different hosts trying)
- always exactly 49116 bytes from *.psi.cust-cluster.com (I've seen about 60 
different hosts from there today)
- always exactly 33290 bytes from mail18-*.srv2.de (about a dozen different 
hosts)

It seems those are always the same 3 messages being re-tried constantly (when I 
look at them in the incoming queue folder, it's the same recipient and sender 
and the same message-ID, as far as I can tell). I have problems only with 
messages from these clusters, everything else seems unaffected (at least I 
haven't seen any "lost connection" messages from any other hosts as far as my 
logfiles go back).

Yesterday I had an additional message with exactly 17441 bytes on every try 
before failure from the Amazon-cluster. That one was finally delivered 
completely early this morning, and has since disappeared from the cycle.

FWIW, I have received a handful of messages from the Amazon-cluster that did 
not have any delays/problems yesterday and today, one of them even from one of 
the "problematic" hosts that can't deliver the other message.

> Some failures are triggered by packet content, and may be replaced
> only by replacing hardware that operates marginally. Does the problem
> go away when you
> 
> - Replace the server (either the network card or the whole box)
> 
> - Replace the cable that connects the server to the network switch
> 
> - Replace the network switch that the server is plugged into.
> 
> - Replace the cable that connects the switch to the router
> 
> - Replace the router
> 
> - And so on...
> 
> If you think this is a stupid idea, then you haven't been around
> long enough.

By no means do I think that's stupid. :)
I'm only doing this server stuff "for fun" in my spare time, but my real job is 
in microelectronics and hardware, so I've had my share of mysterious and 
seemingly unexplainable stuff (ISI, crosstalk, low-frequency jitter, ground 
bounce, ESD-induced phenomena, you know the drill...).

Problem is that this box is a rented root server in a data center somwhere, so 
I don't have access to the hardware to try any of that. I can contact support, 
but they of course charge you for everything they do, and as long as I haven't 
ruled out that the reason is just some stupid configuration mistake on my part 
(or a routing/filtering issue at my hosting provider, or Amazon, or...), I 
don't want to start replacing hardware, obviously...

Regards,
Sean


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 03:25:57PM +0200, Sean Durkin wrote:

> I can contact support, but they of course charge you for
> everything they do, and as long as I haven't ruled out that the
> reason is just some stupid configuration mistake on my part (or a
> routing/filtering issue at my hosting provider, or Amazon, or...),
> I don't want to start replacing hardware, obviously...

The Postfix configuration has no impact on the TCP layer, beyond
optionally specifying the TCP window size.  Since it is the TCP
layer that fails, the problem is not related to the Postfix
configuration.

Your PCAP files should demonstrate repeated retransmission of data,
are the ACKs you're sending confirming receipt of packets that are
sent repeatedly?  In that case your ACKs are getting lost?   Is
there a sequence number gap in the data received from the server?
In that case the remote server's data is getting lost.  Does the
capture confirm that window scaling is not in use? ...

-- 
Viktor.


Re: Positive DSN if delay_warning_time is reached?

2014-09-11 Thread Wietse Venema
First, I think this is somewhat academic because many users will
be confused when they receive more than one notification for the
same email message, regardless of the content of that notification.

Historically, Postfix will send a "relayed" notification when the
sender requests "SUCCESS" notification but the remote SMTP server
does not announce DSN support. Otherwise, Postfix delegates the
responsibility for "SUCCESS" notification to the remote SMTP server.

Presently, we have a new feature to send a "relayed" (after delay)
notification when delayed mail leaves the local queue. If the user
requested "SUCCESS" notification, then I think that Postfix should
still delegate that responsibility to the remote SMTP server as it
has done historically.

I could remove the word "successfully" from the bounce daemon's
"success_template" text, but I doubt that it would improve most
user's experience.  The problem is primarily with too many
notifications, not their content.

Wietse


Re: Positive DSN if delay_warning_time is reached?

2014-09-11 Thread A. Schulze


wietse:


First, I think this is somewhat academic because many users will
be confused when they receive more than one notification for the
same email message, regardless of the content of that notification.

right. Users tend to not read such messages :-/


Presently, we have a new feature to send a "relayed" (after delay)
notification when delayed mail leaves the local queue. If the user
requested "SUCCESS" notification, then I think that Postfix should
still delegate that responsibility to the remote SMTP server as it
has done historically.



so do you think the feature is not finally finished? I find it definitive
useful in this existing version. But I think it could be optimised for
these there three cases:

1) sender didn't request "SUCCESS" notification. That is possible  
explicit by NOTIFY=DELAY,FAILURE

   or implicit by not specifying any NOTIFY= at all. ( legacy MUA mode )
   -> the relay deferring a message should send a "relayed" (after delay)
  notification

2) sender did request "SUCCESS" notification
   -> then the relay deferring a message should delegate that responsibility.
  No matter if the message was deferred or not.

3) sender did not request "DELAY" notification
   -> relay should not send a "relayed" (after delay)

Not easy to mix them into correct "if A then B code" ...

You name that a "new feature". I could imagine also a new
bounce type + separate text in bounce.cf

Andreas



Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Wietse Venema
Sean Durkin:
> Hi Wietse,
> 
> Am 11.09.2014 um 13:49 schrieb Wietse Venema:
> > What is the distribution of DATA sizes before failure? In your
> > example I see numbers around 3kB, 9kB, 12kB.
> 
> At the moment, I see these sizes:
> 
> - always exactly 17511 bytes from smtp-out-127-*.amazon.com (today, seems to 
> be only 3 different hosts trying)
> - always exactly 49116 bytes from *.psi.cust-cluster.com (I've seen about 60 
> different hosts from there today)
> - always exactly 33290 bytes from mail18-*.srv2.de (about a dozen different 
> hosts)
> 
> It seems those are always the same 3 messages being re-tried
> constantly (when I look at them in the incoming queue folder, it's
> the same recipient and sender and the same message-ID, as far as
> I can tell). I have problems only with messages from these clusters,
> everything else seems unaffected (at least I haven't seen any "lost
> connection" messages from any other hosts as far as my logfiles
> go back).
> 
> Yesterday I had an additional message with exactly 17441 bytes on
> every try before failure from the Amazon-cluster. That one was
> finally delivered completely early this morning, and has since
> disappeared from the cycle.

That increases my suspicion of a data-dependent error - some marginal
cable/switch/router, perhaps some middle box with a memory bit error
that requires a power cycle to clear the problem. If the problem is 
caused by crosstalk defect, then only physical replacement will
solve it.

> Problem is that this box is a rented root server in a data center
> somwhere, so I don't have access to the hardware to try any of
> that. I can contact support, but they of course charge you for
> everything they do, and as long as I haven't ruled out that the
> reason is just some stupid configuration mistake on my part (or a
> routing/filtering issue at my hosting provider, or Amazon, or...),
> I don't want to start replacing hardware, obviously...

Try power cycling.

Wietse


Re: Positive DSN if delay_warning_time is reached?

2014-09-11 Thread Wietse Venema
A. Schulze:
> 
> wietse:
> 
> > First, I think this is somewhat academic because many users will
> > be confused when they receive more than one notification for the
> > same email message, regardless of the content of that notification.
> right. Users tend to not read such messages :-/
> 
> > Presently, we have a new feature to send a "relayed" (after delay)
> > notification when delayed mail leaves the local queue. If the user
> > requested "SUCCESS" notification, then I think that Postfix should
> > still delegate that responsibility to the remote SMTP server as it
> > has done historically.
> 
> 
> so do you think the feature is not finally finished?

Above, I described  the part of Postfix that works as intended. If
the user explicitly requests a SUCCESS notification, then Postfix
should keep delegating that to the remote SMTP server, regardless
of whether the new feature is in effect.

> 3) sender did not request "DELAY" notification
> -> relay should not send a "relayed" (after delay)

I looked at the code, and while the existing "delayed" notifications
can be suppressed with NOTIFY=FAILURE (i.e. without "DELAY"), it
looks like the new "relayed" (after delay) notifications ignore
that.  So that still needs to be fixed.

Wietse


Re: header checks not working

2014-09-11 Thread Wietse Venema
Den:
> I do not have any of these "receive_override_options=no_header_body_checks"
> in my master.cf or any other places anywhere.

Prove it.

Wietse


Re: header checks not working

2014-09-11 Thread Den
Hello Wetsie,

That's a piece of cake.

My master.cf in full is below. 

Would you like to see my main.cf?
receive_override_options=no_header_body_checks is not actually found in
main.cf as I selectively chose every single line in main.cf myself but I can
copy-paste it for clarity should that help solve it. I am slowly starting to
go crazy about this issue. Many thanks!
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==
# service type  private unpriv  chroot  wakeup  maxproc command + args
#   (yes)   (yes)   (yes)   (never) (100)
# ==
#smtp  inet  n   -   -   -   -   smtpd
smtp  inet  n   -   -   -   1   postscreen
smtpd pass  -   -   -   -   -   smtpd
dnsblog   unix  -   -   -   -   0   dnsblog
tlsproxy  unix  -   -   -   -   0   tlsproxy
submission inet n   -   -   -   -   smtpd
#Bind the IP to the domian name in outgoing emails.
newcruz-offshore.com  unix  -   -n -  -   smtp
 -o smtp_bind_address=199.175.50.90
 -o smtp_helo_name=newcruz-offshore.com
 -o syslog_name=postfix-newcruz-offshore.com
# -o content_filter=spamassassin
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps inet  n   -   -   -   -   smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628   inet  n   -   -   -   -   qmqpd
pickupfifo  n   -   -   60  1   pickup
cleanup   unix  n   -   -   -   0   cleanup
qmgr  fifo  n   -   n   300 1   qmgr
#qmgr fifo  n   -   n   300 1   oqmgr
tlsmgrunix  -   -   -   1000?   1   tlsmgr
rewrite   unix  -   -   -   -   -   trivial-rewrite
bounceunix  -   -   -   -   0   bounce
defer unix  -   -   -   -   0   bounce
trace unix  -   -   -   -   0   bounce
verifyunix  -   -   -   -   1   verify
flush unix  n   -   -   1000?   0   flush
proxymap  unix  -   -   n   -   -   proxymap
proxywrite unix -   -   n   -   1   proxymap
smtp  unix  -   -   -   -   -   smtp
relay unix  -   -   -   -   -   smtp
#   -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix  n   -   -   -   -   showq
error unix  -   -   -   -   -   error
retry unix  -   -   -   -   -   error
discard   unix  -   -   -   -   -   discard
local unix  -   n   n   -   -   local
virtual   unix  -   n   n   -   -   virtual
lmtp  unix  -   -   -   -   -   lmtp
anvil unix  -   -   -   -   1   anvil
scacheunix  -   -   -   -   1   scache
#
# 
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# 
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -   n   n   -   -   pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
dovecot  unix  -   n   n   -   -   pipe
  flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d
${recipient}
dovecot-spamass  unix  -   n   n   -   -   pipe
  flags=DRhu user=mail:mail argv=/usr/bin/spamc -u ${recipient} -e
/usr/lib/dovecot/deliver -d ${recipient}
#
# 
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtpcmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmt

Re: header checks not working

2014-09-11 Thread Den
Hello again Wietse,

Here goes my main.cf. There is no
"receive_override_options=no_header_body_checks" 
 anywhere here as well. Would be absolutely and genuinely thankful for any
suggestions...

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
myorigin = $mydomain
#myhostname = localhost
myhostname = 
mydestination = 

virtual_mailbox_domains = 
virtual_mailbox_base = /home/mail
virtual_mailbox_maps = hash:/etc/postfix/virtual_boxes
virtual_minimum_uid = 100
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
virtual_transport = dovecot-spamass
dovecot-spamass_destination_recipient_limit = 1
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
append_at_myorigin = yes
disable_vrfy_command = yes
show_user_unknown_table_name = no
smtpd_error_sleep_time = 20
smtpd_soft_error_limit = 2
smtpd_hard_error_limit = 3
smtpd_junk_command_limit = 2
message_size_limit = 2048
mailbox_size_limit = 0
local_destination_concurrency_limit = 16
default_destination_concurrency_limit = 20
in_flow_delay = 1s

delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_security_level = may 
smtpd_tls_CAfile = /etc/ssl/signed/ca.crt
smtpd_tls_cert_file = /etc/ssl/signed/new.crt
smtpd_tls_key_file = /etc/ssl/signed/new.key

smtpd_tls_loglevel = 1 
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_session_cache_timeout = 3600s  
smtpd_tls_auth_only = yes

smtpd_sasl_local_domain = $myhostname
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtp_sasl_security_options = noanonymous noplaintext
smtp_sasl_tls_security_options = noanonymous

alias_maps = hash:/etc/aliases

mynetworks = 127.0.0.0/8 [:::127.0.0.0]/104 [::1]/128
mailbox_command = /usr/bin/procmail

home_mailbox = Maildir/
mailbox_size_limit = 0
recipient_delimiter = +

smtpd_recipient_restrictions = reject_non_fqdn_recipient
reject_unknown_recipient_domain permit_sasl_authenticated  permit_mynetworks
reject_unauth_destination reject_non_fqdn_hostname reject_invalid_hostname
reject_unauth_pipelining  reject_rbl_client zen.spamhaus.org
reject_rbl_client cbl.abuseat.org reject_rbl_client dsn.rfc-ignorant.org
reject_rbl_client dul.dnsbl.sorbs.net reject_rbl_client bl.spamcop.net
reject_rbl_client combined.rbl.msrbl.net reject_rbl_client
b.barracudacentral.org check_policy_service unix:private/policy-spf
check_policy_service inet:127.0.0.1:10023 permit
smtpd_client_restrictions = check_client_access hash:/etc/postfix/blacklist,
reject_unknown_reverse_client_hostname, reject_rbl_client relays.ordb.org,
reject_rbl_client zen.spamhaus.org, reject_rbl_client  cbl.abuseat.org,
reject_rbl_client dsn.rfc-ignorant.org, reject_rbl_client
dul.dnsbl.sorbs.net, reject_rbl_client bl.spamcop.net,  reject_rbl_client
combined.rbl.msrbl.net, reject_rbl_client b.barracudacentral.org 
smtpd_sender_restrictions = reject_unknown_sender_domain,
reject_non_fqdn_sender, reject_rhsbl_sender dsn.rfc-ignorant.org
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated,
reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname,
check_helo_access hash:/etc/postfix/helo_access
strict_rfc821_envelopes = yes
smtpd_delay_reject = yes 
smtpd_data_restrictions = reject_unauth_pipelining
policy-spf_time_limit = 3600s
postscreen_greet_action = enforce
smtp_header_checks = regexp:/etc/postfix/hide
header_checks = regexp:/etc/postfix/filter
smtpd_tls_ciphers = export








--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70574.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: header checks not working

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 09:24:38AM -0700, Den wrote:

Do not post main.cf files.  Rather, post or attach output of
"postconf -n" that is not line-wrapped after cut/paste, you
need to post it with the original line-breaks preserved.

> # Debian specific:  Specifying a file name will cause the first
> # line of that file to be used as the name.  The Debian default
> # is /etc/mailname.
> myorigin = $mydomain
> #myhostname = localhost
> myhostname = 

This cannot be your active main.cf file, since Postfix enforces a
non-empty setting for myhostname.

... bash used below for sub-process file handles <( ... ) ...

$ touch /tmp/master.cf
$ echo "myhostname =" > /tmp/main.cf

$ postconf -c /tmp -n
config_directory = /tmp
myhostname =

$ postmap -c /tmp -q "foo" pcre:<(echo '/foo/ bar')
postmap: fatal: bad string length 0 < 1: myhostname =

$ echo "myhostname = bogus" > /tmp/main.cf
$ postmap -c /tmp -q "foo" pcre:<(echo '/foo/ bar')
bar

Similar fatal errors would break pretty much everything other than
postconf(1).

-- 
Viktor.


Re: header checks not working

2014-09-11 Thread Wietse Venema
Den:
> Hello again Wietse,
> 
> Here goes my main.cf. There is no
> "receive_override_options=no_header_body_checks" 
>  anywhere here as well. Would be absolutely and genuinely thankful for any
> suggestions...
> 
> # See /usr/share/postfix/main.cf.dist for a commented, more complete version
> 
> # Debian specific:  Specifying a file name will cause the first
> # line of that file to be used as the name.  The Debian default
> # is /etc/mailname.
> myorigin = $mydomain
> #myhostname = localhost
> myhostname = 
> mydestination = 

As Viktor says, Postfix would never run with empty myhostname.
Send "postconf -n" output instead, preserving line breaks
(or use "postconf -nf" if your Postfix version supports that).

Wietse


Re: header checks not working

2014-09-11 Thread Den
Hello Viktor,

Thank you for your message.

It is my functional, active, and fully operational main.cf that has been
working perfectly fine. The only thing removed for privacy / security
reasons was a big list of actual domain names hosted on this server. Not
sure if it is really needed to know these names to troubleshoot the issue.

However, that wasn't the point. The point (Wetse's request) was to prove
that none of my configuration files had
"receive_override_options=no_header_body_checks". I think it has been proved
now. The "override" option is not present anywhere, but header checks do not
discard email messages.

Would you still like me to post postconf -n? Thanks.



--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70577.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: header checks not working

2014-09-11 Thread Wietse Venema
Den:
> Hello Viktor,
> 
> Thank you for your message.
> 
> It is my functional, active, and fully operational main.cf that has been
> working perfectly fine. The only thing removed for privacy / security
> reasons was a big list of actual domain names hosted on this server. Not
> sure if it is really needed to know these names to troubleshoot the issue.

Sorry, Postfix does not work with empty myhostname. If you must
anonymize, use example.com, example.net, 10.*.*.* etc. Don't just
silently alter the evidence and waste our time.

Wietse

> However, that wasn't the point. The point (Wetse's request) was to prove
> that none of my configuration files had
> "receive_override_options=no_header_body_checks". I think it has been proved
> now. The "override" option is not present anywhere, but header checks do not
> discard email messages.
> 
> Would you still like me to post postconf -n? Thanks.
> 
> 
> 
> --
> View this message in context: 
> http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70577.html
> Sent from the Postfix Users mailing list archive at Nabble.com.
> 


Re: header checks not working

2014-09-11 Thread Den
Hello Wietse and Viktor,

OK. Let me post the postconf -n with just one domain name I am fine to
disclose. Hope it will help. Thank you so much for your fast replies.
Appreciate your taking part in troubleshooting my problem...

alias_maps = hash:/etc/aliases
append_at_myorigin = yes
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
default_destination_concurrency_limit = 20
delay_warning_time = 4h
disable_vrfy_command = yes
dovecot-spamass_destination_recipient_limit = 1
header_checks = regexp:/etc/postfix/spamdiscard
home_mailbox = Maildir/
in_flow_delay = 1s
local_destination_concurrency_limit = 16
mailbox_command = /usr/bin/procmail
mailbox_size_limit = 0
message_size_limit = 2048
mydestination =
mydomain = newcruz-offshore.com
myhostname = mail.newcruz-offshore.com
mynetworks = 127.0.0.0/8 [:::127.0.0.0]/104 [::1]/128
myorigin = $mydomain
policy-spf_time_limit = 3600s
postscreen_greet_action = enforce
readme_directory = no
recipient_delimiter = +
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
show_user_unknown_table_name = no
smtp_header_checks = regexp:/etc/postfix/hide
smtp_sasl_security_options = noanonymous noplaintext
smtp_sasl_tls_security_options = noanonymous
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_client_restrictions = check_client_access hash:/etc/postfix/blacklist,
reject_unknown_reverse_client_hostname, reject_rbl_client relays.ordb.org,
reject_rbl_client zen.spamhaus.org, reject_rbl_client cbl.abuseat.org,
reject_rbl_client dsn.rfc-ignorant.org, reject_rbl_client
dul.dnsbl.sorbs.net, reject_rbl_client bl.spamcop.net, reject_rbl_client
combined.rbl.msrbl.net, reject_rbl_client b.barracudacentral.org
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_error_sleep_time = 20
smtpd_hard_error_limit = 3
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated,
reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname,
check_helo_access hash:/etc/postfix/helo_access
smtpd_junk_command_limit = 2
smtpd_recipient_restrictions = reject_non_fqdn_recipient
reject_unknown_recipient_domain permit_sasl_authenticated permit_mynetworks
reject_unauth_destination reject_non_fqdn_hostname reject_invalid_hostname
reject_unauth_pipelining reject_rbl_client zen.spamhaus.org
reject_rbl_client cbl.abuseat.org reject_rbl_client dsn.rfc-ignorant.org
reject_rbl_client dul.dnsbl.sorbs.net reject_rbl_client bl.spamcop.net
reject_rbl_client combined.rbl.msrbl.net reject_rbl_client
b.barracudacentral.org check_policy_service unix:private/policy-spf
check_policy_service inet:127.0.0.1:10023 permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_unknown_sender_domain,
reject_non_fqdn_sender, reject_rhsbl_sender dsn.rfc-ignorant.org
smtpd_soft_error_limit = 2
smtpd_tls_CAfile = /etc/ssl/signed/ca.crt
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/signed/new.crt
smtpd_tls_ciphers = export
smtpd_tls_key_file = /etc/ssl/signed/new.key
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
strict_rfc821_envelopes = yes
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
virtual_gid_maps = static:1000
virtual_mailbox_base = /home/mail
virtual_mailbox_domains = newcruz-offshore.com 
virtual_mailbox_maps = hash:/etc/postfix/virtual_boxes
virtual_minimum_uid = 100
virtual_transport = dovecot-spamass
virtual_uid_maps = static:1000




--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70579.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: header checks not working

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 10:20:06AM -0700, Den wrote:

> header_checks = regexp:/etc/postfix/spamdiscard

So this is is the actual setting.

On Thu, Sep 11, 2014 at 09:24:38AM -0700, Den wrote:

> header_checks = regexp:/etc/postfix/filter

And this is not.

On Thu, Sep 11, 2014 at 08:24:40AM -0700, Den wrote:

> They all do work well because testing them via postmap doesn't report any
> issues. For example running the following: 
> 
> postmap -q "X-Spam-Flag: YES/" regexp:/etc/postfix/filter 

And this is the wrong test.

-- 
Viktor.


postfix, Maildir, and case sensitivity

2014-09-11 Thread John Oliver
CentOS 6.5, postfix-2.6.6-6

I used http://www.linuxmail.info/postfix-dovecot-ldap-centos-5/ as a
guide to get postfix and dovecot working with LDAP.

My issue is that postfix uses the literal cn to write mail to, so in my
test case I get 'testUser1'  However, when I log in via dovecot using
IMAP, it ignores testUser1 and creates testuser1  I'm looking into how
to get dovecot to ignore case, but in case that isn't possible, is there
a way to make postfix ignore case?  I cannot count on being able to
enforce that all cns in LDAP are all lower-case.

-- 
***
* John Oliver http://www.john-oliver.net/ *
* *
***


Re: header checks not working

2014-09-11 Thread Den
That's right Viktor. Your are absolutely right.

The correct line is header_checks = regexp:/etc/postfix/spamdiscard 

and running this: postmap -q "X-Spam-Flag: YES/"
regexp:/etc/postfix/spamdiscard

returns no errors.

The postmap -q "X-Spam-Flag: YES/" regexp:/etc/postfix/filter 

is a typo as I was doing it manually while copy-pasting my config for the
first time,  I am so sorry about that.
 




--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70581.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: postfix, Maildir, and case sensitivity

2014-09-11 Thread Wietse Venema
John Oliver:
> CentOS 6.5, postfix-2.6.6-6
> 
> I used http://www.linuxmail.info/postfix-dovecot-ldap-centos-5/ as a
> guide to get postfix and dovecot working with LDAP.
> 
> My issue is that postfix uses the literal cn to write mail to, so in my
> test case I get 'testUser1'  However, when I log in via dovecot using
> IMAP, it ignores testUser1 and creates testuser1  I'm looking into how
> to get dovecot to ignore case, but in case that isn't possible, is there
> a way to make postfix ignore case?  I cannot count on being able to
> enforce that all cns in LDAP are all lower-case.

Sorry, the crystal ball is not working today.

Wietse


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Hannes Erven

Hi Sean,


> Meanwhile, I've managed to record a tcpdump of such a failed session.
> What exactly am I looking for there?

I remember a possibly similar situation back in 2008... the culprit was 
a not-fully-up-to-date Cisco ASA firewall that corrupted TCP SACK fields 
and hence had the remote site send RSET.
Anyways on our end the connection seemed to starve, just as you describe 
it.


We detected that by comparing tcpdumps from both affected ends. Of 
course we had been lucky enough to have that happen with a business 
partner with competent IT people who we got a hold of, spotted the 
problem and also temporarily switched the feature off on their side to 
prove that this actually is the problem.

A firmware upgrade on my client's firewall then fixed the issue.

With a server hosted somewhere and incoming connections from big 
clusters, you might not be as lucky as that...



best regards,

-hannes


Re: postfix, Maildir, and case sensitivity

2014-09-11 Thread John Oliver
On Thu, Sep 11, 2014 at 02:42:11PM -0400, Wietse Venema wrote:
> John Oliver:
> > CentOS 6.5, postfix-2.6.6-6
> > 
> > I used http://www.linuxmail.info/postfix-dovecot-ldap-centos-5/ as a
> > guide to get postfix and dovecot working with LDAP.
> > 
> > My issue is that postfix uses the literal cn to write mail to, so in my
> > test case I get 'testUser1'  However, when I log in via dovecot using
> > IMAP, it ignores testUser1 and creates testuser1  I'm looking into how
> > to get dovecot to ignore case, but in case that isn't possible, is there
> > a way to make postfix ignore case?  I cannot count on being able to
> > enforce that all cns in LDAP are all lower-case.
> 
> Sorry, the crystal ball is not working today.

Postfix write to /var/vmail/testUser1

Dovecot insists on reading from /var/vmail/testuser1

How can I make postfix ignore/strip out capitalization and write to
/var/vmail/testuser1 ?

-- 
***
* John Oliver http://www.john-oliver.net/ *
* *
***


Re: postfix, Maildir, and case sensitivity

2014-09-11 Thread li...@rhsoft.net

Am 11.09.2014 um 20:53 schrieb John Oliver:
> On Thu, Sep 11, 2014 at 02:42:11PM -0400, Wietse Venema wrote:
>> John Oliver:
>>> CentOS 6.5, postfix-2.6.6-6
>>>
>>> I used http://www.linuxmail.info/postfix-dovecot-ldap-centos-5/ as a
>>> guide to get postfix and dovecot working with LDAP.
>>>
>>> My issue is that postfix uses the literal cn to write mail to, so in my
>>> test case I get 'testUser1'  However, when I log in via dovecot using
>>> IMAP, it ignores testUser1 and creates testuser1  I'm looking into how
>>> to get dovecot to ignore case, but in case that isn't possible, is there
>>> a way to make postfix ignore case?  I cannot count on being able to
>>> enforce that all cns in LDAP are all lower-case.
>>
>> Sorry, the crystal ball is not working today.
> 
> Postfix write to /var/vmail/testUser1
> 
> Dovecot insists on reading from /var/vmail/testuser1
> 
> How can I make postfix ignore/strip out capitalization and write to
> /var/vmail/testuser1?

why don't you just use LMTP?
http://wiki2.dovecot.org/LMTP


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread Wietse Venema
Sean Durkin:
> Meanwhile, I've managed to record a tcpdump of such a failed
> session. What exactly am I looking for there?

- The receiving host's window announcement in the tcp handshake
  and in subsequent ACKs.

- Whether there is a "gap" in the sender packet sequence numbers
  as seen by the receiving host.

Such a gap means that a particular packet is being dropped.

Just to bore you with a few examples of bad middleboxes:

- Shortly after the first Postfix release there was a problem with
  traffic corruption due to a buggy middlebox (a Packeteer traffic
  shaper). The error had a very distinct signature.

- For many years, there were problems with CISCO PIX "firewalls"
  that inspected SMTP traffic but failed to properly handle the
  case that . happened to fall on a packet boundary.

- http://www.arschkrebs.de/postfix/postfix_cisco_pix_bugs.shtml
  has other examples where CISCO PIX/ASA "firewalls" will mis-handle
  SMTP traffic in various ways.

In your case, you may have to collaborate with someone who is willing
to send large amounts of random email; hopefully some messages will
trigger the bug, and then the sender and receiver can compare tcpdump
recordings.

Wietse


Re: pipemap, multiple results [patch]

2014-09-11 Thread Wietse Venema
Unless I am mistaken, this implements the same functionality as the
pipemap table. It queries tables in sequence, not in parallel.

Wietse

+static const char *dict_join_lookup(DICT *dict, const char *query)
+{
+const char myname[] = "dict_join_lookup";
+DICT_JOIN *dict_join = (DICT_JOIN *) dict;
+DICT   *map;
+char  **cpp;
+char   *dict_type_name;
+const char *result = 0;
+
+vstring_strcpy(dict_join->qr_buf, query);
+for (cpp = dict_join->map_join->argv; (dict_type_name = *cpp) != 0; cpp++) 
{
+   if ((map = dict_handle(dict_type_name)) == 0)
+   msg_panic("%s: dictionary \"%s\" not found", myname, 
dict_type_name);
+   if ((result = dict_get(map, STR(dict_join->qr_buf))) == 0)
+   DICT_ERR_VAL_RETURN(dict, map->error, result);
+   vstring_strcpy(dict_join->qr_buf, result);
+}
+DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, STR(dict_join->qr_buf));
+}


Re: header checks not working

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 10:47:09AM -0700, Den wrote:

> That's right Viktor. Your are absolutely right.
> 
> The correct line is header_checks = regexp:/etc/postfix/spamdiscard 
> 
> and running this: postmap -q "X-Spam-Flag: YES/"
> regexp:/etc/postfix/spamdiscard
> 
> returns no errors.
> 
> The postmap -q "X-Spam-Flag: YES/" regexp:/etc/postfix/filter 
> 
> is a typo as I was doing it manually while copy-pasting my config for the
> first time,  I am so sorry about that.

If you cannot report problems accurately, or expect readers to piece
together fragments of separate messages, I'm afraid I can't help you.

Header checks work when correctly specified.

-- 
Viktor.


Re: pipemap, multiple results

2014-09-11 Thread Roel van Meer

Wietse Venema writes:


Unless I am mistaken, this implements the same functionality as the
pipemap table. It queries tables in sequence, not in parallel.


You are correct.  The patch consisted of three parts.  The first two parts are  
used to get the basic file structure in place for the joinmap, based on the  
pipemap.  The third part changes the functionality of the new map.  The  
section you quoted was from the second part, copying pipemap to joinmap.


Maybe this was not a handy format to post it; I'll post a new patch tomorrow.

Regards,

Roel


Re: Possible reasons for "lost connection after DATA"

2014-09-11 Thread L. Mark Stone
Any chance there is a UTM device in the email stream? 

We see lots of these errors when our SonicWalls do an RBL lookup, don't like 
the data in the email stream etc. The SonicWalls then just drop the connection 
and Postfix logs the drop. 

Hope that helps, 
Mark 


Re: header checks not working

2014-09-11 Thread Wietse Venema
Den:
> I have a feeling that my subject line is a problem because much simpler
> header checks that contain only two or three simple dictionary words work
> just fine. Therefore I was also wondering if anyone who runs reject,

What text editor are you using? If it is any kind of word processor
software then that is your problem.

$ hexdump -c the-regexp-file

And look for anything in that you did not mean to have in there.
What you should see is printable characters and an occasional
space, \t or \n.

Wietse


Does local mail bypass milter?

2014-09-11 Thread D'Arcy J.M. Cain
I am trying to fix a mailman footer issue as described here:

https://stuff.mit.edu/~jik/software/mailman_mimedefang/mailman_mimedefang_fix_footer.pl.txt

I believe I have everything set up including this line in main.cf:

smtpd_milters = inet:127.0.0.1:19534

However, there doesn't appear to be any action taken.  Is there any way
in postfix to determine that the milter is actually being run?  I tried
setting syslog to debug but that didn't show anything.

Is it possible that mail arriving locally is bypassing the milter?

postconf -n attached.  I only removed the tls lines.

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
alias_database = hash:/etc/postfix/aliases hash:/var/db/mailman/data/aliases
alias_maps = hash:/etc/postfix/aliases, hash:/var/db/mailman/data/aliases
always_add_missing_headers = yes
body_checks = regexp:/var/postfix/virus_body_checks
bounce_queue_lifetime = 3d
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
command_time_limit = 5000
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 10
disable_vrfy_command = yes
header_checks = regexp:/var/postfix/virus_header_checks
regexp:/var/postfix/header_checksregexp:/var/postfix/auth_checks
home_mailbox = mail/INBOX/
html_directory = no
local_destination_concurrency_limit = 2
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_command = /usr/pkg/bin/procmail
mailbox_size_limit = 102400
mailq_path = /usr/bin/mailq
manpage_directory = /usr/man
masquerade_domains = shell.vex.net, smaug.vex.net
masquerade_exceptions = root, db, pgsql
maximal_queue_lifetime = 3d
message_size_limit = 104857600
mydestination = $mydomain,  aragorn.$mydomain,  db.$mydomain,  druid.$mydomain, 
 gollum.$mydomain,  mail.$mydomain,  mailman.$mydomain,  pop.$mydomain,  
sauron.$mydomain,  shell.$mydomain,  smaug.$mydomain,  vex.$mydomain
mydomain = vex.net
myhostname = mail.vex.net
mynetworks = 127.0.0.0/8,  98.158.139.64/27,  192.168.151.0/24,  
207.35.13.14/32,  64.99.180.16/29,  50.243.220.60/32
mynetworks_style = subnet
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
owner_request_special = no
postscreen_access_list = permit_mynetworks, 
cidr:/var/postfix/postscreen_access.cidr
postscreen_dnsbl_action = enforce
postscreen_greet_action = enforce
queue_directory = /var/spool/postfix
recipient_delimiter = +
sendmail_path = /usr/sbin/sendmail
setgid_group = maildrop
smtp_bind_address = 98.158.139.68
smtpd_client_restrictions = permit_mynetworks,
permit_sasl_authenticated,reject_rbl_client zen.spamhaus.org,
reject_rbl_client psbl.surriel.compermit
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,permit_sasl_authenticated,  
  reject_invalid_hostname,permit
smtpd_milters = inet:127.0.0.1:19534
smtpd_recipient_restrictions = permit_mynetworks,
reject_unlisted_recipient,permit_sasl_authenticated,
reject_unauth_pipelining,reject_unauth_destination,
check_policy_service inet:127.0.0.1:2525warn_if_reject 
reject_invalid_helo_hostname,reject_non_fqdn_helo_hostname,
reject_unknown_recipient_domain,permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks,
permit_sasl_authenticated,reject_unauth_destination,
check_client_access hash:/var/postfix/client_access,check_sender_access 
hash:/var/postfix/sender_access,permit
tls_random_source = dev:/dev/urandom
transport_maps = hash:/var/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_mailbox_limit = 0


Re: Does local mail bypass milter?

2014-09-11 Thread Noel Jones
On 9/11/2014 4:24 PM, D'Arcy J.M. Cain wrote:
> I am trying to fix a mailman footer issue as described here:
> 
> https://stuff.mit.edu/~jik/software/mailman_mimedefang/mailman_mimedefang_fix_footer.pl.txt
> 
> I believe I have everything set up including this line in main.cf:
> 
> smtpd_milters = inet:127.0.0.1:19534
> 
> However, there doesn't appear to be any action taken.  Is there any way
> in postfix to determine that the milter is actually being run?  I tried
> setting syslog to debug but that didn't show anything.
> 
> Is it possible that mail arriving locally is bypassing the milter?
> 
> postconf -n attached.  I only removed the tls lines.
> 

Does reviewing the docs answer your question?
http://www.postfix.org/MILTER_README.html#plumbing



  -- Noel Jones


Re: postfix, Maildir, and case sensitivity

2014-09-11 Thread Viktor Dukhovni
On Thu, Sep 11, 2014 at 11:53:21AM -0700, John Oliver wrote:

> Postfix write to /var/vmail/testUser1
> 
> Dovecot insists on reading from /var/vmail/testuser1
> 
> How can I make postfix ignore/strip out capitalization and write to
> /var/vmail/testuser1 ?

Rewrite mail from testUser1 to testuser1 via virtual(5) aliases.

virtual:
# Lookup keys are lower-case in indexed file tables,
# while results are used verbatim.
#
testus...@example.com   testus...@example.com

-- 
Viktor.


Re: header checks not working

2014-09-11 Thread Den
I am replying through a gadget / portable device now so my apologies if it 
doesn't meet your gateway's etiquette requirements.

I am using a simple notepad as I don't like all these fansy word processors and 
all but hey! thank you so much for the idea, Wietse! I'll run more tests to see 
how it works when simplified to the very minimum then will start building on 
top of that, making it more complex step by step...

Regards,
Dennis.



-Original Message-
From: "Wietse Venema [via Postfix]" 
To: Den 
Sent: Fri, 12 Sep 2014 0:21
Subject: Re: header checks not working



Den:
> I have a feeling that my subject line is a problem because much simpler
> header checks that contain only two or three simple dictionary words work
> just fine. Therefore I was also wondering if anyone who runs reject,

What text editor are you using? If it is any kind of word processor
software then that is your problem.

$ hexdump -c the-regexp-file

And look for anything in that you did not mean to have in there.
What you should see is printable characters and an occasional
space, \t or \n.

Wietse




___
If you reply to this email, your message will be added to the discussion below:
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70593.html

To unsubscribe from header checks not working, visit 
http://postfix.1071664.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=36845&code=dGRsQGJhbHRpY3VtLXR2Lmx0fDM2ODQ1fDEzNjk3OTYyNDg=



--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70599.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: header checks not working

2014-09-11 Thread Michael J Wise

> It would be real kind of you
> if you could put the following into your subject field:

If you are going to refer to the GTUBE, best to just cite it by NAME, or
include an URL like:

http://spamassassin.apache.org/gtube/

Actually including it in a message is ... unwise.
Why is left as an exercise. :)

Aloha mai Nai`a.
-- 
" So this is how Liberty dies ...  http://kapu.net/~mjwise/
" To Thunderous Applause.




Re: postfix, Maildir, and case sensitivity

2014-09-11 Thread Benny Pedersen

On 11. sep. 2014 20.53.55 John Oliver  wrote:


How can I make postfix ignore/strip out capitalization and write to
/var/vmail/testuser1 ?


This problem are gone if you stop using postfix as lda and use dovecot-lda, 
and if you like to make it even more perfect make sure auth login users is 
case insensitive


Google dovecot insensitive auth

http://www.dovecot.org/list/dovecot/2013-August/092260.html

Change %u here with %Lu

Dont know if it works or not since i dont use ldap, other way could be to 
make sure ldap auth is always stored in lowercase


Re: Does local mail bypass milter?

2014-09-11 Thread D'Arcy J.M. Cain
On Thu, 11 Sep 2014 16:38:45 -0500
Noel Jones  wrote:
> > Is it possible that mail arriving locally is bypassing the milter?
> > 
> > postconf -n attached.  I only removed the tls lines.
> > 
> 
> Does reviewing the docs answer your question?
> http://www.postfix.org/MILTER_README.html#plumbing

Is there something specific I should be looking at.  I did check that
page before and I am sure that what I am doing follows everything
there.  What did I miss?  Mailman is sending by SMTP, not the sendmail
command line so the SMTP-only Milter application should work, no?

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net


Re: header checks not working

2014-09-11 Thread Den
Right, Michael.

Thank you for bringing this up and I really do appreciate your feedback.
I'll try to test this string with all the headers, not just my subject
field. Not sure it may get me somewhere though.

However, I think no matter what I put in my subject field or in the body
field the header

X-Spam-Flag: YES 

is added when the spam is tagged. Then based on that header and the
following rule 

/^X-Spam-Flag: YES/ discard 

this message has to be discarded, right? In my case it's wrong and the
trouble is that it is not discarded, it gets delivered.

Additionally, there is another "bullet proof" rule on top

/^Subject:.*\*{5}SPAM\*{5}/ discard

that is also used. The subject is appended correctly and the word
*SPAM* is added. Then having this rule in action the message has to
be discarded as well but... it gets delivered. These two rules never stop
the string in question. 



--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70603.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: header checks not working

2014-09-11 Thread Den
Viktor:
>Depending on your locale and MUA, subjects are sometimes encoded 
>using either Quoted Printable or Base64 encoding.  What you see 
>on the screen may differ from the subject header on the wire. 

>Header checks is a crude mechanism, that only deals with raw 
>wire-form data. 

Good point. All my locale and MUA are all English from head to toe all over,
but Quoted Printable and Base64 might be there I guess. Is it by any chances
email clients dependent somehow? The string in the subject field gets
converted to Quoted Printable by default in Microsoft's Outlook for example
and then it's not "parsed" correctly by the header rules in Postfix? This is
highly and exceptionally unlikely in my humble opinion but...




--
View this message in context: 
http://postfix.1071664.n5.nabble.com/header-checks-not-working-tp36845p70605.html
Sent from the Postfix Users mailing list archive at Nabble.com.


Re: pipemap, multiple results [patch v2]

2014-09-11 Thread Roel van Meer

Wietse Venema writes:


Unless I am mistaken, this implements the same functionality as the
pipemap table. It queries tables in sequence, not in parallel.


Attached is the new patch. Sorry about the confusion.
This one has some documentation changes as well.

Thanks,

Roel
Add support for joinmap tables

This patchs adds support for joinmap tables. A joinmap table is a table
that contains two or more other tables. A lookup in the joinmap tables is
done in all of the tables it contains. The result is concatenated and
returned.

The use case for this type of table is if you have two *different* tables
containing similar information (say an ldap table and a hash table with
virtial aliases) or if you have to do two lookups to get all the information
you want.

diff -ruN a/.indent.pro e/.indent.pro
--- a/.indent.pro   2014-07-18 01:09:15.0 +0200
+++ e/.indent.pro   2014-09-11 11:47:57.208236388 +0200
@@ -77,6 +77,7 @@
 -TDICT_DEBUG
 -TDICT_ENV
 -TDICT_FAIL
+-TDICT_JOIN
 -TDICT_HT
 -TDICT_LDAP
 -TDICT_LMDB
diff -ruN a/README_FILES/DATABASE_README e/README_FILES/DATABASE_README
--- a/README_FILES/DATABASE_README  2014-06-30 23:00:51.0 +0200
+++ e/README_FILES/DATABASE_README  2014-09-11 15:38:41.238330621 +0200
@@ -215,6 +215,15 @@
 iinntteerrnnaall
 A non-shared, in-memory hash table. Its content are lost when a process
 terminates.
+jjooiinnmmaapp (read-only)
+Join the result of lookups in several tables. Example: 
"jjooiinnmmaapp::
+!type1:name1! ... !typen:namen". A "joinmap:" query is given to all
+tables in the joinmap. Any results that are received are joined and
+the end result is returned. The query is always given to all tables,
+even if a result has already been found. Results are not deduplicated.
+The first ASCII character after "joinmap:" will be used as the 
separator
+between the lookup tables that follow (do not use space, ",", ":" or
+non-ASCII).
 llmmddbb
 OpenLDAP LMDB database. This is available only on systems with support
 for LMDB databases. Public database files are created with the postmap
diff -ruN a/html/DATABASE_README.html e/html/DATABASE_README.html
--- a/html/DATABASE_README.html 2014-06-30 23:00:50.0 +0200
+++ e/html/DATABASE_README.html 2014-09-11 15:54:24.842153050 +0200
@@ -318,6 +318,19 @@
  A non-shared, in-memory hash table. Its content are lost when
 a process terminates. 
 
+ joinmap (read-only) 
+
+ Joins the result of lookups in several tables. Example:
+"joinmap:!type1:name1!
 ...
+!typen:namen".  A "joinmap:" query is
+given to all tables in the joinmap.  Any results that are received
+are joined and the end result is returned.  The query is always
+given to all tables, even if a result has already been found.  Results
+are not deduplicated.
+The first ASCII character after "pipemap:"
+will be used as the separator between the lookup tables that follow
+(do not use space, ",", ":" or non-ASCII).  
+
  lmdb 
 
  OpenLDAP LMDB database.  This is available only on systems
diff -ruN a/man/man1/postconf.1 e/man/man1/postconf.1
--- a/man/man1/postconf.1   2014-06-30 19:49:18.0 +0200
+++ e/man/man1/postconf.1   2014-09-11 15:43:38.878332662 +0200
@@ -255,6 +255,16 @@
 .IP \fBinternal\fR
 A non-shared, in-memory hash table. Its content are lost
 when a process terminates.
+.IP "\fBjoinmap\fR (read-only)"
+Join the result of lookups in several tables. Example: 
+"\fBjoinmap:\fI!type_1:name_1!  ... !type_n:name_n\fR".
+A "joinmap:" query is given to all tables in the joinmap.
+Any results that are received are joined and the end
+result is returned. The query is always given to all tables,
+even if a result has already been found. Results are not
+deduplicated. The first ASCII character after "joinmap:"
+will be used as the separator between the lookup tables
+that follow (do not use space, ",", ":" or non-ASCII).
 .IP "\fBlmdb\fR"
 OpenLDAP LMDB database (a memory-mapped, persistent file).
 Available on systems with support for LMDB databases.  This
diff -ruN a/mantools/postlink e/mantools/postlink
--- a/mantools/postlink 2014-09-07 18:01:34.0 +0200
+++ e/mantools/postlink 2014-09-11 15:45:02.148333229 +0200
@@ -1118,6 +1118,7 @@
 s/\b(fail):/$1<\/a>:/g;
 s/\b(hash):/$1<\/a>:/g;
 s/\b(internal):/$1<\/a>:/g;
+s/\b(joinmap):/$1<\/a>:/g;
 s/\b(ldap):/$1<\/a>:/g;
 s/\b(lmdb):/$1<\/a>:/g;
 s/\b(memcache):/$1<\/a>:/g;
diff -ruN a/proto/DATABASE_README.html e/proto/DATABASE_README.html
--- a/proto/DATABASE_README.html2014-06-30 22:56:16.0 +0200
+++ e/proto/DATABASE_README.html2014-09-11 15:47:22.272194203 +0200
@@ -318,6 +318,18 @@
  A non-shared, in-memory hash table. Its content are lost when
 a process terminates. 
 
+ joinmap (read-only) 
+
+ Joins the result of lookups in several tables. Example:
+"joinmap:!type1:name1! ...
+!typen