Re: All email forward a copy to testing server

2010-04-15 Thread Patric Falinder
Mark Martinec skrev 2010-04-13 14:17:
 Patric,
 
 I looked in to it a little more and it looks like Maia re-writes the
 new.sub.domain.com to sub.domain.com.
 I get:

 /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
 patric.falin...@omg.nu -
 patric.falin...@sub.domain.com,patric.falin...@sub.domain.com

 When I guess it should be:

 /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
 patric.falin...@omg.nu -
 patric.falin...@sub.domain.com,patric.falin...@new.sub.domain.com

 Maybe this is more of a Maia problem so I will ask there if no one here
 knows whats wrong.
 
 I very much doubt it is the Maia doing a rewrite.
 More likely your smtp_generic mapping or masquerading.
 Keep in mind that a post-queue content filtered message
 goes through Postfix twice.
 
   Mark
I asked at the Maia-list and they said that I should do the split
after amavisd-maia processes the message and that I maybe could do
something like this in master.cf:

127.0.0.1:10025 inet n  -   n   -   -  smtpd
 -o content_filter=
 -o local_recipient_maps=
 [snip]
 -o recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc

So I did and restarted postfix, and after that I only get:
host 127.0.0.1[127.0.0.1] said: 450 4.4.1 Can't connect to localhost
port 10025
I tried manually telnet to port 10025 but it didn't work, I checked in
netstat if something was listening to port 10025 and there was..

This is how it looks in my master.cf, only pasted the 10025 part:

127.0.0.1:10025 inet n - - - - smtpd
  -o content_filter=
  -o local_recipient_maps=
  -o relay_recipient_maps=
  -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 mynetworks_style=host
  -o mynetworks=127.0.0.0/8,10.0.0.0/24
  -o strict_rfc821_envelopes=yes
  -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
receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

Is it not possible to add -o recipient_bcc_maps =
regexp:/etc/postfix/recipient_bcc in master.cf? How should I do to make
the split after maia has processed the message if this doesn't work?


Thanks,
Patric


Re: All email forward a copy to testing server

2010-04-15 Thread Wietse Venema
Patric Falinder:
 Ok after a little trail and error I tried to remove the
 no_address_mappings from -o receive_override_options= in mater.cf
 and it started working:D I did as I first was told, with the options in
 main.cf so I didn't add the -o recipient_bcc_maps =
 regexp:/etc/postfix/recipient_bcc in master.cf. btw, does anyone know
 what no_address_mappings does in receive_override_options?

If in doubt read the documentation:

man 5 postconf
...
receive_override_options (default: empty)
   Enable  or disable recipient validation, built-in content filtering, or
   address mapping. Typically, these are specified in  master.cf  as  com-
   mand-line arguments for the smtpd(8), qmqpd(8) or pickup(8) daemons.
...
   no_address_mappings
  Disable canonical address mapping, virtual alias map  expansion,
  address  masquerading,  and  automatic  BCC  (blind carbon-copy)
  recipients. This is typically specified BEFORE an external  con-
  tent filter.

Wietse


Re: All email forward a copy to testing server

2010-04-13 Thread Patric Falinder

Wietse Venema skrev 2010-03-29 15:00:

Patric Falinder:

/etc/postfix/recipient_bcc:
/@sub\.domain\.com/
/^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com


Wietse Venema skrev 2010-03-29 14:47:

That first line has no result value.


Patric Falinder:

What should I set the result value to?
I got this example from the mailinglist so I didn't make it up my self.


I suppose that someone told you to do this:

if /@sub\.domain\.com/
...stuff...
endif

and then you mis-understood the first line.

If the ...stuff... is only one line, then the if/endif are not
needed.

I think I'm going to change the regexp and pcre table implementations
and disallow rules without result. No other Postfix table allows
that.

Wietse

ah yes I mis-understood it so I changed it as Ansgar said:

/^(.*)@sub\.domain\.com$/ $...@new.domain.com

I don't get any errors anymore but I doesn't seem like it want to 
deliver to new.sub.domain.com, it only send the mail to sub.domain.com.
Is there a possibility that my content-filter (Maia Mailguard) is 
changing something?
Because I can see that both pat...@new.sub.domain.com and 
pat...@sub.domain.com get sent to the content-filter but only 
pat...@sub.domain.com comes out from there.


