Re: Clustering

2009-03-29 Thread Barney Desmond
2009/3/28 Jose Perez jvoorhe...@gmail.com:
 So how can I make sure that a queue file (stored in one node of a
 cluster) it will be managed by another postfix instance (running in a
 different node of a cluster)?

 I thought that using DRBD (network mirrored data) over the postfix
 queue directory would be the solution but apparently I'm wrong...

That'd be dependent on how you choose to use DRBD. In active-active
configuration you need a cluster-aware filesystem on top of the block
device. I don't know how Postfix will play in this situation, I
suspect it would not be nice (since it'd be the same as two postfix
instances running on the same system, using the same queue/data/config
directories).

If you use an active-passive setup (the one I'm somewhat familiar
with) you'd be okay as long as you turn postfix into a shared HA
resource. This would have a warm failover - stop postfix on the downed
node, transfer control of the block device to the passive node, then
start up its instance of postfix. I *think* that would work fine, but
I'm not qualified to say for certain.

Wietse wrote:
 I don't know if DRBD propagates data before fsync() returns, or
 whether its updates happen later. If the updates happen later, the
 backup may never learn that mail was queued because the update
 still sits in the sender's DRBD queue.

This is dependent on your choice of replication protocol.
http://www.drbd.org/users-guide-emb/s-replication-protocols.html
The sanest option is protocol C. Those docs only refer to local
write operations, but I assume that would include fsync(), in which
case there's no problem.


Re: Clustering

2009-03-29 Thread Gejo Paul
Hi,

