cypht icon indicating copy to clipboard operation
cypht copied to clipboard

Can't view/edit/enable sieve filters

Open knightsg opened this issue 2 years ago • 36 comments

🐛 Bugreport

I enabled sieve in my imap server and also in Cypht with the modules[]=sievefilters config line. I've regenerated my config with config_gen.php but if I log into Cypht and go to the filters page, it's blank as shown below:

cypht_filters_page

I've checked the imap servers settings page and there is no option to enable sieve filters:

cypht_imap_page

In the cypht log there is the following when I access the imap server settings page:

mailserver-cypht-1 | NOTICE: PHP message: Array mailserver-cypht-1 | ( mailserver-cypht-1 | [0] => Using Hm_PHP_Session with Hm_Auth_IMAP mailserver-cypht-1 | [1] => Using file based user configuration mailserver-cypht-1 | [2] => Using sapi: fpm-fcgi mailserver-cypht-1 | [3] => Request type: HTTP mailserver-cypht-1 | [4] => Request path: / mailserver-cypht-1 | [5] => TLS request: 1 mailserver-cypht-1 | [6] => Mobile request: 0 mailserver-cypht-1 | [7] => Page ID: servers mailserver-cypht-1 | [8] => CACHE backend using: noop mailserver-cypht-1 | [9] => LOGGED IN mailserver-cypht-1 | [10] => Handler module Hm_Handler_sieve_filters_enabled activated but not found mailserver-cypht-1 | [11] => TRANSLATION NOT FOUND :Gandi: mailserver-cypht-1 | [12] => TRANSLATION NOT FOUND :Kolab Now: mailserver-cypht-1 | [13] => TRANSLATION NOT FOUND :Office365: mailserver-cypht-1 | [14] => TRANSLATION NOT FOUND :JMAP Servers: mailserver-cypht-1 | [15] => TRANSLATION NOT FOUND :Add a JMAP Server: mailserver-cypht-1 | [16] => TRANSLATION NOT FOUND :Server URL: mailserver-cypht-1 | [17] => TRANSLATION NOT FOUND :Server URL: mailserver-cypht-1 | [18] => PHP version 8.2.2 mailserver-cypht-1 | [19] => Zend version 4.2.2 mailserver-cypht-1 | [20] => Peak Memory: 8192 mailserver-cypht-1 | [21] => PID: 31 mailserver-cypht-1 | [22] => Included files: 71 mailserver-cypht-1 | )

My imap server (docker-mailserver with Dovecot) has managesieve enabled and port 4190 exposed to the container running Cypht.

Here is the modules section of my hm3.ini file:

; ----------------------------------------------------------------------------- ; Modules ; ----------------------------------------------------------------------------- modules[]=core ; Contacts ; ------- ; Contact support. This module requires that at least one "backend" contacts ; module be enabled (ldap_contacts, gmail_contacts, or local_contacts). You ; can enable all the backends you want to support. modules[]=contacts modules[]=local_contacts modules[]=imap modules[]=sievefilters ; 2 factor authentication ; ----------------------- ; This module enables 2 factor authentication using TOTP (compatible with ; Google Authenticator). You must edit the ini file in modules/2fa/ to ; configure a shared secret, then move that file to your app_data_dir. modules[]=2fa modules[]=smtp modules[]=account modules[]=idle_timer ;modules[]=calendar modules[]=themes modules[]=nux ; Simple list of messages read since login ;modules[]=history ; Save and re-run searches easily ;modules[]=saved_searches ; Enable the advanced search form modules[]=advanced_search modules[]=highlights modules[]=profiles modules[]=inline_message modules[]=imap_folders modules[]=keyboard_shortcuts

Version & Environment

Rev: 07605067 OS: Docker v23.0.0 running on Ubuntu 22.04.1 host, Cypht container running docker image php:8.2.2-fpm-alpine3.17

Steps to reproduce

  1. Configure modules[]=sievefilters and in hm3 and run scripts/config_gen.php.
  2. Log into Cypht.
  3. Go to filters page, it will be blank.
  4. Also check Servers > Imap Servers page, there is no option to enable sieve filters as shown in screenshot here: https://github.com/jasonmunro/cypht/pull/569.

knightsg avatar Feb 15 '23 02:02 knightsg

Related for when none of the servers offer Sieve (I am not saying this is your case) https://github.com/jasonmunro/cypht/pull/673

marclaporte avatar Feb 17 '23 12:02 marclaporte

If you supply me a test account (send me info in private), I can assign a junior dev to investigate. You can find me in here: https://app.gitter.im/#/room/#cypht-org_community:gitter.im

marclaporte avatar Feb 19 '23 06:02 marclaporte

