Not able to authenticate users againts IMAP server

Issue #705 resolved
Manish Kumar created an issue

Hi,

When I'm trying to authenticate users using IMAP server. I get a 500 error from server and the web GUI does not show, just a blank screen with no error in console. Disabling the authentication using IMAP shows the GUI with no errors. here is my IMAP configuration $config['ENABLE_IMAP_AUTH'] = 1; $config['RESTORE_OVER_IMAP'] = 1; $config['IMAP_HOST'] = 'mailstore.iitd.ernet.in'; $config['IMAP_PORT'] = 993; $config['IMAP_SSL'] = true; $config['SMTP_DOMAIN'] = 'smtp.iitd.ernet.in'; and here is my phperror log Uncaught Zend_Mail_Protocol_Exception: cannot connect to host; error = (errno = 0 ) in /var/www/piler/Zend/Mail/Protocol/Imap.php:100 Stack trace: 0 /var/www/piler/Zend/Mail/Protocol/Imap.php(61): Zend_Mail_Protocol_Imap->connect('ssl://mailstore...', 993, true) 1 /var/www/piler/model/user/auth.php(348): Zend_Mail_Protocol_Imap->__construct('mailstore.iitd....', 993, true) 2 /var/www/piler/model/user/auth.php(49): ModelUserAuth->checkLoginAgainstIMAP('admin@local', 'pilerrocks', Array) 3 /var/www/piler/controller/login/login.php(44): ModelUserAuth->checkLogin('admin@local', 'pilerrocks') 4 /var/www/piler/system/front.php(36): ControllerLoginLogin->index() 5 /var/www/piler/system/front.php(14): Front->execute(NULL) 6 /var/www/piler/index.php(113): Front->dispatch(Object(Router), Object(Router)) 7 {main} Thanks

Comments (27)

  1. Janos SUTO repo owner

    Is it a big favour to format the debug messages? Anyway it's indeed a bug that the gui code doesn't handle the thrown exception. I'll fix it soon.

  2. Manish Kumar reporter

    so how do I find out if it is sending the request to IMAP server? Anyway can I authenticate user via cutom Oauth? sorry for late response

  3. Janos SUTO repo owner

    Run ngrep to figure out if there's a chat between the gui and the imap server. Oauth is a different auth protocol, I'm not sure what you are trying to do, and and whether dovecot supports oauth or not.

  4. Manish Kumar reporter

    yes, I ran ngrep and gui is not forwarding the authentication requests to the IMAP server. Basically I'm trying to authenticate users using IMAP and our server support IMAP for mail reading and smtp for mail transfer ( mailstore.iitd.ernet.in as IMAP server (incoming) and smtp.iitd.ernet.in as their SMTP server ) and my config settings are:

    • $config['ENABLE_IMAP_AUTH'] = 1;
    • $config['RESTORE_OVER_IMAP'] = 1;
    • $config['IMAP_HOST'] = 'mailstore.iitd.ernet.in';
    • $config['IMAP_PORT'] = 993;
    • $config['IMAP_SSL'] = true;
    • $config['SMTP_DOMAIN'] = 'smtp.iitd.ernet.in'
  5. Manish Kumar reporter

    @jsuto Sir, I haven't received any update from you. Please check this issue, eagerly waiting for your positive response

  6. Janos SUTO repo owner

    I've just tried authenticating against an imap server and I couldn't see the problem you did. Also login to the piler host and check if the following works:

    openssl s_client -connect mailstore.iitd.ernet.in:993

    And what versions do you use? (piler, php)

  7. Manish Kumar reporter

    How can I login in to piler host? Anyway I'm using PHP Version 7.0.4-7ubuntu2.1 and piler version 1.1.1

  8. Janos SUTO repo owner

    You should know how to login to your own computer, right? Anyway the piler gui has been designed to work with php5. I'll check if there are issues with php7.

  9. Manish Kumar reporter

    Sorry about that, yes openssl s_client -connect mailstore.iitd.ernet.in:993 is working, should I downgrade to php5 ?

  10. Janos SUTO repo owner

    Yes, for now a downgrade would be the workaround until I test the gui with php7. Let me know if it works for you.

  11. Manish Kumar reporter

    @jsuto No, I downgrade to PHP 5.6.24 and I'm still receiving same error as I mentioned above.

  12. Manish Kumar reporter

    @jsuto I just found the solution by coincidence, recently I was using ubuntu 16.04 and 16.04 ships with default php7 however I removed php7 and install php5 but that wasn't working out for me so I downgrade to ubuntu 14.04 and yes GUI not throwing any error, now. but I'm still not able to authenticate users using IMAP, I've tested

    openssl s_client -connect mailstore.iitd.ernet.in:993 (works)

    A1 LOGIN <username> <password> (status:logged in)

    then why it is not working on piler GUI?

  13. Janos SUTO repo owner

    I doesn't make sense to me installing ubuntu16, then downgrading to 14. You should install ubuntu 14 from scratch, and try again. Or wait until I come up with a php 7 compatible gui. A few days, I guess.

  14. Manish Kumar reporter

    I did install Ubuntu 14 from scratch and currently not having any problem with GUI but authentication. using correct username and password I'm getting incorrect username/password prompt in GUI.

  15. Janos SUTO repo owner

    I've managed to fix it. Get the master branch, and update the gui Zend directory, and you'll be fine. The story in a nutshell: from php 5.6 an exception is thrown for self signed certificates. My patch fixes that behavior.

  16. Manish Kumar reporter

    Thank you @jsuto Sir, howerever this issue is resolved but I'm still facing authentication issue, (Error: Incorrect/username password). there are no errors in php/mail/http log files. I ran ngrep to find out connection between IMAP and php. I'm attaching the response Link

    Please check this issue, Thanks

  17. Janos SUTO repo owner

    Show me the mail log entries regarding the login attempt. Also find me on skype (janos.suto) for a faster resolution.

  18. Janos SUTO repo owner

    The piler gui expects a user@domain formatted login name. The login name serves as an email address to determine what emails you are allowed to see, and without such a login name it's not much use to login, because you won't see any emails. So for this reason the imap authentication function returns with an error in that case that's why the login failed stuff.

  19. Log in to comment