Can I do this re-write after the content-filter? So my server receives 
a mail, send it to my content-filter, my content-filter sends it back to 
postfix and then it will make a copy as described in recipient_bcc?


Thanks,
Patric


Re: All email forward a copy to testing server

2010-04-13 Thread Patric Falinder

Patric Falinder skrev 2010-04-13 11:41:

Wietse Venema skrev 2010-03-29 15:00:

Patric Falinder:

/etc/postfix/recipient_bcc:
/@sub\.domain\.com/
/^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com


Wietse Venema skrev 2010-03-29 14:47:

That first line has no result value.


Patric Falinder:

What should I set the result value to?
I got this example from the mailinglist so I didn't make it up my self.


I suppose that someone told you to do this:

if /@sub\.domain\.com/
...stuff...
endif

and then you mis-understood the first line.

If the ...stuff... is only one line, then the if/endif are not
needed.

I think I'm going to change the regexp and pcre table implementations
and disallow rules without result. No other Postfix table allows
that.

Wietse

ah yes I mis-understood it so I changed it as Ansgar said:

/^(.*)@sub\.domain\.com$/ $...@new.domain.com

I don't get any errors anymore but I doesn't seem like it want to
deliver to new.sub.domain.com, it only send the mail to sub.domain.com.
Is there a possibility that my content-filter (Maia Mailguard) is
changing something?
Because I can see that both pat...@new.sub.domain.com and
pat...@sub.domain.com get sent to the content-filter but only
pat...@sub.domain.com comes out from there.

Can I do this re-write after the content-filter? So my server receives
a mail, send it to my content-filter, my content-filter sends it back to
postfix and then it will make a copy as described in recipient_bcc?

Thanks,
Patric
I looked in to it a little more and it looks like Maia re-writes the 
new.sub.domain.com to sub.domain.com.

I get:

/usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20] 
patric.falin...@omg.nu - 
patric.falin...@sub.domain.com,patric.falin...@sub.domain.com


When I guess it should be:

/usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20] 
patric.falin...@omg.nu - 
patric.falin...@sub.domain.com,patric.falin...@new.sub.domain.com


Maybe this is more of a Maia problem so I will ask there if no one here 
knows whats wrong.


Thanks for the help though!
-Patric


Re: All email forward a copy to testing server

2010-04-13 Thread Mark Martinec
Patric,

 I looked in to it a little more and it looks like Maia re-writes the
 new.sub.domain.com to sub.domain.com.
 I get:
 
 /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
 patric.falin...@omg.nu -
 patric.falin...@sub.domain.com,patric.falin...@sub.domain.com
 
 When I guess it should be:
 
 /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
 patric.falin...@omg.nu -
 patric.falin...@sub.domain.com,patric.falin...@new.sub.domain.com
 
 Maybe this is more of a Maia problem so I will ask there if no one here
 knows whats wrong.

I very much doubt it is the Maia doing a rewrite.
More likely your smtp_generic mapping or masquerading.
Keep in mind that a post-queue content filtered message
goes through Postfix twice.

  Mark


Re: All email forward a copy to testing server

2010-03-29 Thread Patric Falinder

Patric Falinder skrev 2010-03-24 12:00:

Ansgar Wiechers skrev 2010-03-24 11:49:

On 2010-03-24 Patric Falinder wrote:

If I have a subdomain that I need to do this with, sub.domain.com,
should it he like this then?

/etc/postfix/recipient_bcc:
if /@sub\.domain\.com/
/^...@sub\.domain\.com$/ $...@new.domain.com
endif


You can probably omit the if ... endif, the match alone should be
sufficient.


I get this error:
warning: regexp map /etc/postfix/recipient_bcc, line 2: out of range
replacement index 1: skipping this rule

What did I do wrong?


You didn't group what the $1 is supposed to refer to.

/^(.*)@sub\.domain\.com$/ $...@new.domain.com

Regards
Ansgar Wiechers


ah, I changed that but now I get this error message:

warning: regexp map /etc/postfix/recipient_bcc, line 1: using empty
replacement string
warning: recipient_bcc_maps lookup of patric.falin...@sub.domain.com
returns an empty string result
warning: recipient_bcc_maps should return NO RESULT in case of NOT FOUND

Should there be something more on the first line?
I'm a total noob when it comes to scripting and such.

I have all my users and stuff in a MySQL-databse if that would be some
kind of problem here I don't know!?

Thanks,
Patric
Is there no one that can help me with this? I really need this, or 
something similar, to work. Is it perhaps possible to do it with some 
other function?


Thanks,
Patric


Re: All email forward a copy to testing server

2010-03-29 Thread Wietse Venema
Patric Falinder:
  ah, I changed that but now I get this error message:
 
  warning: regexp map /etc/postfix/recipient_bcc, line 1: using empty
  replacement string
  warning: recipient_bcc_maps lookup of patric.falin...@sub.domain.com
  returns an empty string result
  warning: recipient_bcc_maps should return NO RESULT in case of NOT FOUND
 
  Should there be something more on the first line?
  I'm a total noob when it comes to scripting and such.
 
  I have all my users and stuff in a MySQL-databse if that would be some
  kind of problem here I don't know!?
 
  Thanks,
  Patric
 Is there no one that can help me with this? I really need this, or 
 something similar, to work. Is it perhaps possible to do it with some 
 other function?

You show the error message BUT you did not show the configuration.

Wietse


Re: All email forward a copy to testing server

2010-03-29 Thread Wietse Venema
Patric Falinder:
 /etc/postfix/recipient_bcc:
 /@sub\.domain\.com/
 /^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com

That first line has no result value.

Wietse


Re: All email forward a copy to testing server

2010-03-29 Thread Patric Falinder

Wietse Venema skrev 2010-03-29 14:47:

Patric Falinder:

/etc/postfix/recipient_bcc:
/@sub\.domain\.com/
/^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com


That first line has no result value.

Wietse

What should I set the result value to?
I got this example from the mailinglist so I didn't make it up my self.

Thanks,
Patric


Re: All email forward a copy to testing server

2010-03-29 Thread Ralf Hildebrandt
* Patric Falinder patric.falin...@omg.nu:
 Wietse Venema skrev 2010-03-29 14:47:
 Patric Falinder:
 /etc/postfix/recipient_bcc:
 /@sub\.domain\.com/
 /^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com
 
 That first line has no result value.
 
  Wietse
 What should I set the result value to?
 I got this example from the mailinglist so I didn't make it up my self.

Leave it out then :)

-- 
Ralf Hildebrandt
  Geschäftsbereich IT | Abteilung Netzwerk
  Charité - Universitätsmedizin Berlin
  Campus Benjamin Franklin
  Hindenburgdamm 30 | D-12203 Berlin
  Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962
  ralf.hildebra...@charite.de | http://www.charite.de



Re: All email forward a copy to testing server

2010-03-29 Thread Patric Falinder

Wietse Venema skrev 2010-03-29 14:15:

Patric Falinder:

ah, I changed that but now I get this error message:

warning: regexp map /etc/postfix/recipient_bcc, line 1: using empty
replacement string
warning: recipient_bcc_maps lookup of patric.falin...@sub.domain.com
returns an empty string result
warning: recipient_bcc_maps should return NO RESULT in case of NOT FOUND

Should there be something more on the first line?
I'm a total noob when it comes to scripting and such.

I have all my users and stuff in a MySQL-databse if that would be some
kind of problem here I don't know!?

Thanks,
Patric

Is there no one that can help me with this? I really need this, or
something similar, to work. Is it perhaps possible to do it with some
other function?


You show the error message BUT you did not show the configuration.

Wietse

I added these in main.cf:
recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
smtp_generic_maps = hash:/etc/postfix/smtp_generic

and created these files:

/etc/postfix/smtp_generic:
@new.sub.domain.com @sub.domain.com

/etc/postfix/recipient_bcc:
/@sub\.domain\.com/
/^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com

When I send a message to that domain I get:

postfix/cleanup[25095]: warning: recipient_bcc_maps lookup of 
patric.falin...@sub.domain.com returns an empty string result
postfix/cleanup[25095]: warning: recipient_bcc_maps should return NO 
RESULT in case of NOT FOUND


Is there a typo or did I miss something in my main.cf?

Thanks,
Patric


Re: All email forward a copy to testing server

2010-03-29 Thread Ansgar Wiechers
On 2010-03-29 Patric Falinder wrote:
 Wietse Venema skrev 2010-03-29 14:47:
 Patric Falinder:
 /etc/postfix/recipient_bcc:
 /@sub\.domain\.com/
 /^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com

 That first line has no result value.

 What should I set the result value to?
 I got this example from the mailinglist so I didn't make it up my
 self.

No, you didn't get this example from the mailing list. You just
misunderstood me when I told you to omit the if ... endif.

I wanted you to change this:

  if /@sub\.domain\.com/
  /^...@sub\.domain\.com$/ $...@new.domain.com
  endif

into this:

  /^(.*)@sub\.domain\.com$/ $...@new.domain.com

I had considered it quite clear that an if-condition without the
if-keyword wouldn't make any sense.

Regards
Ansgar Wiechers
-- 
Abstractions save us time working, but they don't save us time learning.
--Joel Spolsky


Re: All email forward a copy to testing server

2010-03-29 Thread Wietse Venema
Patric Falinder:
 /etc/postfix/recipient_bcc:
 /@sub\.domain\.com/
 /^(.*)@sub\.domain\.com$/ $...@new.sub.domain.com

Wietse Venema skrev 2010-03-29 14:47:
 That first line has no result value.

Patric Falinder:
 What should I set the result value to?
 I got this example from the mailinglist so I didn't make it up my self.

I suppose that someone told you to do this:

if /@sub\.domain\.com/
...stuff...
endif

and then you mis-understood the first line.

If the ...stuff... is only one line, then the if/endif are not
needed.

I think I'm going to change the regexp and pcre table implementations
and disallow rules without result. No other Postfix table allows
that.

Wietse


Re: All email forward a copy to testing server

2010-03-24 Thread Patric Falinder

 (copy of an answer from a few days ago)

 To deliver to two destinations, you need two recipients.

 You can use a regexp recipient_bcc_maps to add another
 recipient, then use smtp_generic_maps to rewrite it back to
 the original during delivery.  Use a transport_maps entry to
 direct the bcc'ed mail to the proper server.

 # main.cf
 recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
 smtp_generic_maps = hash:/etc/postfix/smtp_generic
 transport_maps = hash:/etc/postfix/transport

 # recipient_bcc
 if /@example\.com/
 /^...@example\.com$/  $...@new.example.com
 endif

 # smtp_generic
 @new.example.com  @example.com

 # transport
 new.example.com  smtp:new.server.example.com

 Be sure to postmap the hash: tables after making changes to them.

   -- Noel Jones

If I have a subdomain that I need to do this with, sub.domain.com, 
should it he like this then?


/etc/postfix/recipient_bcc:
if /@sub\.domain\.com/
/^...@sub\.domain\.com$/ $...@new.domain.com
endif

I get this error:
warning: regexp map /etc/postfix/recipient_bcc, line 2: out of range 
replacement index 1: skipping this rule


What did I do wrong?


Re: All email forward a copy to testing server

2010-03-24 Thread Ansgar Wiechers
On 2010-03-24 Patric Falinder wrote:
 If I have a subdomain that I need to do this with, sub.domain.com,
 should it he like this then?

 /etc/postfix/recipient_bcc:
 if /@sub\.domain\.com/
 /^...@sub\.domain\.com$/ $...@new.domain.com
 endif

You can probably omit the if ... endif, the match alone should be
sufficient.

 I get this error:
 warning: regexp map /etc/postfix/recipient_bcc, line 2: out of range  
 replacement index 1: skipping this rule

 What did I do wrong?

You didn't group what the $1 is supposed to refer to.

/^(.*)@sub\.domain\.com$/ $...@new.domain.com

Regards
Ansgar Wiechers
-- 
Abstractions save us time working, but they don't save us time learning.
--Joel Spolsky


