Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] postfix virtual transport question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
redwood
Apprentice
Apprentice


Joined: 27 Jan 2006
Posts: 209

PostPosted: Thu May 22, 2008 5:47 pm    Post subject: [SOLVED] postfix virtual transport question Reply with quote

I have a small network 192.168.1.0/24 "mydomain.net" with a dynamic IP address.
I've registered this domain with dyndns so that I have an A-record pointing "mydomain.net" to my dynamicIP
I've also setup some Aliases (CNAMEs) for www.mydomain.net and mail.mydomain.net

I have a computer host.mydomain.net running apached, courier-imap, cyrus-sasl, postfix, mysql, amavisd-new, spamassassin, ... following the Gentoo guide virt-mail-howto.xml

http connections to my ADSL modem/router at "mydomain.net" are sent to host1.mydomain.net
Similarly smtp connections are sent to host1.mydomain.net

I configured postfix to authenticate smtp user@mydomain.net against system users
and this setup has been working fine for a couple years now.

My question is, is it possible to now configure a virtual domain(s) even though I only have one actual IP address?
Can I create a /home/vmail/{v1.mydomain.net, v2.mydomain.net}
with virtual users user1@v1.mydomain.net and user2@family.mydomain.net
so that these virtual mail accounts don't require system accounts for authentication?

E.G. my mailsql transport table would have these entries:
host1.mydomain.net smtp:mydomain.net
mydomain.net local:
v1.mydomain.net virtual:
family.mydomain.net virtual:

When I try sending mail to user@v1.mydomain.net, I get a bounced mail saying "No such user" presumably because postfix authenticated against the real system accounts at mydomain.net

With apache it's possible to use name virtual hosting with a single real IP and multiple virtual hosts, since the http requests include both the virtual name and the real IP. But I don't know if something similar is possible with postfix.
The examples on the postfix VIRTUAL page don't seem to include my situation:

# As simple as can be: shared domains, UNIX system accounts
# Postfix virtual ALIAS example: separate domains, UNIX system accounts
# Postfix virtual MAILBOX example: separate domains, non-UNIX accounts
# Non-Postfix mailbox store: separate domains, non-UNIX accounts


Thanks for any ideas/suggestions.


Last edited by redwood on Wed Sep 03, 2008 7:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Wed Sep 03, 2008 3:53 am    Post subject: Reply with quote

That is strange because in the Gentoo guide virt-mail-howto, authentication is done against the mysql database.
Quote:
So we're going to just plow through and set up mysql to hold all of our auth and virtual domain information.

Is it possible that your SASLAUTHD_OPTS="${SASLAUTH_MECH} is pam instead of rimap?
Back to top
View user's profile Send private message
Exil
Apprentice
Apprentice


Joined: 10 Oct 2005
Posts: 251
Location: Nibylandia

PostPosted: Wed Sep 03, 2008 7:15 am    Post subject: Reply with quote

this will do that

http://knopix.wordpress.com/2008/01/16/postfixadmin-postgresql-courier-squirrelmail-on-debian-etch-howtotutorial/
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Wed Sep 03, 2008 5:00 pm    Post subject: Reply with quote

I think we're going to see the output of postconf -n to see what sort of config you've got. I suspect you're missing some of the virtual statements.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
redwood
Apprentice
Apprentice


Joined: 27 Jan 2006
Posts: 209

PostPosted: Wed Sep 03, 2008 5:36 pm    Post subject: Reply with quote

notHerbert:

# cat /etc/sasl2/smtpd.conf
# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/smtp.sasl,v 1.2 2004/07/18 03:26:56 dragonheart Exp $
mech_list: PLAIN LOGIN
pwcheck_method:saslauthd

# grep -v '#' /etc/conf.d/saslauthd | grep -v ^$
SASLAUTHD_OPTS=""
SASLAUTHD_OPTS="${SASLAUTH_MECH} -a rimap -r"
SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -O localhost"

# grep authmodulelist= /etc/courier/authlib/authdaemonrc
authmodulelist="authmysql authpam"

I own "mydomain.net" and I get mail for systemusers@mydomain.net
and I have a CNAME entry for mail.mydomain.net pointing to my IP

I setup a /home/vmail/mail.mydomain.net/test/.maildir
with a mailsql user table:
EMAIL: test@mail.mydomain.net
HOME: /home/vmail
MAILDIR: /home/vmail/mail.mydomain.net/test/.maildir/
UID/GID: vmail/vmail

And I have a transport table with domain/destination:
mydomain.net local:
mail.mydomain.net virtual:

When I send a message to test@mail.mydomain.net
I get an undeliverable error message:

This is the mail system at host www.mydomain.net
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
                   The mail system
<test@mail.mydomain.net>: unknown user: "test"
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Wed Sep 03, 2008 5:50 pm    Post subject: Reply with quote

Does the user test exist in the user table of the email db? That would be the first thing to check. You might want to up the logging in postfix by adding a -v to the end of the smptd line in your /etc/postfix/master.cf file which help during troubleshooting.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
redwood
Apprentice
Apprentice


Joined: 27 Jan 2006
Posts: 209

PostPosted: Wed Sep 03, 2008 6:19 pm    Post subject: Solved Reply with quote

I found a clue in /var/log/maillog:
postfix/trivial-rewrite[18244]: warning: do not list domain mail.mydomain.net in BOTH virtual_mailbox_domains and relay_domains

So I deleted mail.mydomain.net from $relay_domains

Then I couldn't login to squirrelmail with test@mail.mydomain.net
and again found the answer in /var/log/maillog:
deeds imapd: chdir /home/vmail/mail.mydomain.net/test/.maildir/: Permission denied

So I 'chown -R vmail.vmail ~vmail' which fixed the permissions problem.

Probably need to change the order in virt-mail-howto:

Code Listing 7.2: Creating mailboxes
# mkdir -p /home/vmail/virt-domain.com/foo
# chown -R vmail:vmail /home/vmail/virt-domain.com
# maildirmake /home/vmail/virt-domain.com/foo/.maildir
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum