[imp] Re: virtual domains with vpopmail & courier

jlewis@lewis.org jlewis@lewis.org
Thu, 25 Jul 2002 21:45:11 -0400 (EDT)


I played around with this some more this evening, and I think I got it 
working the way I wanted.  It was actually just a couple of simple issues.

I'm using basically the servers.php example entry below, and a very
slightly changed imp_get_vinfo that returns ($imp['user'] . '@' .
$vdomain).  Users will go to wwwmail.theirdomain and log in as user.

I modified compose.php such that the Received line reads 'as user ' .
$imp['user']; instead of 'as user ' . $imp['user'] . '@' .  
$imp['server']; since $imp['user'] will be of the format user@domain.

The only other issue was an apache config issue.  'UseCanonicalName On' is 
what was causing server generated URL's (like from redirect.php) to use 
the ServerName rather than what was received in the host header.  Turning 
this off allows the server to "be" any name pointed at it and means all 
that needs to be done to support additional domains is creation of a DNS 
record pointing at the IMP server.

The only other thing I think I'll do is have this copy of horde/imp use 
it's own db...not because it needs to, but because I think it'll be much 
cleaner keeping it separate from the non-virtual domain users.

On Tue, 23 Jul 2002 jlewis@lewis.org wrote:

> I've been searching the archives and this appears to be a FAQ but I didn't 
> find any answers I was happy with.
> 
> I'm looking for a way to setup IMP 3.1 to deal with large numbers of 
> virtual domains.  Currently, we're using sqwebmail, and everyone goes to 
> the same URL and logs in as user@theirdomain.com.  
> 
> I don't care at this point whether people go to webmail.theirdomain.com
> and log in as user, or go to hostingmail.ourdomain.com and log in as
> user@theirdomain.com...but I don't want to have to add an entry to
> servers.php for each domain and I don't want to have to setup a new
> virtual host in the apache config for each domain.  IMP is running on a
> separate dedicated system.  The mail server that handles virtual domains
> is qmail/vpopmail/courier-imap, and users must log in as
> user@theirdomain.com to get their mail via pop3 or imap.
> 
> I found one post suggesting the following
> 
> //This extracts the domain name like webmail.example.com to example.com
> $this_domain=substr(getenv('HTTP_HOST'),strpos(getenv('HTTP_HOST'),'.')+1);
> //append mail host to domain, most server with mail like mail.example.com
> $this_mail_server='mail.'.$this_domain;
> $this_mail_protocol='imap';
> $this_mail_port=143;
> $this_mail_folder='';
> $this_mail_namespace='';
> $this_mail_smtphost='localhost';
> $this_mail_realm='webmail.'.$this_domain;
> 
> $servers[$this_domain] = array(
>         'name' => $this_domain,
>         'server' => $this_mail_server,
>         'protocol' => $this_mail_protocol,
>         'port' => $this_mail_port,
>         'folders' => $this_mail_folder,
>         'namespace' => $this_mail_namespace,
>         'maildomain' => $this_domain,
>         'smtphost' => $this_mail_smtphost,
>         'realm' => $this_mail_realm,
>         )
> 
> I played around with this last night, and it seems to mostly work.  I
> setup a virtual host on the IMP system with a ServerAlias wwwmail.* hoping
> to be able to go to http://wwwmail.somedomain.com/, but redirect.php
> redirects me to ServerName, which isn't going to be the URL I put in the
> browser.  So this method looks as if it may require setting up a
> virtualhost for each domain (yuck).  Also, I had to log in as 
> user@somedomain.com, and the only obvious problem I noticed was sent mail 
> said (in the headers added by IMP) the message was from 
> user@somedomain.com@wemail.ourdomain.com.
> 
> There were other messages about using imapuser to setup the servers entry, 
> but they mentioned that the method stopped working some time ago.
>  
> Is there a prefered/recommended way to set IMP up to do this with minimal 
> hacking at the code?
> 
> Once this is setup, I plan to use ipchains on the IMP server to limit 
> which imap servers the system can talk to.  
> 
> ----------------------------------------------------------------------
>  Jon Lewis *jlewis@lewis.org*|  I route
>  System Administrator        |  therefore you are
>  Atlantic Net                |  
> _________ http://www.lewis.org/~jlewis/pgp for PGP public key_________
> 
> 

----------------------------------------------------------------------
 Jon Lewis *jlewis@lewis.org*|  I route
 System Administrator        |  therefore you are
 Atlantic Net                |  
_________ http://www.lewis.org/~jlewis/pgp for PGP public key_________