If you supply me a test account (send me info in private), I can assign a junior dev to investigate. You can find me in here: https://app.gitter.im/#/room/#cypht-org_community:gitter.im

I was unaware of this error but I resolved it with this pull request https://github.com/jasonmunro/cypht/pull/675

josaphatim avatar Feb 22 '23 09:02 josaphatim

Thank you for the fix. I can see the "Enable Sieve Filters" option in the Add New IMAP Server settings block. However, I added my IMAP connection via the hm3.ini file, with the imap_auth_name / imap_auth_server / imap_auth_port / imap_auth_tls options, and there is no option to edit that connection to enable the filters. It would be nice to have the ability to configure the enable sieve filters feature through the hm3.ini file as well.

knightsg avatar Feb 22 '23 16:02 knightsg

However, I added my IMAP connection via the hm3.ini file

Thanks. This is the PR that fixes that: https://github.com/jasonmunro/cypht/pull/677

josaphatim avatar Feb 23 '23 09:02 josaphatim

@knightsg Please confirm all is good with latest code. Thanks!

marclaporte avatar Feb 23 '23 13:02 marclaporte

@josaphatim @marclaporte Thank you, the update for the ini file is working. I left a note about the config option naming being wrong in the hm3.sample.ini file in the PR but after changing it in my hm3.ini the sieve config is listed in my imap server config.

However...unfortunately, I now get a totally blank page when I open the filter settings page. There is no PHP error log thrown in my FPM container console, just a generic backend server 500 error: 24/Feb/2023:02:43:20 +0000 "GET /index.php" 500.

I can connect to the sieve port from my Cypht container:

/usr/local/share/cypht # telnet mailserver 4190 Connected to mailserver "IMPLEMENTATION" "Dovecot (Debian) Pigeonhole" "SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapflags notify vnd.dovecot.pipe vnd.dovecot.filter" "NOTIFY" "mailto" "SASL" "PLAIN LOGIN" "VERSION" "1.0" OK "Dovecot (Debian) ready."

knightsg avatar Feb 24 '23 02:02 knightsg

@knightsg FYI: https://github.com/jasonmunro/cypht/issues/679

marclaporte avatar Feb 24 '23 05:02 marclaporte

@josaphatim @marclaporte Thank you, the update for the ini file is working. I left a note about the config option naming being wrong in the hm3.sample.ini file in the PR but after changing it in my hm3.ini the sieve config is listed in my imap server config.

However...unfortunately, I now get a totally blank page when I open the filter settings page. There is no PHP error log thrown in my FPM container console, just a generic backend server 500 error: 24/Feb/2023:02:43:20 +0000 "GET /index.php" 500.

I can connect to the sieve port from my Cypht container:

/usr/local/share/cypht # telnet mailserver 4190 Connected to mailserver "IMPLEMENTATION" "Dovecot (Debian) Pigeonhole" "SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapflags notify vnd.dovecot.pipe vnd.dovecot.filter" "NOTIFY" "mailto" "SASL" "PLAIN LOGIN" "VERSION" "1.0" OK "Dovecot (Debian) ready."

This is the fix for the issue https://github.com/jasonmunro/cypht/pull/691

josaphatim avatar Mar 20 '23 09:03 josaphatim

@josaphatim I've updated to the latest master code and unfortunately I'm still getting the blank filters page. The screenshots below show the servers page with the IMAP server added (from hm3.ini) with the sieve server setting configured and the second shot shows the blank filters page:

https://imgur.com/iU6CBKA https://imgur.com/N9NEiOW

There's still no useful log output, just the same generic "GET /index.php" 500 error.

knightsg avatar Mar 22 '23 15:03 knightsg

ok, please join us here: https://app.gitter.im/#/room/#cypht-org_community:gitter.im

We need a dev with server access to debug.

marclaporte avatar Mar 22 '23 22:03 marclaporte

@marclaporte @josaphatim Apologies, I finally worked out the issue here. I realised php logging wasn't properly enabled in my container (only fpm) which is why I couldn't see the actual server error. I've fixed that and discovered that the issue was that I needed to install PHP sockets module. I did that and it's working now.

Thanks again for your help 👍

knightsg avatar Mar 23 '23 05:03 knightsg

Sorry guys, I have one more issue with this that may or may not be something that can be resolved from within Cypht. As I mentioned in my previous comment, I was able to get this working finally by fixing the issue on my end. However, the stack I was using to test was my local dev environment. When I tried to test the sieve filters on my production setup I found that I still get the blank filters page.

