mailuser login malformed

Discussion in 'Tips/Tricks/Mods' started by CaptainBalou, Oct 1, 2007.

  1. CaptainBalou

    CaptainBalou Member

    Hello folks,

    I try to login to my Interface but it won't work even the "login mailuser" is activated. My user data is as follows:

    Mailalias: [email protected]
    real user name: domain.com_user

    The best would be that the users can login with their email alias names. But I've read in other threads that this is not possible. Am I right?

    So I try to login with username "domain.com_user" and the following message appears in mail.log:

    Oct  1 10:37:17 server dovecot: pop3-login: Disconnected: user=<_domain.com_user>, method=PLAIN, rip=, lip=, secured
    I think this isn't correct because of the leading "_" in the user name. Does somebody know if this is the reason for that? And what should I do to fix it?

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    In the mailuser login, users can login with their email alias.
  3. CaptainBalou

    CaptainBalou Member

    Hey Till, you're really fast in answering threads. :)

    They can login with their alias? Wow. So I misunderstood that in the other thread. But they should also be able to login with their real user name don't they?
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    No, the current implementation does a lookup for the email address, so a login is only possible with the email address of a user.
  5. CaptainBalou

    CaptainBalou Member

    Oh, so I complete mixed it up. Ok, now I'm on the right way.

    But nevertheless: No login is possible with the email alias. The login dialog shows a message "Fehler: Username unbekannt" (like "Error: username unknown" for all non-Germans :) ) if I try to login with the email address. The mail.log says nothing. I'm confursed.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmm, thats starnge. The mailuser login is enabled for this site?

    For this login, ISPConfig tries to authenticate with pop3 on localhost, so you should at least see a failed pop3 login in your mail log.
  7. CaptainBalou

    CaptainBalou Member

    I feel tha same: strange things happens. ;-)

    If I disable "mailuser login" the message "mailuser login disabled" appears instead the other message. So I'm sure to have it correctly enabled.

    I've read in the manual that it is done via pop3, so I enabled it in dovecot. Before I got the message "cannot connect to host 'localhost'". So I'm also sure to enabled it. :)

    But there is no message in the mail.log file. Do I have to setup some special thins for pop3 in dovecot.conf?
  8. CaptainBalou

    CaptainBalou Member

    Hmm, Till, I'm still wondering if I understood you correct. I looked up /home/admispconfig/ispconfig/web/mailuser/login/index.php because I thinks it does the mailuser login page.

    In this script just the given username out of the input filed is used to compare it against the isp_isp_user table. I cannot see that anyone does a virtual user table lookup.

    Am I completely wrong?
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Sorry, you are right. I thought we had implemented a email to username lookup there too.
  10. CaptainBalou

    CaptainBalou Member


    But can you imagine why my username "domain.com_username" results in a mail.log entry of "_domain.com_username"? Who inserts the underscore? Is dovecot the troublemaker? Still confused... :(
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you use dovecot with a configuration to allow pop3 / imap logins with the email address?
  12. CaptainBalou

    CaptainBalou Member

  13. till

    till Super Moderator Staff Member ISPConfig Developer

    The mailuser login has never been tested with this hack, so I guess that the mailuser login has to be rewritten. The mysql database table that is used to lookup the username in the database does not contain a username in the form of [email protected].
  14. CaptainBalou

    CaptainBalou Member

    Ah, ok. That "quick and dirty"-hack was the only one I've seen to establish a working "[email protected]" authentication. Is there a "official" way? Perhaps then the mailuser-login would work too as you mentioned.
  15. CaptainBalou

    CaptainBalou Member

    As you mentioned I tried to hack the login php code.

    I just modified it for testing purposes. I deactivated the check of the username in the ispconfig database. It's now possible to login via the email address without any problem. So you were correct with your idea - it's the dovecot-hack. ;)

    I think I would have to change many things to get all details of the mailuser-menu working. So still my question: Is there a standard way to do the things I did with the hack? :)

    I got to bed now - it's late in the night. ;-) See you tomorrow.
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    No, usernames with a @ inside are not officially supported by ISPConfig 2.x. They will be supported with ISPConfig 3.
  17. CaptainBalou

    CaptainBalou Member

    Ok. But what do others do with their users? Do they let them login with their real username, like "domain.com_username" in Roundcube? I nearly can't belive that. Hmm. Ok, so I try to get it working for me - hacking some scripts and wait for release 3. ;-)

  18. CaptainBalou

    CaptainBalou Member

    Hi Till,

    I've found the problem. It's the conversion of the login name of dovecot (dovecot.conf parameter 'auth_username_format ="%Ld_%Ln"'). I'm converting "[email protected]" to "domain.com_username", so the users are able to login with their email addresses. The problem while logging in with the real username is that there is no "@" in the string. Dovecot tries to convert the string the same way like the email address. "strip anything behind the '@' as domain and everything before the '@' as the username; switch the order and add a underscore in between". But there is no '@' so the username results in "_domain.com_username" which is not a valid username.

    I hacked the login/index.php a bit and it seems that everything works fine for me now.

    changed line 38:
    $username     = $_POST["username"];
    $pop3username     = $_POST["username"];
    added line 41 and 42:
    list ($loginusername, $logindomain) = split('[/@-]', $pop3username);
    $username = "${logindomain}_$loginusername";
    changed line 65:
    $res = $app->pop3->Login($username,$passwort,0);
    $res = $app->pop3->Login($pop3username,$passwort,0);
    So the user get's authenticated against ISPconfig with "domain.com_username" and against dovecot with "[email protected]". Everything looks fine now. I hope some others can use this hack too if the want to use this "email address alias login in dovecot" with

  19. till

    till Super Moderator Staff Member ISPConfig Developer

    Thanks for finding a solution for this problem. I moved the thread to the tipps & Tricks forum.


    I added your patch to the bugtracker.
    Last edited: Oct 3, 2007
  20. till

    till Super Moderator Staff Member ISPConfig Developer

    I've added a patch for usernames with @ in the 2.2.18 release.

Share This Page