Author Topic: RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL  (Read 21677 times)

Offline SoulManager

  • Newbie
  • *
  • Posts: 4
RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« on: March 28, 2008, 02:16:47 AM »
Hi!

I managed to get my first installation of the RC 0.1 Stable successfully for one Virtual Domain with Virtual Users using PostfixAdmin database schema. Sadly, as soon as I decided to add another domain, everything stopped working. My users use their full email address as their username.

My setup is:
Ubuntu 7.10
Postfix 2.4.5
Dovecot 1.0
RoundCube 0.1 Stable
MySQL 5.0
PostfixAdmin 2.2

Right after I added a second domain with PostfixAdmin the first problem was that I wasn't able to send emails anymore. All I get is "Failed to send message" when I hit the "Send the message now" button. In the /logs/errors I get the following entry:

Quote
SMTP Error: SMTP error: Authentication failure: SMTP server does not support authentication (Code: ) in /var/www/roundcubemail/program/steps/mail/func.inc on line 1416

This is odd because when I was running this setup with only one domain I was able to send without problems through RoundCube.

Then I updated the SQL query on the mail.inc.php file for SQL Virtual users to the following:

Quote
$rcmail_config['virtuser_query'] = "SELECT username FROM mail.mailbox WHERE username = '%u'";

Even though the query is fine because I get the right username, the identity is not created as soon as the user logs into RoundCube for the first time. Normally, when the user logs into RoundCube for the first time the identities and users tables get populated with the right data. In my case, only the users table gets populated while the identities remains empty.

My RoundCube DB user has select access to the PostfixAdmin database and table that contains the email addresses/usernames, even though the identity is not created in the RoundCube database. It doesn't matter if I manually type the sender address, I am not able to get the email sent. Even if I manually create the identity, I am not allowed to send emails.

I want to run one single RoundCube installation for multiple domains, with the users accessing their own Webmail interface by pointing their browsers to http://webmail.domain1.com or http://webmail.domain2.com and the users log in with the usernames user@domain1.com or user@domain2.com whatever the case may be. I had this setup with Horde/IMP and I never had such problems, I don't see a reason I should be having them with RoundCube. All the domains that I run on this setup use the same SMTP/IMAP server and as far as they are virtual users in a database I can't understand why SMTP Authentication is failing if the usernames are fine, the Authentication Type is set to '' (Auto) and I can send (with SMTP Auth) normally from a mail client like thunderbird.

Has anyone here managed to get such a setup up and running without this problems? I'll greatly appreciate your help on this matter.

Best regards,

Gustavo

Offline SoulManager

  • Newbie
  • *
  • Posts: 4
Re: RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« Reply #1 on: March 30, 2008, 01:20:26 PM »
Well, I must say that I am pretty disappointed with this forum and with RoundCube in general because even though it has a killer look and a theoretical working set of functionalities, it has very bad documentation and support from the developers and from the community itself.

I posted this about 4 days ago and so far nobody, not even the developers or more experienced users have responded with a single word or reference.

Well, I really wanted to switch from my actual webmail solution (Horde/IMP) to RoundCube but it has proven to be useless in a multiple domains with a single RC installation scenario, it works fine with one domain, when is the only one, but as soon as I add another one RC started to give authentication errors when I tried to send mail.

Also, there's a weird and worrying bug that has affected my installation twice, and is the appearance of a "console" layer on top of the elements in the upper left corner in the browser window. I am attaching to this post a screen capture of this weird behaviour. It comes up after I leave roundcube open on my browser for a while. I left in the morning to work and when I came back there was the new "element" in the roundcube login screen. This is not only weird but unexplainable for me.

I tried my setup, multiple mail domains in a SQL database using postfix admin schema with dovecot and postfix in SquirrelMail and it worked without any problems, it also worked fine with Horde/IMP. It just doesn't work with RoundCube so something must be wrong here. I can't understand why SMTP Auth starts failing as soon as you add multiple domains, the usernames are the full email addresses and are stored in a SQL database, the authentication must be fairly simple but somehow RC has made it a nightmare for me and nobody seems to give a technical answer to this problem and just a cheap workaround on using the PHP mail() function that doesn't work if you are trying to sign mail with DomainKeys or DKIM.

Another suggestion for the developers is the modularity of this project. I think that it should be developed in a way that allow the users to easily add modules to the basic setup, this way it would be fairly simple to add extra functionality (whatever the backend may be) to the RC webmail client just like Password Change, Forwards, Vacation, Robust Addressbook, etc, etc, etc... This is the way that Horde is developed and also SquirrelMail has a set of Plug-Ins easy to setup. I know that this is just a 0.1 release, but planning and structuring of the project in a manageable way should be done in this early stages because otherwise changing everything when the project is in a more advance stage can be a real nightmare that may or may not force to a total reengineering of the RC project.

Thanks for a good webmail solution for single domain, I'll use it for clients with this scenario, sadly, for my own use I'll have to go with another solution for webmail.

Regards,

Gustavo

Offline syloo77

  • Newbie
  • *
  • Posts: 1
Re: RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« Reply #2 on: March 31, 2008, 08:02:11 PM »
Hi guys,

I have sensibly the same config as you and recently experienced the same issue.But now I found a solution !!
I host multiple domaine like you
Everything worked fine but I couldnt sent an email.I Had the exact same error message.
Here are the options that I have to modify ti fix it :

$rcmail_config['smtp_server'] = '11.22.33.44'; (Put your Public IP here and not localhost)

if you use ssl :
$rcmail_config['smtp_server'] = 'ssl://11.22.33.44:465';

For easy multiple domain login I also changed this value :

$rcmail_config['username_domain'] = substr($_SERVER['HTTP_HOST'],5);

I explain :
Ive got 3 domain :

