pimlie / authres_status

Roundcube plugin that checks the Authentication-Results headers (rfc5451) of your emails and displays the verification status.
Other
34 stars 20 forks source link

Some mails return error upon checking #29

Closed ghost closed 5 years ago

ghost commented 6 years ago

I have a number of mail imported from a different IMAP server to my main IMAP account. A relevant number of these can't be viewed via Roundcube / Kolab - they don't get displayed at all. In /var/log/roundcube/errors I get the following errors upon trying to view one of these mails:

[22-Apr-2018 17:38:58 Europe/Berlin] PHP Fatal error: Uncaught exception 'DKIM_Exception' with message 'No message content provided' in /usr/share/roundcubemail/vendor/angrychimp/php-dkim/DKIM.php:47 Stack trace:

0 /usr/share/roundcubemail/plugins/authres_status/authres_status.php(426): DKIM->__construct(false)

1 /usr/share/roundcubemail/plugins/authres_status/authres_status.php(241): authres_status->get_authentication_status(Object(rcube_message_header), 126, 1008)

2 [internal function]: authres_status->message_headers(Array)

3 /usr/share/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php(440): call_user_func(Array, Array)

4 /usr/share/roundcubemail/program/steps/mail/func.inc(1169): rcube_plugin_api->exec_hook('message_headers...', Array)

5 [internal function]: rcmail_message_headers(Array)

6 /usr/share/roundcubemail/program/include/rcmail_output_html.php(1150): call_user_func('rcmailmessage...', Array)

7 [internal function]: rcmail_output_html->xml_command(Array)

8 /usr/share/roundcubemail/program/include/rcmail_output_html.php(1013): preg_re in /usr/share/roundcubemail/vendor/angrychimp/php-dkim/DKIM.php on line 47

I'll be happy to provide more info if needed

ghost commented 6 years ago

Some system info: Kolab 9.0 (Winterfell) on Debian 9 (stretch), Roundcube 1.3.6, Postfix 3.1.8-0+deb9u1, authres dev-master, php-dkim dev-master

pimlie commented 6 years ago

Because the error happens in DKIM, it means you have the fallback DKIM verification enabled right? And the error doesnt occur when you have disabled the fallback DKIM verifier?

Assuming so, what exactly do you mean with import? Do the emails even have a body at all or do those emails only consists of headers? Can you post a redacted example message?

ghost commented 6 years ago

Well - I can't view those emails, because of the bug. Where can I enable or disable fallback DKIM?

pimlie commented 6 years ago

You can disable the internal DKIM verifier in Settings -> Preferences -> Authentication Status

emeakyl commented 5 years ago

sorry going back to this, but I got the same issue.

what happens is that for whatever reason, $rcmail->imap->get_raw_body() sometimes returns an empty string, and in the DKIM_Verify constructor (in DKIM.php), if the raw message is empty, it throws an exception.

A way to overcome that is to modify (authres_status.php line 426-427)/get_authentication_status() with:

                        $results = array();
                        try {
                                $dkimVerify = new DKIM_Verify($body);
                                $results = $dkimVerify->validate();
                        } catch (Exception $e) {
                                /// Defaulting to no results
                                $results = array();
                        }
pimlie commented 5 years ago

Thanks for finding the cause, please check v0.5.1 which should fix this :)