Discussion:
[RCU] Multiple domains
Kanwar Ranbir Sandhu
2008-05-02 02:41:55 UTC
Permalink
Hi All,

I want to use one roundcube install for multiple domains, and allow
users to only enter their names (i.e. before the '@'). Right now I'm
testing with two domains I use for the family.

I tried setting the following parameters, but so far I keep getting a
"login failed" error because the domain is never added to the name (I'm
testing internally):

$rcmail_config['username_domain'] = array(
'webmail.thesandhufamily.ca' => 'thesandhufamily.ca',
'webmail.m3freak.com' => 'm3freak.com'
);

$rcmail_config['mail_domain'] = array(
'webmail.thesandhufamily.ca' => 'thesandhufamily.ca',
'webmail.m3freak.com' => 'm3freak.com'
);

I next tried to use host specific config files. I enabled
'include_host_config', and created a file name
'thesandhufamily.inc.php'. In that, I set the following:

<?php
$rcmail_config['username_domain'] = 'thesandhufamily.ca';
$rcmail_config['mail_domain'] = 'thesandhufamily.ca';
?>

But, I have the same problem: I can't login because the domain name
never gets added to the user name, so the IMAP server denies the login.

I'm probably again doing something wrong.

Note: I'm finding the documentation to be somewhat lacking. More
concrete examples would be of great help. But, this list has proven
very helpful so far. :)

Regards,

Ranbir
--
Kanwar Ranbir Sandhu
Linux 2.6.22.14-72.fc6 i686 GNU/Linux
22:18:50 up 5 days, 16:17, 2 users, load average: 0.19, 0.24, 0.20


_______________________________________________
List info: http://lists.roundcube.net/users/
Kyle Wheeler
2008-05-02 04:32:12 UTC
Permalink
Post by Kanwar Ranbir Sandhu
I want to use one roundcube install for multiple domains, and allow
I'm testing with two domains I use for the family.
I do that; it's pretty easy, once you figure it out, but it's not
really an obvious trick.
Post by Kanwar Ranbir Sandhu
I next tried to use host specific config files. I enabled
'include_host_config', and created a file name
I've never played with that... I prefer things I can read all at once.

Here's what I do:

$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}

Hope that helps!

~Kyle
--
Testing can show the presence of errors, but not their absence.
-- E. W. Dijkstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 204 bytes
Desc: not available
URL: <http://lists.roundcube.net/pipermail/users/attachments/20080501/c835f5f7/attachment.sig>
-------------- next part --------------
_______________________________________________
List info: http://lists.roundcube.net/users/
Kanwar Ranbir Sandhu
2008-05-02 05:54:44 UTC
Permalink
Post by Kyle Wheeler
I do that; it's pretty easy, once you figure it out, but it's not
really an obvious trick.
Why is it a trick, though? There appears to be two documented methods
to do multiple domains with one install - either one should be enough
Post by Kyle Wheeler
I've never played with that... I prefer things I can read all at once.
$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}
Holy shit. Firstly, where do I put that? Secondly, why the hell is any
of that necessary when roundcube is supposed to have easily
configurable, built in support for multiple domains?! I'm absolutely
dumb founded.

Thanks for the reply. I appreciate it.

Regards,

Ranbir
--
Kanwar Ranbir Sandhu
Linux 2.6.22.14-72.fc6 i686 GNU/Linux
01:50:06 up 5 days, 19:49, 3 users, load average: 0.40, 0.17, 0.12


_______________________________________________
List info: http://lists.roundcube.net/users/
Kyle Wheeler
2008-05-02 16:44:22 UTC
Permalink
Post by Kanwar Ranbir Sandhu
Post by Kyle Wheeler
I've never played with that... I prefer things I can read all at once.
$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}
Firstly, where do I put that?
I put it in the config/main.inc.php file.
Post by Kanwar Ranbir Sandhu
Secondly, why the hell is any of that necessary when roundcube is
supposed to have easily configurable, built in support for multiple
domains?! I'm absolutely dumb founded.
Well, I started doing it that way when I first started using
roundcube, which was a while ago. If they've improved things since, I
haven't noticed.

But some of the comments in the config file are misleading. For
example, the comment preceeding username_domain in there says:

Automatically add this domain to user names for login
Only for IMAP servers that require full email-addresses for login
Specify an array with 'host' => 'domain' values to support
multiple hosts

What they don't tell you is that "host" is not matched against
$_SERVER['HTTP_HOST'], but is instead matched against the *IMAP SERVER
NAME*. As you can see in program/include/rcmail.php, the matching is
done against a variable named $host - the test is:

isset($config['username_domain'][$host])

And what is $host? It gets defined just above there, from
$config['default_host'], which is the IMAP server.

You may be asking yourself "why in hell would they do that?!?"; the
answer is because of a different feature. You can configure RoundCube
to serve as a frontend for multiple IMAP servers, with a popup box on
the login window allowing you to select them. So you could, for
example, set up the same RoundCube to be a frontend for both your
personal email and your work email, and all you have to do is select
which one you're logging in to. Then all the necessary configuration
options automatically change to match the server that you've chosen to
log into.

Okay, so, it's still a pretty pointless feature for what most people
want to use RoundCube *for*, but that's what they're doing. So in most
places in the documentation, where they say "host", they're using an
unusual definition of the term. Rather than "the domain on which this
webmail is being hosted" what they really mean is "the imap server to
which this webmail is connecting". So, for people who just have
several virtual domains on the same server, this feature is *entirely
useless* because $host is always going to be 'localhost'.

Once you realize that the developers have a unique perspective here,
things start to make more sense.

I hadn't seen the "include_host_config" option before. From looking at
the source, while this does indeed match based on
$_SERVER['HTTP_HOST'] and looks like it would do the right thing...
it's only used in a function (load_host_config) that is NEVER ACTUALLY
CALLED, so those files will never be read. Which is probably the
primary reason why include_host_config isn't documented or included in
the main.inc.php file.

~Kyle

P.S. For what it's worth, I just created a bug for this
(http://trac.roundcube.net/ticket/1485040)
--
One of the penalties for refusing to participate in politics is that
you end up being governed by your inferiors.
-- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 204 bytes
Desc: not available
URL: <http://lists.roundcube.net/pipermail/users/attachments/20080502/8240e548/attachment.sig>
-------------- next part --------------
_______________________________________________
List info: http://lists.roundcube.net/users/
gnul
2008-05-02 17:06:49 UTC
Permalink
Roundcube is supposed to have easily
configurable, built in support for multiple domains?! I'm absolutely
dumb founded.
Dude, I am a new RoundCube user, but I must say that most popular
webmail apps support multiple domains, provided the user specifies
their email address (username at domain). RoundCube, like IlohaMail and
SquirrelMail, supports this out-of-the-box.

To support multiple domains without the user specifying the actual
domain usually requires some code modification (like grabbing some
environment variables as shown in this thread).

I run one install of RoundCube under a single SSL host for all
domains. Thus, I chose to not have any "default" domain(s) and to
force my multi-domain users to specify their email address (I don't
have an SSL cert for every domain so: http://mail.theirdomain.tld
redirects to https://mydomain/mail).

To eliminate confusion on the login page, I changed the 'string
bundle' so that "Email Address" was displayed on the login page
instead of "Username".

In File: program/localization/en_US/labels.inc :: (and any other
langs you support)
$labels['username'] = 'Email Address';

This doesn't solve your problem, but the default install worked well for me.

-gnul
_______________________________________________
List info: http://lists.roundcube.net/users/
Richard D. Moore
2008-05-03 04:31:09 UTC
Permalink
I got around this by just simply having roundcube in one folder for
webmail.museumtour.com, and then having another roundcube folder for my
other webmail accounts, that for example, webmail.example.com would go to
its own webmail that only has the configuration for example.com and
webmail.museumtour.com only has the configuration for museumtour.com. This
is by far a more simpler way to host multiple domains using the same
webmail. Comon how long does it really take to install roundcube, it tooke
me all of about 30 minutes to get everything working.
--
Richard D. Moore
System Administrator
Informal Education Products / Museum tour
Web: http://www.museumtour.com
Email: richardm at museumtour.com


_______________________________________________
List info: http://lists.roundcube.net/users/
Richard D. Moore
2008-05-03 04:31:09 UTC
Permalink
I got around this by just simply having roundcube in one folder for
webmail.museumtour.com, and then having another roundcube folder for my
other webmail accounts, that for example, webmail.example.com would go to
its own webmail that only has the configuration for example.com and
webmail.museumtour.com only has the configuration for museumtour.com. This
is by far a more simpler way to host multiple domains using the same
webmail. Comon how long does it really take to install roundcube, it tooke
me all of about 30 minutes to get everything working.
--
Richard D. Moore
System Administrator
Informal Education Products / Museum tour
Web: http://www.museumtour.com
Email: richardm at museumtour.com


_______________________________________________
List info: http://lists.roundcube.net/users/
Kyle Wheeler
2008-05-02 16:44:22 UTC
Permalink
Post by Kanwar Ranbir Sandhu
Post by Kyle Wheeler
I've never played with that... I prefer things I can read all at once.
$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}
Firstly, where do I put that?
I put it in the config/main.inc.php file.
Post by Kanwar Ranbir Sandhu
Secondly, why the hell is any of that necessary when roundcube is
supposed to have easily configurable, built in support for multiple
domains?! I'm absolutely dumb founded.
Well, I started doing it that way when I first started using
roundcube, which was a while ago. If they've improved things since, I
haven't noticed.

But some of the comments in the config file are misleading. For
example, the comment preceeding username_domain in there says:

Automatically add this domain to user names for login
Only for IMAP servers that require full email-addresses for login
Specify an array with 'host' => 'domain' values to support
multiple hosts

What they don't tell you is that "host" is not matched against
$_SERVER['HTTP_HOST'], but is instead matched against the *IMAP SERVER
NAME*. As you can see in program/include/rcmail.php, the matching is
done against a variable named $host - the test is:

isset($config['username_domain'][$host])

And what is $host? It gets defined just above there, from
$config['default_host'], which is the IMAP server.

You may be asking yourself "why in hell would they do that?!?"; the
answer is because of a different feature. You can configure RoundCube
to serve as a frontend for multiple IMAP servers, with a popup box on
the login window allowing you to select them. So you could, for
example, set up the same RoundCube to be a frontend for both your
personal email and your work email, and all you have to do is select
which one you're logging in to. Then all the necessary configuration
options automatically change to match the server that you've chosen to
log into.

Okay, so, it's still a pretty pointless feature for what most people
want to use RoundCube *for*, but that's what they're doing. So in most
places in the documentation, where they say "host", they're using an
unusual definition of the term. Rather than "the domain on which this
webmail is being hosted" what they really mean is "the imap server to
which this webmail is connecting". So, for people who just have
several virtual domains on the same server, this feature is *entirely
useless* because $host is always going to be 'localhost'.

Once you realize that the developers have a unique perspective here,
things start to make more sense.

I hadn't seen the "include_host_config" option before. From looking at
the source, while this does indeed match based on
$_SERVER['HTTP_HOST'] and looks like it would do the right thing...
it's only used in a function (load_host_config) that is NEVER ACTUALLY
CALLED, so those files will never be read. Which is probably the
primary reason why include_host_config isn't documented or included in
the main.inc.php file.

~Kyle

P.S. For what it's worth, I just created a bug for this
(http://trac.roundcube.net/ticket/1485040)
--
One of the penalties for refusing to participate in politics is that
you end up being governed by your inferiors.
-- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 204 bytes
Desc: not available
URL: <http://lists.roundcube.net/pipermail/users/attachments/20080502/8240e548/attachment-0001.sig>
-------------- next part --------------
_______________________________________________
List info: http://lists.roundcube.net/users/
gnul
2008-05-02 17:06:49 UTC
Permalink
Roundcube is supposed to have easily
configurable, built in support for multiple domains?! I'm absolutely
dumb founded.
Dude, I am a new RoundCube user, but I must say that most popular
webmail apps support multiple domains, provided the user specifies
their email address (username at domain). RoundCube, like IlohaMail and
SquirrelMail, supports this out-of-the-box.

To support multiple domains without the user specifying the actual
domain usually requires some code modification (like grabbing some
environment variables as shown in this thread).

I run one install of RoundCube under a single SSL host for all
domains. Thus, I chose to not have any "default" domain(s) and to
force my multi-domain users to specify their email address (I don't
have an SSL cert for every domain so: http://mail.theirdomain.tld
redirects to https://mydomain/mail).

To eliminate confusion on the login page, I changed the 'string
bundle' so that "Email Address" was displayed on the login page
instead of "Username".

In File: program/localization/en_US/labels.inc :: (and any other
langs you support)
$labels['username'] = 'Email Address';

This doesn't solve your problem, but the default install worked well for me.

-gnul
_______________________________________________
List info: http://lists.roundcube.net/users/
Kanwar Ranbir Sandhu
2008-05-02 05:54:44 UTC
Permalink
Post by Kyle Wheeler
I do that; it's pretty easy, once you figure it out, but it's not
really an obvious trick.
Why is it a trick, though? There appears to be two documented methods
to do multiple domains with one install - either one should be enough
Post by Kyle Wheeler
I've never played with that... I prefer things I can read all at once.
$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}
Holy shit. Firstly, where do I put that? Secondly, why the hell is any
of that necessary when roundcube is supposed to have easily
configurable, built in support for multiple domains?! I'm absolutely
dumb founded.

Thanks for the reply. I appreciate it.

Regards,

Ranbir
--
Kanwar Ranbir Sandhu
Linux 2.6.22.14-72.fc6 i686 GNU/Linux
01:50:06 up 5 days, 19:49, 3 users, load average: 0.40, 0.17, 0.12


_______________________________________________
List info: http://lists.roundcube.net/users/
Kanwar Ranbir Sandhu
2008-05-02 02:41:55 UTC
Permalink
Hi All,

I want to use one roundcube install for multiple domains, and allow
users to only enter their names (i.e. before the '@'). Right now I'm
testing with two domains I use for the family.

I tried setting the following parameters, but so far I keep getting a
"login failed" error because the domain is never added to the name (I'm
testing internally):

$rcmail_config['username_domain'] = array(
'webmail.thesandhufamily.ca' => 'thesandhufamily.ca',
'webmail.m3freak.com' => 'm3freak.com'
);

$rcmail_config['mail_domain'] = array(
'webmail.thesandhufamily.ca' => 'thesandhufamily.ca',
'webmail.m3freak.com' => 'm3freak.com'
);

I next tried to use host specific config files. I enabled
'include_host_config', and created a file name
'thesandhufamily.inc.php'. In that, I set the following:

<?php
$rcmail_config['username_domain'] = 'thesandhufamily.ca';
$rcmail_config['mail_domain'] = 'thesandhufamily.ca';
?>

But, I have the same problem: I can't login because the domain name
never gets added to the user name, so the IMAP server denies the login.

I'm probably again doing something wrong.

Note: I'm finding the documentation to be somewhat lacking. More
concrete examples would be of great help. But, this list has proven
very helpful so far. :)

Regards,

Ranbir
--
Kanwar Ranbir Sandhu
Linux 2.6.22.14-72.fc6 i686 GNU/Linux
22:18:50 up 5 days, 16:17, 2 users, load average: 0.19, 0.24, 0.20


_______________________________________________
List info: http://lists.roundcube.net/users/
Kyle Wheeler
2008-05-02 04:32:12 UTC
Permalink
Post by Kanwar Ranbir Sandhu
I want to use one roundcube install for multiple domains, and allow
I'm testing with two domains I use for the family.
I do that; it's pretty easy, once you figure it out, but it's not
really an obvious trick.
Post by Kanwar Ranbir Sandhu
I next tried to use host specific config files. I enabled
'include_host_config', and created a file name
I've never played with that... I prefer things I can read all at once.

Here's what I do:

$vdomainmapping = array(
'domain1.com' => 'domain1.com',
'www.domain1.com' => 'domain1.com',
'domain2.com' => 'domain2.com',
'www.domain2.com' => 'domain2.com',
);
if (isset($vdomainmapping[$_SERVER['HTTP_HOST']])) {
$rcmail_config['username_domain'] = $vdomainmapping[$_SERVER['HTTP_HOST']];
} else {
$rcmail_config['username_domain'] = '';
}

Hope that helps!

~Kyle
--
Testing can show the presence of errors, but not their absence.
-- E. W. Dijkstra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 204 bytes
Desc: not available
URL: <http://lists.roundcube.net/pipermail/users/attachments/20080501/c835f5f7/attachment-0001.sig>
-------------- next part --------------
_______________________________________________
List info: http://lists.roundcube.net/users/
Loading...