I guess sharing a same hard disk(using cluster) causes  I/O issues
(locking,delay in read write)  and in mail messaging the files used for
sending  are receiving  are of very small size(especially in kb's).

If you looking for sharing the load of the server, as per my view IMAP proxy
like perdition  is a good approach.

for eg like three front end servers for handling IMAP, POP(use perdition )
and webmail requests , two or three back end severs having the user's home
directories. and you can also use clustering for failover also.

Regards
Gejo


Active/passive cluster and postfix running on both nodes

2009-03-29 Thread Vianney Lejeune

Hello !

	I have a 2-nodes-active/passive cluster, each node runs postfix  
independently, only for local email.


I would like to achieve this scenario:

-if the nodes are both secondary, or one is down and the other one is  
secondary, each node stores locally iits own emails.


-If a node `is or becomes primary`, the secondary node transfers its  
own emails to the primary node.


Could you give me some clues ?

Regards,
Vianney


rewrite a sender-adresss in dependence of the recipient adress

2009-03-29 Thread karfunckel-postfix

Hi,

is there a way to rewrite a sender address in dependence of
the recipient?

Example:
sender + recipient = new sender address
--
j...@example.net + j...@example.net = robotforj...@example.net
j...@example.net + anything else = j...@example.net (no change)

Thanks,

Karfunckel



 



Re: rewrite a sender-adresss in dependence of the recipient adress

2009-03-29 Thread Wietse Venema
 karfunckel-post...@yahoo.de:
 is there a way to rewrite a sender address in dependence of
 the recipient?
 
 Example:
 sender + recipient = new sender address
 --
 j...@example.net + j...@example.net = robotforj...@example.net
 j...@example.net + anything else = j...@example.net (no change)

You are aksing for mail client functionality. Postfix is an MTA.

Wietse


Re: rewrite a sender-adresss in dependence of the recipient adress

2009-03-29 Thread mouss
karfunckel-post...@yahoo.de a écrit :
 Hi,
 
 is there a way to rewrite a sender address in dependence of
 the recipient?
 
 Example:
 sender + recipient = new sender address
 --
 j...@example.net + j...@example.net = robotforj...@example.net
 j...@example.net + anything else = j...@example.net (no change)
 

The less convoluted way I see would be to write a content filter to do
that.

what real problem are you trying to solve?


Changing virtual mailbox for large messages

2009-03-29 Thread Brian Schang

Hello:

I have read through the Postfix documentation and have Googled for an an 
answer, but I have not found a solution for the following problem...


In a nutshell, I have a number of virtual_mailbox_domains and 
virtual_mailbox_maps and everything is working perfectly. Now for a 
given virtual user, I'd like to change the virtual mailbox being used if 
the message is over a given size.


For instance, assume that I have the following entry in 
virtual_mailbox_maps:

u...@example.comexample.com/user/mail/inbox

And then assume that u...@example.com gets a large message. In this 
case, I'd like the equivalent of the following:

u...@example.comexample.com/user/mail/large

Is there any way to do this in native Postfix? If not, I presume that I 
could accomplish what I'm looking for by using either procmail or 
maildrop. But since I'm using virtual as my virtual_transport, that will 
require some work. In this case, does anyone have any references to suggest?


Thanks.

Brian Schang


Re: rewrite a sender-adresss in dependence of the recipient adress

2009-03-29 Thread karfunckel-postfix

  Hi,
 
  is there a way to rewrite a sender address in
 dependence of
  the recipient?
 
  Example:
  sender + recipient = new sender address
  --
  j...@example.net
 + j...@example.net
 = robotforj...@example.net
  j...@example.net
 + anything else = j...@example.net
 (no change)
 

 The less convoluted way I see would be to write a content
 filter to do
 that.

 what real problem are you trying to solve?

The problem:
- I have a webapp for an affiliate bussiness. The app sends emails to the 
registered users in dependence off a workflow-state.
- the sender-email-address is an email-address of the affiliated business 
(marketing decision)
- in some cases the affiliated business whants also to receive a CC of the 
message. But its email-server will not accept an email (sender-address) of its 
domain coming from outside of their network (SPAM-prevention).
= Thats because I _must_ send the email in my address, but for marketing 
reasons all other emails must be send like they are send now (in their name)

The actual solution is, that I send all emails for j...@example.net to a third 
email-server which has a sender_canonical-rewrite rule. This emailserver sends 
the email than forward with the changed sender-email-address to the MX of 
j...@example.net. This runs so actually successful for years. But I'm confident 
that there must be also a solution to solve the problem using only one 
email-server.

Is the problem understandable?

Karfunckel






Re: Changing virtual mailbox for large messages

2009-03-29 Thread mouss
Brian Schang a écrit :
 Hello:
 
 I have read through the Postfix documentation and have Googled for an an
 answer, but I have not found a solution for the following problem...
 
 In a nutshell, I have a number of virtual_mailbox_domains and
 virtual_mailbox_maps and everything is working perfectly. Now for a
 given virtual user, I'd like to change the virtual mailbox being used if
 the message is over a given size.
 
 For instance, assume that I have the following entry in
 virtual_mailbox_maps:
 u...@example.comexample.com/user/mail/inbox
 
 And then assume that u...@example.com gets a large message. In this
 case, I'd like the equivalent of the following:
 u...@example.comexample.com/user/mail/large
 
 Is there any way to do this in native Postfix?

No

 If not, I presume that I
 could accomplish what I'm looking for by using either procmail or
 maildrop. But since I'm using virtual as my virtual_transport, that will
 require some work. In this case, does anyone have any references to
 suggest?
 

The MAILDROP README explains how to use maildrop as your LDA. whether
this is easy or not depends on which imap server you use.



Re: rewrite a sender-adresss in dependence of the recipient adress

2009-03-29 Thread mouss
karfunckel-post...@yahoo.de a écrit :
 Hi,

 is there a way to rewrite a sender address in
 dependence of
 the recipient?

 Example:
 sender + recipient = new sender address
 --
 j...@example.net
 + j...@example.net
 = robotforj...@example.net
 j...@example.net
 + anything else = j...@example.net
 (no change)
 The less convoluted way I see would be to write a content
 filter to do
 that.

 what real problem are you trying to solve?

 The problem:
 - I have a webapp for an affiliate bussiness. The app sends emails to the 
 registered users in dependence off a workflow-state.
 - the sender-email-address is an email-address of the affiliated business 
 (marketing decision)
 - in some cases the affiliated business whants also to receive a CC of the 
 message. But its email-server will not accept an email (sender-address) of 
 its domain coming from outside of their network (SPAM-prevention).
 = Thats because I _must_ send the email in my address, but for marketing 
 reasons all other emails must be send like they are send now (in their name)
 
 The actual solution is, that I send all emails for j...@example.net to a 
 third email-server which has a sender_canonical-rewrite rule. This 
 emailserver sends the email than forward with the changed 
 sender-email-address to the MX of j...@example.net. This runs so actually 
 successful for years. But I'm confident that there must be also a solution to 
 solve the problem using only one email-server.
 
 Is the problem understandable?
 


try this:

define a custom smtp transport that has its own smtp_generic_maps:

== master.cf
customersmtp    smtp
-o smtp_generic_maps=pcre:/etc/postfix/customer_generic.pcre


then use transport_maps to pass mail to your customers via this transport.




Re: Changing virtual mailbox for large messages

2009-03-29 Thread Wietse Venema
Brian Schang:
 In a nutshell, I have a number of virtual_mailbox_domains and 
 virtual_mailbox_maps and everything is working perfectly. Now for a 
 given virtual user, I'd like to change the virtual mailbox being used if 
 the message is over a given size.

This is not built into Postfix. It can be done only with plugins.

* policy: You could use a Postix policy plugin that replies with
  REDIRECT when the message size attribute exceeds some limit. The
  target of REDIRECT would be an account with a different virtual
  mailbox.

  However, REDIRECT overrides ALL recipients, not just one, so it is
  no good when a message has multiple recipients.

  http://www.postfix.org/SMTPD_POLICY_README.html
  http://www.postfix.org/access.5.html

* external content filter: best is a pass-through proxy that does
  not maintain its own queue.

  http://www.postfix.org/FILTER_README.html

* milter: The Postfix Milter plug-in currently does not support
  the replace recipient action.

Wietse

 For instance, assume that I have the following entry in 
 virtual_mailbox_maps:
 u...@example.com  example.com/user/mail/inbox
 
 And then assume that u...@example.com gets a large message. In this 
 case, I'd like the equivalent of the following:
 u...@example.com  example.com/user/mail/large
 
 Is there any way to do this in native Postfix? If not, I presume that I 
 could accomplish what I'm looking for by using either procmail or 
 maildrop. But since I'm using virtual as my virtual_transport, that will 
 require some work. In this case, does anyone have any references to suggest?
 
 Thanks.
 
 Brian Schang
 
 



Re: Postfix - Yahoo parameters settings

2009-03-29 Thread Andrew Long
 In short, the principle of the setting is to delay the delivery from your
 Postfix to yahoo.
 In which rate yahoo can accept.

 Basically, you may take the following steps as reference,
 1. Create a seperate mail for the destination is yahoo, let's name it 'slow'
 queue
 (You may search in this mailling list too, someone has asked before)

Jumping in here because I am interested in the same solution but not
quite clear how to bind the new transport to the destination
(yahoo.com). I did the googling and afraid I'm no closer.

- Andrew


Re: Postfix - Yahoo parameters settings

2009-03-29 Thread Barney Desmond
2009/3/30 Andrew Long furs...@gmail.com:
 Jumping in here because I am interested in the same solution but not
 quite clear how to bind the new transport to the destination
 (yahoo.com). I did the googling and afraid I'm no closer.

It's documented right here: http://www.postfix.org/faq.html#incoming
The link was already mentioned a couple of messages ago in the thread
and was pretty clear on it.

The binding you refer to is the use of a transport map.


RE: Postfix - Yahoo parameters settings

2009-03-29 Thread MacShane, Tracy
 

 -Original Message-
 From: owner-postfix-us...@postfix.org 
 [mailto:owner-postfix-us...@postfix.org] On Behalf Of Andrew Long
 Sent: Monday, 30 March 2009 9:58 AM
 To: Jacky Chan
 Cc: postfix-users@postfix.org
 Subject: Re: Postfix - Yahoo parameters settings
 
  In short, the principle of the setting is to delay the 
 delivery from 
  your Postfix to yahoo.
  In which rate yahoo can accept.
 
  Basically, you may take the following steps as reference, 
 1. Create a 
  seperate mail for the destination is yahoo, let's name it 'slow'
  queue
  (You may search in this mailling list too, someone has asked before)
 
 Jumping in here because I am interested in the same solution 
 but not quite clear how to bind the new transport to the 
 destination (yahoo.com). I did the googling and afraid I'm no closer.
 
 - Andrew
 

(my slow transport is VERY slow, due to one domain we send to that only
accepts one message every 30 seconds)

master.cf
-

# transport for delicate domains
slowunix-   -   n   -   1smtp
-o syslog_name=postfix-slow


transport
--

yahoo.com   slow:



Mail not delivered to local users: status=deferred (mail transport unavailable)

2009-03-29 Thread Tobi

Hi All,
I set up an after-queue content filter following the instructions on
http://www.postfix.org/FILTER_README.html .
Everything works fine except that mail directed to local users is
deferred when it is re-injected to postfix after the content filter.
However, virtual and remote addresses work.
I have the trivial-rewrite, qmgr, local, and error daemons running
with the -v switch.
Here is a `grep id mail.log`  for a re-injected mail:

===
postfix/smtpd[22439]: BA9452DA112C: client=localhost[127.0.0.1]
postfix/cleanup[22435]: BA9452DA112C: message-  
id=20090329202930.dc9872da1...@mail.knmm.de

postfix/qmgr[22419]: qmgr_active_feed: incoming/BA9452DA112C
postfix/qmgr[22419]: qmgr_message_alloc: active BA9452DA112C
postfix/qmgr[22419]: BA9452DA112C: recipient limit 5000
postfix/qmgr[22419]: BA9452DA112C: from=a...@mail.knmm.de, size=516,  
nrcpt=1 (queue active)
postfix/qmgr[22419]: qmgr_peer_select: BA9452DA112C retry 4.3.0 mail  
transport unavailable (1 of 5)

postfix/qmgr[22419]: qmgr_job_retire: BA9452DA112C
postfix/qmgr[22419]: send attr queue_id = BA9452DA112C
postfix/error[22442]: BA9452DA112C: to=a...@mail.knmm.de,  
relay=none, delay=0.17, delays=0.02/0.13/0/0.02, dsn=4.3.0,  
status=deferred (mail transport unavailable)

postfix/qmgr[22419]: qmgr_active_done: BA9452DA112C
postfix/qmgr[22419]: wakeup BA9452DA112C after 300 secs
postfix/qmgr[22419]: qmgr_active_defer: defer BA9452DA112C
postfix/qmgr[22419]: qmgr_job_free: BA9452DA112C local
postfix/qmgr[22419]: qmgr_job_free: BA9452DA112C retry
===

Here is my master.cf section for the re-injection smtpd:

===
127.0.0.1:10025 inetn   -   y   -   -   smtpd
 -o content_filter=
 -o local_recipient_maps=
 -o relay_recipient_maps=
 -o mynetworks=127.0.0.0/8
 -o smtpd_restriction_classes=
 -o smtpd_delay_reject=no
 -o smtpd_client_restrictions=permit_mynetworks,reject
 -o smtpd_helo_restrictions=
 -o smtpd_sender_restrictions=
 -o smtpd_recipient_restrictions=permit_mynetworks,reject
 -o smtpd_data_restrictions=reject_unauth_pipelining
 -o smtpd_end_of_data_restrictions=
 -o smtpd_error_sleep_time=0
 -o smtpd_soft_error_limit=1001
 -o smtpd_hard_error_limit=1000
 -o smtpd_client_connection_count_limit=0
 -o smtpd_client_connection_rate_limit=0
 -o smtpd_authorized_xforward_hosts=127.0.0.0/8
 -o
receive_override_options 
=no_address_mappings,no_unknown_recipient_checks,no _header_body_checks

===

The local destination domain is included in mydestination.
My transport map has only one entry for an external domain.
I tried removing the '-o receive_override_options=no_address_mappings'
and '-o local_recipient_maps=', but nothing changed.
I'm out of ideas.

I really appreciate your help.

Thanks,

Tobi 


Re: Mail not delivered to local users: status=deferred (mail transport unavailable)

2009-03-29 Thread Wietse Venema
Tobi:
 Hi All,
 I set up an after-queue content filter following the instructions on
 http://www.postfix.org/FILTER_README.html .
 Everything works fine except that mail directed to local users is
 deferred when it is re-injected to postfix after the content filter.
 However, virtual and remote addresses work.
 I have the trivial-rewrite, qmgr, local, and error daemons running
 with the -v switch.
 Here is a `grep id mail.log`  for a re-injected mail:

Don't turn on verbose logging. You're overwhelming the log
with useless information.

Instead look at all the screams for help that Postfix already logs.

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

Wietse


Re: Mail not delivered to local users: status=deferred (mail transport unavailable)

2009-03-29 Thread Tobi

On Mar 29, 2009, at 5:10 PM, Wietse Venema wrote:


Tobi:

Hi All,
I set up an after-queue content filter following the instructions on
http://www.postfix.org/FILTER_README.html .
Everything works fine except that mail directed to local users is
deferred when it is re-injected to postfix after the content filter.
However, virtual and remote addresses work.
I have the trivial-rewrite, qmgr, local, and error daemons running
with the -v switch.
Here is a `grep id mail.log`  for a re-injected mail:


Don't turn on verbose logging. You're overwhelming the log
with useless information.

Instead look at all the screams for help that Postfix already logs.

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

Wietse



Wietse,

Thanks much for pointing this out.
It turned out that the problem was caused by:

postfix/local[29798]: fatal: main.cf configuration error:  
mailbox_size_limit is smaller than message_size_limit


My bad.

Many thanks for your support and the great work on postfix!

Tobi



Re: unusual access requirement

2009-03-29 Thread Noel Jones

Res wrote:

On Sat, 28 Mar 2009, Sahil Tandon wrote:


Don't use amavisd-new; it would be overkill for this task.  And from my


After looking at it, I tend to agree :)



Actually, amavisd-new is well suited for this.

At it's core, it's a high performance and very robust smtp 
proxy - just what you need.  You can easily disable the 
SpamAssassin and antivirus plugins, which are the main CPU and 
memory hogs associated with it.


Best of all, it already has the capture/quarantine code you 
need built-in.


From there, it's just some simple configuration settings to 
get what you have described.


In the past, I also have used clamav-milter to reject mail 
while keeping a copy.  You could write a custom signature to 
match the sender address you're interested in.  But note this 
only works with clamav-milter version 0.94.2 and earlier; 
versions 0.95 and newer use a different code base with a 
different quarantine method.  http://www.clamav.net


Or use the smtpprox proxy framework to roll your own.
http://bent.latency.net/smtpprox/

  -- Noel Jones


Re: Changing virtual mailbox for large messages

2009-03-29 Thread Terry Carmen

Brian Schang wrote:

Hello:

I have read through the Postfix documentation and have Googled for an 
an answer, but I have not found a solution for the following problem...


In a nutshell, I have a number of virtual_mailbox_domains and 
virtual_mailbox_maps and everything is working perfectly. Now for a 
given virtual user, I'd like to change the virtual mailbox being used 
if the message is over a given size.


For instance, assume that I have the following entry in 
virtual_mailbox_maps:

Mark Martinec was kind enough to translate my C message size filter into perl 
for amavisd-new. You can use it to add:

X-ActualMessageSize: ** 

X-ActualMessageSizeBytes: nn 

headers to your message (Each * = 1MB) then do something with it in header_checks. 


I'm not sure how you would use this to redirect it to a different mailbox for 
each user, but it's currently in production HOLDing messages that are too large 
for a client's exchange server.

Terry

---

Mark's message follows:

If all you need to do is to add two header fields based on mail size,
the simplest way is to call add_header() from a custom hook, e.g.:


somewhere in amavisd.conf add:

 include_config_files('/etc/amavisd-custom.conf');


then in /etc/amavisd-custom.conf :


package Amavis::Custom;
use strict;

# invoked at child process creation time;
# return an object, or just undef when custom checks are not needed
sub new {
 my($class,$conn,$msginfo) = @_;
 my($self) = bless {}, $class;
 my($mail_size) = $msginfo-msg_size;   # mail size in bytes
 my($mail_size_mb) = $mail_size/(1024*1024);
 my($hdr_edits) = $msginfo-header_edits;
 $hdr_edits-add_header('X-ActualMessageSizeBytes', $mail_size);
 $hdr_edits-add_header('X-ActualMessageSize',
'*' x ($mail_size_mb  50 ? 50 : $mail_size_mb));
 $self;  # returning an object activates further callbacks,
 # returning undef disables them
}
1;  # insure a defined return