Re: All email forward a copy to testing server

2010-03-24 Thread Patric Falinder

Ansgar Wiechers skrev 2010-03-24 11:49:

On 2010-03-24 Patric Falinder wrote:

If I have a subdomain that I need to do this with, sub.domain.com,
should it he like this then?

/etc/postfix/recipient_bcc:
if /@sub\.domain\.com/
/^...@sub\.domain\.com$/ $...@new.domain.com
endif


You can probably omit the if ... endif, the match alone should be
sufficient.


I get this error:
warning: regexp map /etc/postfix/recipient_bcc, line 2: out of range
replacement index 1: skipping this rule

What did I do wrong?


You didn't group what the $1 is supposed to refer to.

/^(.*)@sub\.domain\.com$/ $...@new.domain.com

Regards
Ansgar Wiechers


ah, I changed that but now I get this error message:

warning: regexp map /etc/postfix/recipient_bcc, line 1: using empty 
replacement string
warning: recipient_bcc_maps lookup of patric.falin...@sub.domain.com 
returns an empty string result

warning: recipient_bcc_maps should return NO RESULT in case of NOT FOUND

Should there be something more on the first line?
I'm a total noob when it comes to scripting and such.

I have all my users and stuff in a MySQL-databse if that would be some 
kind of problem here I don't know!?


Thanks,
Patric


All email forward a copy to testing server

2010-03-19 Thread postfix users
Hi,

I am migrating the Exchange 2000 to Exchange 2010, but before we switch over
to new server, I want make a copy of email to new server for testing.


Existing Config:

Postfix - Amavisd - Exchange 2000

Here what I want :

Postfix --- Amavisd - Exchange 2000
   --- Exchange 2010

Is it possible?

Or it is better forward all email before Postfix?

email -- some program? -- Postfix --- Amavisd - Exchange 2000
   -- Exchange 2010

Many thanks in advance.

Regards,
Paul Margaillan


Re: All email forward a copy to testing server

2010-03-19 Thread Stan Hoeppner
postfix users put forth on 3/19/2010 8:34 PM:
 Hi,
 
 I am migrating the Exchange 2000 to Exchange 2010, but before we switch over
 to new server, I want make a copy of email to new server for testing.
 
 
 Existing Config:
 
 Postfix - Amavisd - Exchange 2000
 
 Here what I want :
 
 Postfix --- Amavisd - Exchange 2000
--- Exchange 2010
 
 Is it possible?
 
 Or it is better forward all email before Postfix?
 
 email -- some program? -- Postfix --- Amavisd - Exchange 2000
-- Exchange 2010

What does Microsoft recommend?  Your migration has nothing to do with
Postfix but everything to do with Exchange.

-- 
Stan


Re: All email forward a copy to testing server

2010-03-19 Thread Noel Jones

On 3/19/2010 8:34 PM, postfix users wrote:

Hi,

I am migrating the Exchange 2000 to Exchange 2010, but before we switch
over to new server, I want make a copy of email to new server for testing.


Existing Config:

Postfix - Amavisd - Exchange 2000

Here what I want :

Postfix --- Amavisd - Exchange 2000
--- Exchange 2010

Is it possible?

Or it is better forward all email before Postfix?

email -- some program? -- Postfix --- Amavisd - Exchange 2000
-- Exchange 2010

Many thanks in advance.

Regards,
Paul Margaillan






(copy of an answer from a few days ago)

To deliver to two destinations, you need two recipients.

You can use a regexp recipient_bcc_maps to add another
recipient, then use smtp_generic_maps to rewrite it back to
the original during delivery.  Use a transport_maps entry to
direct the bcc'ed mail to the proper server.

# main.cf
recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
smtp_generic_maps = hash:/etc/postfix/smtp_generic
transport_maps = hash:/etc/postfix/transport

# recipient_bcc
if /@example\.com/
/^...@example\.com$/  $...@new.example.com
endif

# smtp_generic
@new.example.com  @example.com

# transport
new.example.com  smtp:new.server.example.com

Be sure to postmap the hash: tables after making changes to them.

   -- Noel Jones