After some investigation I found that it's because I have dovecot configured to use SSL on my production setup. If that's enabled, then when Cypht tries to connect to the managesieve port on the mail server it fails because it uses plain authentication by default. If I disable SSL for my production stack then it works fine.

Do you have any suggestions for how I can resolve this?

Thanks!

knightsg avatar Apr 01 '23 17:04 knightsg

Interesting. We'll look into it. Is SSL vs non SSL a different port? (like mail servers do for IMAP)

marclaporte avatar Apr 02 '23 11:04 marclaporte

No, it's the same port as far as I'm aware. I tested a basic connection to the port using telnet and this is the output for both SSL disabled and SSL enabled:

SSL Disabled:

"IMPLEMENTATION" "Dovecot (Debian) Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapflags notify vnd.dovecot.pipe vnd.dovecot.filter"
"NOTIFY" "mailto"
"SASL" "PLAIN LOGIN"
"VERSION" "1.0"

SSL Enabled:

"IMPLEMENTATION" "Dovecot (Debian) Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext imapflags notify vnd.dovecot.pipe vnd.dovecot.filter"
"NOTIFY" "mailto"
"SASL" ""
"STARTTLS"
"VERSION" "1.0"

knightsg avatar Apr 04 '23 01:04 knightsg

ok, let's see what @josaphatim discovers

marclaporte avatar Apr 04 '23 02:04 marclaporte

@knightsg We need @josaphatim to have server access to debug. https://github.com/jasonmunro/cypht/pull/701

marclaporte avatar Apr 24 '23 07:04 marclaporte

@knightsg ping :-)

marclaporte avatar Jun 15 '23 18:06 marclaporte

Sorry, I've been pretty busy lately and forgot to follow up. I'll try and take another look in the next couple of days and see if I still need this open.

Jun 15, 2023, 11:31 by @.***:

@knightsg https://github.com/knightsg> ping :-)

— Reply to this email directly, > view it on GitHub https://github.com/jasonmunro/cypht/issues/671#issuecomment-1593544933> , or > unsubscribe https://github.com/notifications/unsubscribe-auth/AAFUUWC47SGFOJYHBTT7LI3XLNIIVANCNFSM6AAAAAAU4I7OYA> . You are receiving this because you were mentioned.> Message ID: > <jasonmunro/cypht/issues/671/1593544933> @> github> .> com>

knightsg avatar Jun 15 '23 20:06 knightsg

We need you @knightsg :-)

marclaporte avatar Sep 11 '23 19:09 marclaporte

Ahh, sorry...I totally forgot to follow up on this (again). I have to set up my prod server again as I'm not actually using it yet (just been testing). I'll take a look at that later today and check in with you via the Element chat.

knightsg avatar Sep 12 '23 16:09 knightsg

@knightsg

marclaporte avatar Nov 04 '23 22:11 marclaporte

Hi @marclaporte - not sure if you saw but I replied in the chat.

knightsg avatar Nov 05 '23 00:11 knightsg

Sorry I don't see anything in https://app.gitter.im/#/room/#cypht-org_community:gitter.im

image

marclaporte avatar Nov 05 '23 02:11 marclaporte

For the record, @knightsg @josaphatim and I are solving this in a private chat.

marclaporte avatar Nov 06 '23 02:11 marclaporte

ok, let's see what @josaphatim discovers

@marclaporte, @knightsg for now we can pass scheme in the server address something like tls://my.server.com:4190. @kroky fixed here https://github.com/cypht-org/php-sieve-manager/commit/29a9b4396322cc3403b5d64578917ea025c5164e

josaphatim avatar Nov 13 '23 08:11 josaphatim

Hi @josaphatim, I already have that configured in my hm3.ini like below:

imap_auth_sieve_conf_host=tls://mail.mydomain.com:4190

knightsg avatar Nov 16 '23 00:11 knightsg

Related: https://github.com/cypht-org/cypht-docker/pull/27

marclaporte avatar Nov 21 '23 19:11 marclaporte

@knightsg We now use environment variables instead of hm3.ini: https://github.com/cypht-org/cypht/pull/823

Can you please review to see if the issue persists?

Thanks!

marclaporte avatar Mar 27 '24 16:03 marclaporte

Hi Marc. I took a look and replaced my existing custom docker image with the prebuilt sailfrog/cypht-docker one, but now there's no sieve option available. I took a look at the list of options on the docker image page and it doesn't list anything there related to sieve. I tried anyway to add a CYPHT_IMAP_AUTH_SIEVE_CONFIG_HOST env var with the same setting I had before but it didn't resolve the issue.

On a side note, I'm note sure how to configure the prebuilt image to use SSL but I guess that's a topic for a new issue ticket.

knightsg avatar Apr 03 '24 05:04 knightsg