domain1.com
domain2.com
domain3.com

and 3 subdomain relatives to mail :
mail.domain1.com
mail.domain2.com
mail.domain3.com

the line below just extract the main domain name of each FQDN mail domain ( whithout that users would be recognized as toto@mail.domain1.com and not toto@domain1.com as i want)
Now my users just have to enter there tiny login
I hope this can help you.

Excuse me dor my poor english language





Offline BlueC

  • Jr. Member
  • **
  • Posts: 25
Re: RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« Reply #3 on: April 01, 2008, 01:31:51 PM »
To SoulManager

I don't know what your problem is here. I have RoundCube+PostfixAdmin+Courier+VirtualUsers+MySQL and it all works perfectly.

As PostfixAdmin uses the real email address as the login value for accounts, and RoundCube authenticates directly against the IMAP (and SMTP) server, you don't need to do anything clever with the roundcube configuration.

You certainly don't need this:

Code: [Select]
$rcmail_config['virtuser_query'] = "SELECT username FROM mail.mailbox WHERE username = '%u'";
The SMTP parts of your config should look like this if you're wanting to authenticate against the local SMTP server using the same username and password that was used to login to roundcube:

Code: [Select]
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'localhost';

// SMTP port (default is 25; 465 for SSL)
$rcmail_config['smtp_port'] = 25;

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$rcmail_config['smtp_auth_type'] = '';

If you post your full config/main.inc.php file then I'll take a look at how it differs from my working file.

And quit moaning at the developers. If you love horde/IMP so much then use them.

Offline eekamouse

  • Newbie
  • *
  • Posts: 4
Re: RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« Reply #4 on: April 01, 2008, 01:33:40 PM »
Quote from: SoulManager

Even though the query is fine because I get the right username, the identity is not created as soon as the user logs into RoundCube for the first time. Normally, when the user logs into RoundCube for the first time the identities and users tables get populated with the right data. In my case, only the users table gets populated while the identities remains empty.

My RoundCube DB user has select access to the PostfixAdmin database and table that contains the email addresses/usernames, even though the identity is not created in the RoundCube database. It doesn't matter if I manually type the sender address, I am not able to get the email sent. Even if I manually create the identity, I am not allowed to send emails.


Hi,

I've exactly the same problem, identities database is not populated any more at first login, so my new users cannot send any emails right now and the "from" field is blank. I thought it was something to change in the config file like "create default folders" which was made by default in previous versions but for that i can't see any option. I was happy to know that roundcube became a "stable" version and it made me not careful enough

Offline MAO

  • Newbie
  • *
  • Posts: 5
RoundCube+PostfixAdmin+Dovecot+VirtualUsers+MySQL
« Reply #5 on: May 28, 2008, 12:47:32 AM »
Quote from: BlueC;11285
To SoulManager

I don't know what your problem is here. I have RoundCube+PostfixAdmin+Courier+VirtualUsers+MySQL and it all works perfectly.

As PostfixAdmin uses the real email address as the login value for accounts, and RoundCube authenticates directly against the IMAP (and SMTP) server, you don't need to do anything clever with the roundcube configuration.

You certainly don't need this:

Code: [Select]
$rcmail_config['virtuser_query'] = "SELECT username FROM mail.mailbox WHERE username = '%u'";

The SMTP parts of your config should look like this if you're wanting to authenticate against the local SMTP server using the same username and password that was used to login to roundcube:

Code: [Select]
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
$rcmail_config['smtp_server'] = 'localhost';

// SMTP port (default is 25; 465 for SSL)
$rcmail_config['smtp_port'] = 25;

// SMTP username (if required) if you use %u as the username RoundCube
// will use the current username for login
$rcmail_config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password RoundCube
// will use the current user's password for login
$rcmail_config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$rcmail_config['smtp_auth_type'] = '';


If you post your full config/main.inc.php file then I'll take a look at how it differs from my working file.

And quit moaning at the developers. If you love horde/IMP so much then use them.


What tutorial I must use? can you give some links !!!
(http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04
http://flurdy.com/docs/postfix/index.html)

Offline wheaties82

  • Jr. Member
  • **
  • Posts: 11
Multiple domain with Roundcube IMAP problem
« Reply #6 on: December 10, 2008, 11:25:30 PM »
First off I am a noob to this so go gentle on me . . . I am experiencing a strange issue with Roundcube 0.2-beta.

I have an email server that has two virtual domains and Postfix is configured to accept mail for either domainA or domainB. so johndoe@domainA can also be johndoe@domainB -- same email (aka johndoe can log into domainA or domainB and see the same Maildir files) just different mail servers are used for sending / receiving.

Both domainA and domainB are listed in my_destinations in postfix (i.e. they are canonical domains, not hosted)

I have installed RC for domainA already with its own independent database and user. It is functioning properly.

In a separate folder with a new installation (independent directory from domainA) I have another installation referencing a (new) seperate database and user. The installation summary ends without an issue -- everything says it is ok, I can even send a test email. The strange issue is when I attempt to do a test login (or normal login) I get a timeout error. Below are examples:

[08-Dec-2008 23:02:50] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /var/www/domainB/webmail/program/lib/imap.inc on line 317
[08-Dec-2008 23:08:23] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /var/www/domainB/webmail/program/lib/imap.inc on line 208

I have verified that domainB is working with IMAP as I can login to the account via thunderbird and send and receive without any problems. I have verified that all my MX and DNS records are correct -- as I can send and receive email no problem

I have tried sharing the same database as domainA but I get the same results -- a timeout and error referrencing imap.inc

This thread addresses an issue with sending messages -- which I don't have a problem doing -- rather my problem lays with logging into the IMAP server.

Am I incorrect in assuming that Roundcube is capable of having two independent installations referencing different domains on the same server?