Postfix randomizing outgoing IP using

2013-11-28 Thread M.Atıf CEYLAN

Hi,
I found the URL 
http://www.kutukupret.com/2010/12/06/postfix-randomizing-outgoing-ip-using-tcp_table-and-perl/ 
about multiple outgoing IP using.

I use postfix with dovecot LDA. My postfix main.cf conf.
...
transport_maps = tcp:[127.0.0.1]:2527
127.0.0.1:2527_time_limit = 3600s
..
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
.

master.cf
...
rotate1  unix -   -   n   -   -   smtp
  -o syslog_name=postfix-rotate1
  -o smtp_helo_name=smtp1.mydomain.com
  -o smtp_bind_address=10.0.0.3

rotate2  unix -   -   n   -   -   smtp
  -o syslog_name=postfix-rotate2
  -o smtp_helo_name=smtp2.mydomain.com
  -o smtp_bind_address=10.0.0.4

rotate3  unix -   -   n   -   -   smtp
  -o syslog_name=postfix-rotate3
  -o smtp_helo_name=smtp3.mydomain.com
  -o smtp_bind_address=10.0.0.5
...

Everything is great but when I want to sending an email to a local 
domain, smtp server looks at the mx record of the domain. Can I use 
local transport and transport_maps together? Or is there a way to 
sending to local domains?


Thanks,
--
M.Atıf CEYLAN


Re: Advanced master.cf query/update support

2013-11-28 Thread Wietse Venema
Wietse Venema:
> LuKreme:
> > On 27 Nov 2013, at 17:13 , Wietse Venema  wrote:
> > > Examples are at http://www.porcupine.org/postfix-mirror/wip.html
> > > and at the top of the RELEASE_NOTES file. Documentation is also in
> > > the postconf(1) manpage (nroff -man man/man1/postconf.1 | less).
> > 
> > My only comment is that the delineation between -F and -P is going
> > to cause confusion, misconfigurations, and much wailing and gnashing
> > of teeth.

My initial reaction was that fields and parameters support
different operations.

- Update (x/x/x=y) works for both master.cf parameters and fields.

- Create (x/x/x=y) works for master.cf parameters but not fields.

- Delete (-X) works for master.cf parameters but not fields.

