Forums | Mahara Community

Support /
IMAP Authentication Failed


anonymous profile picture
Account deleted
Posts: 23

12 February 2009, 7:41

Hi,

I have another problem. I want my Mahara 1.1.0 beta 3 get user authentication from IMAP server. I configured one institution with plugin installed in IMAP. I also have configured the address, port of my IMAP server.

The problem is i can not get authenticate from IMAP. When i tried to login, always get error message  "You have not provided the correct credentials to log in. Please check your username and password are correct.". I can make sure that the username in Mahara is equal with username in IMAP server. I also can make sure that my server connected with my IMAP server. I have tried to use all of IMAP types (with SSL or without SSL) and get the same result.

Please help me to solve this problem. Thanks.

anonymous profile picture
Account deleted
Posts: 1643

12 February 2009, 17:22

Hi - your first port of call for problems with Mahara should be the error log - it might contain a very useful error message that can help you debug the problem.

From what I remember, the IMAP plugin was written to help test the robustness of the authentication api, and as such hasn't been touched for a long time. I know I've never used it myself. So there might be a bug somewhere inside it, but I hope not! Hopefully you can find something useful in the error log.

anonymous profile picture
Account deleted
Posts: 23

12 February 2009, 23:50

Here is error log from my apache server:

[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x] [WAR] ae (auth/imap/lib.php:91) imap_open() [function.imap-open]: Couldn't open stream {xxx.xx.xxx.x:143/imap}, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x] Call stack (most recent first):, referer: xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * log_message("imap_open() [function.imap-open]: Couldn't open st...", 8, true, true, "/var/www/xxxxxx/xxxxxxxxxx/auth/imap/lib.php", 91) at /var/www/xxxxxx/xxxxxxxxxx/lib/errors.php:378, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * error(2, "imap_open() [<a href='function.imap-open'>function...", "/var/www/xxxxxx/xxxxxxxxxx/auth/imap/lib.php", 91, array(size 3)) at Unknown:0, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * imap_open("{xxx.xx.xxx.x/imap}", "xxxxxx", "xxxxxxx", 64) at /var/www/xxxxxx/xxxxxxxxxx/auth/imap/lib.php:91, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * AuthImap->authenticate_user_account(object(stdClass), "xxxxxxx") at /var/www/xxxxxx/xxxxxxxxxx/auth/user.php:772, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * LiveUser->login("xxxxxx", "xxxxxxx") at /var/www/xxxxxx/xxxxxxxxxx/auth/lib.php:1169, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * login_submit(object(Pieform), array(size 6)) at Unknown:0, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/
[Fri Feb 13 17:01:49 2009] [error] [client xxx.xx.xxx.x]   * call_user_func_array("login_submit", array(size 2)) at /var/www/xxxxxx/xxxxxxxxxx/lib/pieforms/pieform.php:430, referer: http://xxxxxxx.xxxxx.xx.xx/xxxxxxxxxx/

 

It seems about connection problem to IMAP server. But when i try to test the connection to IMAP server via telnet, I can do it successfully. Here is the result from telnet process:

 cpanel:~# telnet xxxxx.xxxxx.xx.xx 143
Trying xxx.xx.xxx.x...
Connected to xxxxx.xxxxx.xx.xx.
Escape character is '^]'.
* OK Dovecot ready.

What's the problem? Or it is maybe Mahara bugs?

anonymous profile picture
Account deleted
Posts: 1643

13 February 2009, 0:36

Dunno - seems weird that you can't do it via PHP. The error message from PHP is disappointingly vague, but at least it seems to show that the code is getting as far as trying to connect.

I think your next point of call is to start playing around with the code in the IMAP plugin. Use the PHP.net page for imap_open, and see if changing the connection string helps you out. You can also use the Mahara function log_debug() to send lines to the error log, so you can dump the value of variables while attempting to log in.

anonymous profile picture
Account deleted
Posts: 338

13 February 2009, 5:47

Hello,

 I just wanted to add that, when I set up the Mahara site for the college I worked for, I also had problems with the IMAP and LDAP authentication pluggis. I posted that in the old Mahara site as you may remember.

In my case, the problem was that the pluggin couldn't find the users and always displayed a message of "Invalid password, etc". I tried the following order for the registration pluggins,  as Nigel suggested:

1) LDAP

2) IMAP

3)Self-registration

but Mahara always got stuck in step 2). 

 

Because the college decided to roam from Moodle to Mahara, I stopped looking  into the code of the pluggins. The roaming worked well so far, appart from the fact that the public keys do not change automatically every 28 days, so I have extended  the time to 365 days.

Now I use self-registration for those users who need to log in Mahara but don't  need to use Moodle

 Maybe it would be interested to know if somebody has managed to registered users by using the LDAP and IMAP authentication pluggins.

 

Regards

anonymous profile picture
Account deleted
Posts: 23

15 February 2009, 7:54

Try to use IMAP without TLS.

Add this line at auth/imap/lib.php:

public static function get_instance_config_options($institution, $instance = 0) {
// TODO: put these strings in a lang file
$options['/imap'] = 'IMAP';
$options['/imap/ssl'] = 'IMAP/SSL';
$options['/imap/ssl/novalidate-cert'] = 'IMAP/SSL (self-signed certificate)';
$options['/imap/tls'] = 'IMAP/TLS';
$options['/imap/notls'] = 'IMAP/NO TLS'; <---- Add this line

In Institution admin area, choose IMAP parameter : IMAP/NO TLS

It works for me. Hope this works for you too.
anonymous profile picture
Account deleted
Posts: 1643

15 February 2009, 16:38

Nice one Smile

I have opened a bug report for this.

anonymous profile picture
Account deleted
Posts: 338

16 February 2009, 7:18

Thank you very much for the information. I image that it would be something similar for the ldap authentication.
anonymous profile picture
Account deleted
Posts: 1

08 February 2010, 12:47

Hi there,

unluckily this trick didn't work for me. Moodle on the same server manages to authenticate via IMAPs - Mahara does not.

Have you got any suggestions? I'm using Mahara 1.2 on Debian Lenny.

Thank you in advance.

9 results