Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailgate fail after upgrade to 9.5 #7619

Closed
tizianosartori opened this issue Jul 8, 2020 · 28 comments
Closed

Mailgate fail after upgrade to 9.5 #7619

tizianosartori opened this issue Jul 8, 2020 · 28 comments
Labels

Comments

@tizianosartori
Copy link

tizianosartori commented Jul 8, 2020

#0 /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Imap.php(216): Laminas\Mail\Protocol\Imap->connect('ssl://Gwr01', 993, 'ssl') #1 /var/www/glpi/inc/toolbox.class.php(2323): Laminas\Mail\Storage\Imap->__construct(Object(stdClass)) #2 /var/www/glpi/inc/mailcollector.class.php(1290): Toolbox::getMailServerStorageInstance('imap', Array) #3 /var/www/glpi/inc/mailcollector.class.php(667): MailCollector->connect() #4 /var/www/glpi/inc/mailcollector.class.php(1725): MailCollector->collect(2) #5 /var/www/glpi/inc/crontask.class.php(847): MailCollector::cronMailgate(Object(CronTask)) #6 /var/www/glpi/front/cron.php(83): CronTask::launch(2, '15') #7 {main} {"user":"@glpi"} [2020-07-08 13:26:07] glpiphplog.ERROR: MailCollector::collect() in /var/www/glpi/inc/mailcollector.class.php line 669

Mails receivers Name: 'Glpi@stetspa.it' Active: Yes Server: '{Gwr01/imap/ssl/novalidate-cert}INBOX' Login: 'glpi' Password: Yes

An error occured trying to connect to collector. cannot connect to host ; error = fsockopen(): unable to connect to ssl://Gwr01:993 (Unknown error) (errno = 0 )

@trasher
Copy link
Contributor

trasher commented Jul 8, 2020

You should check your imap server logs, and make sure connexion is ok from sever.

This looks like a network connection error rather than a GLPI issue; I close.

@trasher trasher closed this as completed Jul 8, 2020
@tizianosartori
Copy link
Author

The network is the same before the upgrade from 9.4. After upgrade mailcollector stop working.

@trasher
Copy link
Contributor

trasher commented Jul 8, 2020

OK, I cannot make any checks instead of you anyways.
Error is your GLPI server cannot connect to Gwr01. There are test to do like using the IP instead of a host name, etc; to make sure everything is OK.

Feel free to reopen the issue when you have more information on how to reproduce.

@tizianosartori
Copy link
Author

Maybe the new laminas-mail component ignore the NO-VALIDATE-CERT option?

@trasher
Copy link
Contributor

trasher commented Jul 8, 2020

No; and there is nothing in provided data that can let think about any SSL certificate. I guess it would not change anything you remove it.

@tizianosartori
Copy link
Author

Without SSL on port 143 the error is:

[2020-07-08 16:24:47] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\RuntimeException: cannot login, user or password wrong in /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Imap.php at line 218 Backtrace : inc/toolbox.class.php:2323 Laminas\Mail\Storage\Imap->__construct() inc/mailcollector.class.php:1290 Toolbox::getMailServerStorageInstance() inc/mailcollector.class.php:667 MailCollector->connect() front/mailcollector.form.php:77 MailCollector->collect()

but i'm sure that the password is good. Maybe the field get not stored correctly on database?

@tizianosartori
Copy link
Author

NO VALIDATE option was ignored

[2020-07-08 17:37:32] glpiphplog.WARNING: *** PHP Warning (2): stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /var/www/glpi/vendor/laminas/laminas-mail/src/Protocol/Imap.php at line 106

@trasher
Copy link
Contributor

trasher commented Jul 9, 2020

Sounds strange, this is used in IMAP unit tests, and as far as I remember, this was required; so that should work.
I reopen the issue, no idea what's wrong.

@trasher trasher reopened this Jul 9, 2020
@Dayflare
Copy link

Dayflare commented Jul 9, 2020

i have this error too.
[2020-07-09 11:42:39] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\RuntimeException: cannot login, user or password wrong in /var/www/html/glpi/vendor/laminas/laminas-mail/src/Storage/Imap.php at line 218

updated to 9.5.0 and mailgate doesn't work anymore. user and password are verified to be correct, i even changed the password for testing this. Before the update everything worked fine.

Mail Backend is Exchange 2013 on premise.

IMAP Log:
"TAG1 BAD Command received in Invalid state."

@cedric-anne
Copy link
Member

Hi,

Can you give us which params you are using here ?
image

Regards

@tizianosartori
Copy link
Author

I can confirm mailgate works if use a valid SSL certificate. I think the problem is the "NO VALIDATE" option.

@cedric-anne
Copy link
Member

I can confirm mailgate works if use a valid SSL certificate. I think the problem is the "NO VALIDATE" option.

Indeed, looking at the code, this is not handled in the new dependency we use to replace usage of obsolete php-imap extension.

A solution may be to override the class to do something like laminas/laminas-mail#63 .

I also figure that the 'norsh', 'secure' and 'debug' options may have no effet.

@cedric-anne cedric-anne added the bug label Jul 9, 2020
@trasher
Copy link
Contributor

trasher commented Jul 9, 2020

