Bug 410643 - Akonadi IMAP Resource / KMail cannot connect to IMAP(s) servers with configured Web-Proxy
Summary: Akonadi IMAP Resource / KMail cannot connect to IMAP(s) servers with configur...
Status: RESOLVED DUPLICATE of bug 407685
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: 5.11.3
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-06 09:47 UTC by Christian Quast
Modified: 2019-08-06 11:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Quast 2019-08-06 09:47:48 UTC
SUMMARY

A detailed summary can be found below the 'Steps to Reproduce, Results' section 

STEPS TO REPRODUCE
1 configure a proxy in KDE's 'system settings'
  * 'Use manually specified proxy configuration'
  - HTTPS Proxy: proxy.company.tld     Port: 3128
  - SSL Proxy:   proxy.company.tld     Port: 3128
  - FTP Proxy:   <empty>               Port: 0
  - SOCKS Proxy: <empty>               Port: 0
  - Exceptions:  mail.company.tld,...(tested with and without exceptions)
2 configure an IMAP account
3 'auto detect' connection settings when setting up the account
4 manually specify server settings
5 check E-Mail
6 disable proxy ('No Proxy')
7 'auto detect' connection settings
8 check E-Mail

OBSERVED RESULT
* Step 2 fails with an error message the server cannot be contacted
* Step 3 fails    (proxy is enabled)
  'Unable to connect to the server, please verify the server address'
* Step 5 fails    (proxy is enabled)
* Step 7 succeeds (proxy is disabled)
* Sept 8 succeeds (proxy is disabled)

EXPECTED RESULT

* Steps 2, 3 and 5 succeed when proxy is enabled.
* Steps 7 and 8 succeed


DETAILED SUMMARY / INFORMATION
 am having trouble connecting to IMAP / SMTP servers using Akonadi/KMail when
behind an HTTP / HTTPS proxy (squid). I only need the proxy to connect to
HTTP / HTTPS servers while IMAP / SMTP related ports are open (25, 143, 587,
993). I verified this by by using `telnet` to connect to these ports. Also,
this is a desktop system at a fixed location. I am not moving this in and out 
of the network with changing (proxy) environments.

I couldn't find any related bug reports but I didn't find a comment in the 
openSUSE forum
   https://www.opensuse-forum.de/thread/42083-kmail-proxy-geht-nicht/
without any solution. Unfortunately, the thread is in German.

I've configured the proxy at both the Linux system level (HTTP[S]_PROXY=HOST)
as well as in KDE settings (tried options 'detect proxy configuration
automatically', 'use system proxy configuration', and 'use manually specified
proxy configuration', all with the same result). Web browsers work fine and 
commands on the Linux command line (curl, wget) work fine as well.

Akonadi/KMail however fails to connect to two mail servers I set-up when
starting. Instead, the two servers are listed as offline. The set-up process
already complained that the servers couldn't be reached and using KMail's
'auto-detect' feature to set-up the connection details failed with:
    'Unable to connect to the server, please verify the server address'

I have to fully disable KDE's proxy settings (option 'No Proxy') to be able to
connect to the mail server, after which both the 'auto-detect' options works as
well as fetching mails from both servers. The server are now marked as online.

However, I am no longer able to access web sites due to the disabled proxy
settings. Adding the two mail server to the 'no proxy' / exceptions list
doesn't help (I also tried adding the two domains only yielding the same
result).

Logging information reported by `akonadiconsole 0.99` for one of the IMAP
resources (identical for the second resources, repeated periodically):
[2101-11-22T16:56:58.000] akonadi_imap_resource org.kde.pim.imapresource online= true
[2101-11-22T16:57:09.000] akonadi_imap_resource org.kde.pim.kimap KIMAP::LoginJob(0x5620afb606b0)
[2101-11-22T16:57:09.000] akonadi_imap_resource org.kde.pim.kimap connectToHost "mail.company.tld" 143
[2101-11-22T16:57:12.000] akonadi_imap_resource org.kde.pim.kimap Connection to server lost  8
[2101-11-22T16:57:12.000] akonadi_imap_resource org.kde.pim.akonadiagentbase Deferring task "55 Custom startConnect "
[2101-11-22T16:57:12.000] akonadi_imap_resource org.kde.pim.kimap close

I also set / exported the environment variable KIMAP_LOGFILE and restarted
akonadi which created 4 empty log files kimap.log.<PID>.[12].

After I re-enable the proxy, checking mail works fine. After a while, however,
both mail servers are marked as offline again and mail isn't checked / fetched
anymore. For on server this happens after a few minutes, for another it takes
up to a few hours for it being marked as 'offline'.

I also tested Thunderbird to make sure that my connection settings are correct
and Thunderbird works fine with enable and disabled proxy settings.


I've set-up a third IMAP account to a 'work unrelated' mail server. Because
the server is not work related I cannot access it directly (ports are blocked
by the company firewall). Instead, I do a port forwarding via SSH
   ssh -L11993:other.mailserver.tld:993 ssh-server.
I configured Akonadi/KMail to connect to localhost 11993 to access this server,
Akonadi/KMail is able connect to / retrieve mail from the server regardless of
my proxy settings.

Thanks for considering
  Christian.



SOFTWARE/OS VERSIONS
openSUSE Leap 15.1 (including OBS KDE/Qt repositories)

Qt Version: 5.13.0-lp151.5.1.x86_64

akonadi-calendar-lang-19.04.3-lp151.137.1.noarch
akonadi-calendar-tools-19.04.3-lp151.86.1.x86_64
akonadi-calendar-tools-lang-19.04.3-lp151.86.1.noarch
akonadi-contact-19.04.3-lp151.106.1.x86_64
akonadi-contact-lang-19.04.3-lp151.106.1.noarch
akonadi-import-wizard-19.04.3-lp151.91.1.x86_64
akonadi-import-wizard-lang-19.04.3-lp151.91.1.noarch
akonadi-mime-19.04.3-lp151.96.1.x86_64
akonadi-mime-lang-19.04.3-lp151.96.1.noarch
akonadi-notes-lang-19.04.3-lp151.98.1.noarch
akonadi-plugin-calendar-19.04.3-lp151.137.1.x86_64
akonadi-plugin-contacts-19.04.3-lp151.106.1.x86_64
akonadi-plugin-kalarmcal-19.04.3-lp151.129.1.x86_64
akonadi-plugin-mime-19.04.3-lp151.96.1.x86_64
akonadi-search-19.04.3-lp151.132.1.x86_64
akonadi-search-lang-19.04.3-lp151.132.1.noarch
akonadi-server-19.04.3-lp151.189.1.x86_64
akonadi-server-lang-19.04.3-lp151.189.1.noarch
kdepim-addons-19.04.3-lp151.127.1.x86_64
kdepim-addons-lang-19.04.3-lp151.127.1.noarch
kdepim-apps-libs-19.04.3-lp151.110.1.x86_64
kdepim-apps-libs-lang-19.04.3-lp151.110.1.noarch
kdepim-runtime-19.04.3-lp151.175.1.x86_64
kdepim-runtime-lang-19.04.3-lp151.175.1.noarch
kmail-19.04.3-lp151.108.1.x86_64
kmail-account-wizard-19.04.3-lp151.87.1.x86_64
kmail-account-wizard-lang-19.04.3-lp151.87.1.noarch
kmail-application-icons-19.04.3-lp151.108.1.x86_64
kmail-lang-19.04.3-lp151.108.1.noarch
kmailtransport-19.04.3-lp151.132.1.x86_64
kmailtransport-lang-19.04.3-lp151.132.1.noarch
kontact-19.04.3-lp151.88.1.x86_64
kontact-lang-19.04.3-lp151.88.1.noarch
kontactinterface-lang-19.04.3-lp151.123.1.noarch
kpimtextedit-19.04.3-lp151.129.1.x86_64
kpimtextedit-lang-19.04.3-lp151.129.1.noarch
libKF5Libkdepim5-19.04.3-lp151.111.1.x86_64
libKF5LibkdepimAkonadi5-19.04.3-lp151.111.1.x86_64
libkdepim-19.04.3-lp151.111.1.x86_64
libkdepim-lang-19.04.3-lp151.111.1.noarch
pim-data-exporter-19.04.3-lp151.86.1.x86_64
pim-data-exporter-lang-19.04.3-lp151.86.1.noarch
pim-sieve-editor-19.04.3-lp151.84.1.x86_64
pim-sieve-editor-lang-19.04.3-lp151.84.1.noarch
pimcommon-19.04.3-lp151.123.1.x86_64
pimcommon-lang-19.04.3-lp151.123.1.noarch

ADDITIONAL INFORMATION
Comment 1 Wolfgang Bauer 2019-08-06 10:41:41 UTC
Will be fixed in the upcoming 19.08 release.

*** This bug has been marked as a duplicate of bug 407685 ***
Comment 2 Christian Quast 2019-08-06 11:11:07 UTC
Hi Wolfgang,

thanks for the quick reply and linking the bug. Sorry for not seeing the related bug report earlier which didn't show up during my searches. I think it didn't show up because I included the terms "akonadi" and "kmail" in the search which aren't in the header :(

again sorry for 'noise' and thanks for fixing this problem.
best
  Christian.