Author Topic: Problem with IMAP on local mail service  (Read 12930 times)

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Problem with IMAP on local mail service
« on: October 24, 2016, 05:25:50 AM »
Hello guys,

Till now i have been using my roundcube without any issue from my mail ISP server IMAP and SMTP, but now i am trying to connect it locally (IMAP and SMTP at localhost) to my mail service (who is providing mail for my domain) through Server app (OSX) to be sync with my other mail clients (such as Mail apps).

But when i do it (with localhost or empty at config.inc.php and defaultd.inc.php) at port 143 i am always getting this error, that seems that there is a problem with IMAP connection:

[24-Oct-2016 09:16:13 +0100]: <am1rremq> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--dvgc:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

[21-Oct-2016 17:37:55 +0100]: <hfhgjoi8> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--localhost-499dua:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

Mail service at Server App:

http://prntscr.com/cy7cqi

Right now i am able to send mails from my Mail App's from my private network who are connected with my local mail service, but still unable to receive mails. I made a test in my Mail app to see if there was a problem with local mail service IMAP and seems to be working:

http://prntscr.com/cy7hdd

I made a list of my localhost ports and it seems that IMAP is working fine:

imap-logi 17415      _dovenull    7u  IPv4 0xedc67564bb7ab39      0t0  TCP *:143 (LISTEN)
imap-logi 17415      _dovenull    9u  IPv4 0xedc67564bb7b321      0t0  TCP *:993 (LISTEN)

It seems that in both cases i may have the same problem in both cases (roundcube and Mail apps), and that there is a problem between my ISP mail server and my mail service, but i cannot figure how can i solve it.

Do i need a ISP DNS MX record to my local mail service to receive mails? i dont have a static IP or a reverse DNS yet to use and test this.

Any clue?
« Last Edit: October 24, 2016, 06:14:06 AM by SipriusPT »

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Problem with IMAP on local mail service
« Reply #1 on: October 24, 2016, 09:20:38 AM »
[21-Oct-2016 17:37:55 +0100]: <hfhgjoi8> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--localhost-499dua:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

This looks like you entered invalid value to config file. Roundcube thinks it's UTF-8 and converted it to punycode. Use normal ASCII quotes in config for default_host.

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Re: Problem with IMAP on local mail service
« Reply #2 on: October 24, 2016, 09:37:41 AM »
[21-Oct-2016 17:37:55 +0100]: <hfhgjoi8> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--localhost-499dua:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

This looks like you entered invalid value to config file. Roundcube thinks it's UTF-8 and converted it to punycode. Use normal ASCII quotes in config for default_host.

Thanks for the help alec.

But i am only changing values in config.inc.php from localhost to a empty space(in defaults.inc.php i have $config['default_host'] = ‘’;). =/

And with $config['default_host'] = ‘’; i have this error:

Quote
[24-Oct-2016 14:32:20 +0100]: <f3j5lbvs> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--dvgc:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

With $config['default_host'] = ‘localhost’; i have this error:

Quote
[24-Oct-2016 14:32:32 +0100]: <f3j5lbvs> IMAP Error: Login failed for X from 192.168.1.1. Could not connect to xn--localhost-499dua:143: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Problem with IMAP on local mail service
« Reply #3 on: October 24, 2016, 11:00:11 AM »
You use strange quote characters. Don't. Use ASCII single or double-quotes.

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Re: Problem with IMAP on local mail service
« Reply #4 on: October 24, 2016, 11:44:05 AM »
You use strange quote characters. Don't. Use ASCII single or double-quotes.

WOW i didnt notice that  :o, it was from the default text program on OSX, and it seems that was causing problems!!! I didnt notice it because both types of quotes are very equal! Those strange quotes just change when i pasted here! And yes, those quotes had a different value in ASQII and was messing with roundcube! Thanks!!!

Nothing better then pure nano from command line!

Now i dont have problems with leaving it empty '' and i am getting a different error to 'localhost':

[24-Oct-2016 16:34:50 +0100]: <57i9hjni> IMAP Error: Login failed for X from 192.168.1.1. The krb5 extension is required for GSSAPI authentication in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)

Now i know what is going on! Thanks again alec!  ;D

UPDATE1:

Do you know where can i find this plug in? After a while searching in the official repo i didnt found anything =/
« Last Edit: October 24, 2016, 12:25:01 PM by SipriusPT »

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Problem with IMAP on local mail service
« Reply #5 on: October 24, 2016, 12:58:48 PM »
You sure you need it? If not, configure your imap server or Roundcube to use different authentication method (imap_auth_type).

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Re: Problem with IMAP on local mail service
« Reply #6 on: October 24, 2016, 01:08:44 PM »
You sure you need it? If not, configure your imap server or Roundcube to use different authentication method (imap_auth_type).

I am setting up a mail service and to add more security i am using kerberos. This is a network of a small part of an enterprise, where is being doing development in hardware.

I believe that i just need to add an authentication for it, in config.inc.php.

I found this php's:

https://github.com/roundcube/roundcubemail/blob/master/plugins/krb_authentication/config.inc.php.dist

Dont know well what to add in this fields:

$config['krb_authentication_host'] = ''; //suppose that will work with localhost

$config['krb_authentication_context'] = 'imap/kolab.example.org@EXAMPLE.ORG'; // here i dont know to set it to several users =/
« Last Edit: October 25, 2016, 05:56:26 AM by SipriusPT »

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Re: Problem with IMAP on local mail service
« Reply #7 on: October 25, 2016, 04:48:26 AM »
Or if you advise another type of secure authentication feel free to say. I found a tutorial on how to set this one in OSX. I cannot found how to set other types of user auths in OS X =/.

Just to test, i disable kerberos auth (at my mail service) and set a user and a password for it (without kerberos pwd), and it seems that i have a IMAP problem between my mail service and my ISP mail server, as i already has with other mail clients such as Mail app.

UPDATE1:

After reading the installation file i notice that it makes references to linux, but since i am in OS X, i made a search to see if i could find it, but dont know for sure where should i place a folder to krb5:

/usr/bin/php
/usr/include/php
/usr/lib/php
/usr/share/php

UPDATE2:

So i had that plugin already incorporated in my roundcube folder by default, at /plugins, there i had krb_authentication, where i made a config of file config.inc.php.dist, and rename it to config.inc.php. Inside of that file i have:

Quote
<?php

// Kerberos/GSSAPI Authentication Plugin options
// ---------------------------------------------

// Default mail host to log-in using user/password from HTTP Authentication.
// This is useful if the users are free to choose arbitrary mail hosts (or
// from a list), but have one host they usually want to log into.
// Unlike $config['default_host'] this must be a string!
$config['krb_authentication_host'] = 'localhost';

// GSS API security context
$config['krb_authentication_context'] = 'imap/kolab.example.org@EXAMPLE.ORG'; //i continue to dont know what for is this line and what mail i should place, since it will be for several users to use

Then i had to go the config folder of roundcube and had to add it in array file, like this:

Quote
// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)
$config['plugins'] = array('krb_authentication');

Anyone here knows what for is that line GSS API security context? And what should i add it?

UPDATE3:

I had to do klist to list my tickets in command line from kerberos:

Quote
remote:~ root# klist
Credentials cache: API:D53639BC-B013-40F7-A142-9134EE66B92F
        Principal: teste@REMOTE.GFE-TEC.PT

  Issued                Expires        Principal
Oct 24 17:41:20 2016  >>>Expired<<<  krbtgt/REMOTE.X.PT@REMOTE.X.PT
Oct 24 17:43:28 2016  >>>Expired<<<  imap/remote.x.pt@REMOTE.X.PT

But still i am unable to login, i continue to have the same error message:

Quote
[25-Oct-2016 15:58:44 +0100]: <uifofiho> IMAP Error: Login failed for teste2@x.pt from x. The krb5 extension is required for GSSAPI authentication in /Library/Server/Web/Data/Sites/Default/program/lib/Roundcube/rcube_imap.php on line 193 (POST /?_task=login&_action=login)
« Last Edit: October 25, 2016, 11:14:11 AM by SipriusPT »

Offline SipriusPT

  • Jr. Member
  • **
  • Posts: 36
Re: Problem with IMAP on local mail service
« Reply #8 on: October 26, 2016, 10:30:13 AM »
Since this is with php extensions i will continue this in stackoverflow, if anyone had this problem has well , just pass through:

http://stackoverflow.com/questions/40259363/krb5-extension-2-duplicate-symbols-clang-error-linker-command-failed-with-ex