There were already a fix proposal on Zend-Mail; I've requested a new one (with same existing code); see:
laminas/laminas-mail#94

@tizianosartori
Copy link
Author

tizianosartori commented Jul 10, 2020

Another error on same laminas component

[2020-07-10 11:49:10] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name reply-to or reply-to not found in /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307

I don't know if is a new issue or not.

@husisusi
Copy link

The same applies here!
After Upgrade 9.4 to 9.5 Mailgate works for 20h (I made 5 E-mail tests) and after that get stuck.
Recovered to 9.4 and it works again.
Annoying!!

@epeyron
Copy link

epeyron commented Jul 13, 2020

Another error on same laminas component

[2020-07-10 11:49:10] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name reply-to or reply-to not found in /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307

I don't know if is a new issue or not.

Same error for me, GLPI 9.5.0
Help... :-)

@cedric-anne
Copy link
Member

Another error on same laminas component

[2020-07-10 11:49:10] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name reply-to or reply-to not found in /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307

I don't know if is a new issue or not.

This is another issue and it has been fixed in #7652 (see #7643 ).

@epeyron
Copy link

epeyron commented Jul 13, 2020

Another error on same laminas component
[2020-07-10 11:49:10] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name reply-to or reply-to not found in /var/www/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307
I don't know if is a new issue or not.

This is another issue and it has been fixed in #7652 (see #7643 ).

Thanks !!! 👍
i have replace inc/mailcollector.class.php with the last fix

@sector7gp
Copy link

I recently updated to 9.5 using IMAP and works fine
{mail.mydomain.com:993/imap/ssl/validate-cert}FOLDER

@nectop
Copy link

nectop commented Jul 15, 2020

I recently updated to 9.5 using IMAP and works fine
{mail.mydomain.com:993/imap/ssl/validate-cert}FOLDER

If you have not self-signed certificate it will. For example I have to use self-sighted certificate or from local Windows CA, it doesn't work. Furthermore, if you will disable certificate check it will produce an error in log, that login or password is wrong. (Mail Server Exchange 2010/2016).

@husisusi
Copy link

Interesting!

After upgrade from 9.4 to 9.5 I made www-data as owner for glpi folder recursive.
After run:
sudo -u www-data /usr/bin/php /var/www/html/glpi/front/cron.php I get:

Uncaught Exception Laminas\Cache\Exception\RuntimeException: Error opening file '/var/www/html/glpi/files/_cache/cache_trans/glpi_cache_trans_9.5.0ce6dddfb1e143d3cf64c47f81bba6781-38/glpi_cache_trans_9.5.0ce6dddfb1e143d3cf64c47f81bba6781-Laminas_I18n_Translator_Messages_31ebc1a09507bf4ac4680c9eb82c177a.dat' in /var/www/html/glpi/vendor/laminas/laminas-cache/src/Storage/Adapter/Filesystem.php at line 1581

after rerun "chown ww-data glpi/ -R" again, it works.
Which user create this cache?

@mrjd1981
Copy link

[2020-07-15 13:16:06] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to a member function getEmail() on bool in /var/www/html/inc/mailcollector.class.php at line 1407
Backtrace :
inc/mailcollector.class.php:912 MailCollector->getHeaders()
inc/mailcollector.class.php:711 MailCollector->buildTicket()
inc/mailcollector.class.php:1725 MailCollector->collect()
inc/crontask.class.php:847 MailCollector::cronMailgate()
front/crontask.form.php:49 CronTask::launch()

Any ideas?

@trasher
Copy link
Contributor

trasher commented Jul 16, 2020

Which user create this cache?

The one you use.

Frequently, users setups cron with any default user (root...) and then does not understand why webserver cannot access logs or cache.
BTW; this is not related to current issue.

@trasher
Copy link
Contributor

trasher commented Jul 16, 2020

See #7693; closing this one as it is very unclear and refers to several issues.

@trasher trasher closed this as completed Jul 16, 2020
@cedric-anne
Copy link
Member

cedric-anne commented Jul 16, 2020

[2020-07-15 13:16:06] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to a member function getEmail() on bool in /var/www/html/inc/mailcollector.class.php at line 1407
Backtrace :
inc/mailcollector.class.php:912 MailCollector->getHeaders()
inc/mailcollector.class.php:711 MailCollector->buildTicket()
inc/mailcollector.class.php:1725 MailCollector->collect()
inc/crontask.class.php:847 MailCollector::cronMailgate()
front/crontask.form.php:49 CronTask::launch()

Any ideas?

I think is has been fixed yet in #7652.

@steph461
Copy link

My news post #7790
it's the same problem

@MathysLioson
Copy link

MathysLioson commented Jan 13, 2023

I recently updated to 9.5 using IMAP and works fine
{mail.mydomain.com:993/imap/ssl/validate-cert}FOLDER

If you have not self-signed certificate it will. For example I have to use self-sighted certificate or from local Windows CA, it doesn't work. Furthermore, if you will disable certificate check it will produce an error in log, that login or password is wrong. (Mail Server Exchange 2010/2016).

I have the same issue, there is any fix for that ? I'm on Exchange 2016 and GLPI 10.0.5

@cedric-anne
Copy link
Member

@MathysLioson

Please open a new issue and give all requested information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests