OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
virtual and proxymap

From: Aaron P. Martinez (aaronphilngood.com)
Date: Sun Jun 01 2003 - 16:21:14 CDT


I have been working on setting up virtual hosting using postfix 2.0.10 and
mysql. In the past, when i just used the local delivery agent and then used
/etc/postfix/alias and also a
virtual_alias_maps=proxy:mysql:/etc/postfix/virtual_aliases.cf all was well.
I found (and please correct me if i'm mistaken) that if you're running
postfix chrooted that in order to be able to connect to the mysql database
via unix sockets you had to put in the proxy portion or you had to specify
127.0.0.1 as the hosts in your .cf files.

When i do the virtual stuff, i.e. virtual-maps, i get the following errors
in the maillog

Jun 1 14:57:26 monitor postfix/qmgr[26291]: A13A158B12:
from=<rootmonitor.philngood.com>, size=444, nrcpt=1 (queue active)
Jun 1 14:57:26 monitor postfix/virtual[26298]: fatal:
mysql:/etc/postfix/mysql-virtual-maps.cf: proxy map must not be used with
this map type
Jun 1 14:57:27 monitor postfix/master[26287]: warning: process
/usr/libexec/postfix/virtual pid 26298 exit status 1
Jun 1 14:57:27 monitor postfix/master[26287]: warning:
/usr/libexec/postfix/virtual: bad command startup -- throttling
Jun 1 14:57:40 monitor postfix/postfix-script: stopping the Postfix mail
system

Maybe this is the desired behavior, if so i guess i'm just wondering why,
since it seems that the proxy functionality is so handy.

On a side note, i keep reading contradicting info about the local transport
stuff..i'm sure i'm about to be flamed, but maybe someone can clarify for
me.
I read in some places that all mail for the domain of the box MUST use the
local delivery agent, can't i just set "mydestination= " to fix that?
Secondly, i read that doing aliasing and such wouldn't work using virtual
transport..is this right? so i can't do my canonical stuff the same way?
if not, is there a way to do it? lastly, i have 2 postfix boxes, one that
does all of my spam and virus checking, i'm just going to have it forward to
the internal box, if for instance , i have someone sending mail to
aaron.martinezdomain.tld how would i will my spam box send it on to the
final box in the canonical form, or will it revert it back to
apmartinezdomain.tld. i guess a better question is how do i make sure it
keeps it in the canonical form, which leads back to my previous question of
how do i handle canonicals at the final box if indeed they don't work the
same w/virtual mappings.

here is my postconf -n and a copy of the mysql-virtual-maps.cf files.

(this was just tossed togethter to get the virtual stuff working..the final
one will be much better, so don't slam me on that aspect too much ralf)
postconf -n
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases $virtual_alias_maps
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
local_recipient_maps = $alias_maps $virtual_alias_maps $virtual_mailbox_maps
unix:passwd.byname
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /etc/postfix/README_FILES
relocated_maps = proxy:mysql:/etc/postfix/mysql-relocated.cf
sample_directory = /etc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
transport_maps = proxy:mysql:/etc/postfix/mysql-transport.cf
unknown_local_recipient_reject_code = 450
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-aliases.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual-gid.cf
virtual_mailbox_base = /var/spool/postfix/virtuals
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual-uid.cf

 mysql-virtual-maps.cf
user = postfix
password = postfix
dbname = marlo
table = users
select_field = maildir
where_field = email
additional_conditions = and postfix = 'y'
hosts = 127.0.0.1

Thanks in advance,

Aaron P. Martinez