- Comment out (-#) works for neither.

But the biggest differences are that 

$ postconf -F

knows that you are mis-typing a field name (where as you proposal
would think that you specify a parametername) and that

$ postconf -P
$ postconf -P service
$ postconf -P service/type

lists *only* master.cf (-o name=value) parameters while your
proposal would also list all the service/name/field settings.

What would you do to get only the parameters listed?

Wietse


Re: Advanced master.cf query/update support

2013-11-28 Thread LuKreme

On 27 Nov 2013, at 19:26 , Wietse Venema  wrote:

> LuKreme:
>> On 27 Nov 2013, at 17:13 , Wietse Venema  wrote:
>>> Examples are at http://www.porcupine.org/postfix-mirror/wip.html
>>> and at the top of the RELEASE_NOTES file. Documentation is also in
>>> the postconf(1) manpage (nroff -man man/man1/postconf.1 | less).
>> 
>> My only comment is that the delineation between -F and -P is going
>> to cause confusion, misconfigurations, and much wailing and gnashing
>> of teeth.
> 
> Specify -F if you want to change a column (chroot) and specify -P
> if you want to change a parameter (smtpd_recipient_restrictions).

Yes, I understand the difference, my point is that other people will be 
confused and that I suspect it is going to be a constant source of 
misconfiguration.

> The alternative is to encode it in the name:

Why? chroot is a field, can't it be parsed correctly?

> You are assuming that -F and -P will be the only name spaces, and
> that one name cannot appear in more than one place. I think that's
> two mistakes.

OK. I couldn't think of any field that collided with a parameter or what other 
name spaces there might be, but I predict it is going to be a issue.

Maybe field/smtp/inet/chroot=n and smtp/inet/mynetworks=127.0.0.1 (because I 
suspect changing the fields is going to be done much less often that 
parameters?)

> But the biggest differences are that 
> 
>$ postconf -F
> 
> knows that you are mis-typing a field name (where as you proposal
> would think that you specify a parameter name)

That’s' certainly an issue. How many parameters are there that are going to 
take a simple y/n setting though? There's not a single one in my main.cf, 
though there are a couple of single digits.

Also, the Fields are all single words, and almost all the parameters have 
multiple_words_with_underscores, so there might be something there.

myhostname mydomain myorigin mydestination and mynetworks seem to be the only 
parameter labels without an _ on my system, for example. They all conveniently 
start with "my".

> and that
> 
>$ postconf -P
>$ postconf -P service
>$ postconf -P service/type
> 
> lists *only* master.cf (-o name=value) parameters while your
> proposal would also list all the service/name/field settings.

That does seem like a good feature to have.

> What would you do to get only the parameters listed?

Off the top of my head I'd say that -P lists only the parameters by default and 
you'd need to specify a second flag to also list the fields --full or --fields 
or something, perhaps. Again, I think mucking with fields is something that is 
done rather less than mucking with parameters. 

So, maybe it doesn't matter. People will learn to use -P and use that most of 
the time and may never use -F at all and it will be fine. Maybe.


-- 
Real magic is the hand around the bandsaw, the thrown spark in the
powder keg, the dimension-warp linking you straight into the heart of a
star, the flaming sword that burns all the way to the pommel.




Re: Advanced master.cf query/update support

2013-11-28 Thread Viktor Dukhovni
On Thu, Nov 28, 2013 at 09:09:32AM -0700, LuKreme wrote:

> Also, the Fields are all single words, and almost all the parameters
> have multiple_words_with_underscores, so there might be something
> there.
> 
> myhostname mydomain myorigin mydestination and mynetworks seem
> to be the only parameter labels without an _ on my system, for
> example. They all conveniently start with "my".

Counter-examples exist:

$ postconf -d | awk '{print $1}' | egrep -v _ | egrep -v '^my'
biff
relayhost
stress

users are free to create their own parameters.  You may, for example,
have seen some of my posts that introduce ${indexed}...

At Morgan Stanley I implemented a separate postmast(1) utility,
that could be used to show all, or just non-default, master.cf
entries, and to insert or delete master.cf entries.  It did not
support granular access to the components of an entry.

In postmast(1) there was no ambiguity between "." in a service name
and "." between the service name and the service type, because
these were specified separately "postmast [-s ] [-t ]
...".  While integrating a super-set of postmast(1) functionality into
postconf(1) Wietse has switched from "." to "/", but this may not
solve the problem because some service names have "/" in them
(paths of sockets outside /var/spool/postfix/{private,public}).

To safely eliminate the ambiguity we can either use white-space to
separate the name and type:

# Single type
$ postconf -F "smtp inet"

# Any type
$ postconf -F smtp

or make the type mandatory with the empty string or "any" as a
wildcard:

# Single type
$ postconf -F smtp.inet

# Any type
$ postconf -F smtp.
OR
$ postconf -F smtp.any

I think "." is less visually intrusive than "/", and since "/" does
not eliminate the ambiguity, I would revert the separator to "."
with the next snapshot, with "any" for a wildcard:

# inet type
$ postconf -F smtp.inet

# any type
$ postconf -F smtp.any

With "." required, the ambiguity goes away.

-- 
Viktor.


Pls help with Makefile config in MULTI_INSTANCE, NULL_CLIENT setup

2013-11-28 Thread arty
I'm following along the docs 

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

configuring the 1st piece of multi-instance setup, the NULL CLIENT

I installed postfix

postconf -d | grep ^mail_version
mail_version = 2.10.2

and did this

cat /usr/local/etc/postfix/main.cf
mail_owner = postfix
setgid_group = maildrop
myhostname = mail-new.artemis.lan
mydomain = artemis.lan
myorigin = $mydomain
master_service_disable = inet
mydestination =
local_transport = error:5.1.1 local delivery is disabled
alias_database =
alias_maps =
local_recipient_maps =
relayhost = [mail.artemis.lan]
default_database_type = cdb
indexed = ${default_database_type}:${config_directory}/
inet_interfaces = loopback-only
smtp_generic_maps = ${indexed}generic
virtual_alias_maps = ${indexed}virtual

cat /usr/local/etc/postfix/generic
roothostmaster+root=mta1

cat /usr/local/etc/postfix/virtual
roothostmaster
postmaster  root

cat /usr/local/etc/postfix/Makefile
MTAADMIN=hostmaster

all: virtual.cdb generic.cdb

generic: Makefile
@echo Creating $@
@rm -f $@.tmp
@printf '%s\t%s+root=%s\n' root $MTAADMIN `uname
-n` > $@.tmp
@mv $@.tmp generic

%.cdb: %
postmap cdb:$<

Then I

cd /usr/local/etc/postfix
make
systemctl restart postfix.service

I notice here that 'generic' has been changed by the Make to

cat virtual
roothostmaster
postmaster  root

cat generic
rootTAADMIN+root=mail-new   <=
???

and when I test

sendmail -i -f root -t <

Re: Pls help with Makefile config in MULTI_INSTANCE, NULL_CLIENT setup

2013-11-28 Thread Viktor Dukhovni
On Thu, Nov 28, 2013 at 10:09:29AM -0800, a...@operamail.com wrote:

>   cat /usr/local/etc/postfix/Makefile
>   MTAADMIN=hostmaster
> 
>   all: virtual.cdb generic.cdb
> 
>   generic: Makefile
>   @echo Creating $@
>   @rm -f $@.tmp
>   @printf '%s\t%s+root=%s\n' root $MTAADMIN `uname -n` > 
> $@.tmp
>   @mv $@.tmp generic
> 
>   %.cdb: %
>   postmap cdb:$<

Thanks for the bug report.  That $MTAADMIN in the Makefile needs to
be either $(MTAADMIN) or ${MTAADMIN} (the make(1) program does not
care, a matter of taste).

-- 
Viktor.


Re: how to make postfix alter the "From" header on outbound messages

2013-11-28 Thread list
> Yes. But, are you sure the problem is the mail header and not the
> MAIL FROM command?

No, I'm not sure.  However, considering some servers will also reject
mail where the From: header domain is inconsistent with envelope
hostnames, I suppose it doesn't matter.  Either way, I need postfix to
somehow get the external IP address, and use it (certainly on the EHLO
and MAIL FROM domain, and perhaps sometimes do a substitute the From:
domain)