KrissN / akonadi-ews

Akonadi resource agent for Microsoft Exchange using Exchange Web Services (EWS) protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Akonadi-ews does not save password in kwallet

z1kk0 opened this issue · comments

commented

I try to create EWS account, and save password but it does not arrives at kwallet. Meanwhile if I delete in kwallet a root instance "akonadi-ews" it will appear again, but with no password. If I try to change created account by typing password there are no changes. I tried to remove all akonadi and kmail settings, even tried new system account - no changes. My system is openSUSE Thumbleweed, kmail (kde frameworks) 17.12. I tried to have more logs with this in console:
export QT_LOGGING_RULES="org.kde.pim.* = true"
akonadictl restart
This showed me such logs when I have changed ews account:

org.kde.pim.ews.client.proto: "<?xml version=\"1.0\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"><soap:Header><t:RequestServerVersion Version=\"Exchange2007_SP1\"/></soap:Header><soap:Body><m:FindFolder Traversal=\"Deep\"><m:FolderShape><t:BaseShape>IdOnly</t:BaseShape><t:AdditionalProperties><t:FieldURI FieldURI=\"folder:DisplayName\"/><t:FieldURI FieldURI=\"folder:ParentFolderId\"/></t:AdditionalProperties></m:FolderShape><m:ParentFolderIds><t:DistinguishedFolderId Id=\"msgfolderroot\"/></m:ParentFolderIds></m:FindFolder></soap:Body></soap:Envelope>\n"
org.kde.pim.ews.client.proto: "<?xml version=\"1.0\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"><soap:Header><t:RequestServerVersion Version=\"Exchange2007_SP1\"/></soap:Header><soap:Body><m:GetFolder><m:FolderShape><t:BaseShape>IdOnly</t:BaseShape></m:FolderShape><m:FolderIds><t:DistinguishedFolderId Id=\"inbox\"/><t:DistinguishedFolderId Id=\"calendar\"/><t:DistinguishedFolderId Id=\"tasks\"/><t:DistinguishedFolderId Id=\"contacts\"/></m:FolderIds></m:GetFolder></soap:Body></soap:Envelope>\n"
org.kde.pim.ews.client.request: Starting GetFolder request ((EwsId(Distinguished: inbox), EwsId(Distinguished: calendar), EwsId(Distinguished: tasks), EwsId(Distinguished: contacts)))
org.kde.pim.ews: requestPassword: start
org.kde.pim.ews: onWalletOpenedForRead: start true
org.kde.pim.ews: onWalletOpenedForRead: got password
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a6dde0) ""
org.kde.pim.ews.client.proto: response dumped to "/tmp/akonadi-ews-XcTJ2mg/ews_xmldump_TTw8019.xml"
org.kde.pim.ews.client: Failed to process EWS request - HTTP code 401
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a6db60) ""
org.kde.pim.ews.client.proto: response dumped to "/tmp/akonadi-ews-XcTJ2mg/ews_xmldump_Cjd8019.xml"
org.kde.pim.ews.client: Failed to process EWS request - HTTP code 401
org.kde.pim.ews.client: Failed to process EWS request - HTTP code 401
org.kde.pim.ews.client.proto: "<?xml version=\"1.0\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"><soap:Header><t:RequestServerVersion Version=\"Exchange2007_SP1\"/></soap:Header><soap:Body><m:GetFolder><m:FolderShape><t:BaseShape>IdOnly</t:BaseShape></m:FolderShape><m:FolderIds><t:DistinguishedFolderId Id=\"inbox\"/></m:FolderIds></m:GetFolder></soap:Body></soap:Envelope>\n"
org.kde.pim.ews.client.request: Starting GetFolder request ((EwsId(Distinguished: inbox)))
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a74bb0) "<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Header><h:ServerVersionInfo MajorVersion=\"15\" MinorVersion=\"1\" MajorBuildNumber=\"466\" MinorBuildNumber=\"37\" Version=\"V2016_01_06\" xmlns:h=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns=\"http://schemas.microsoft.com/exchange/services/2006/types\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><m:GetFolderResponse xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"><m:ResponseMessages><m:GetFolderResponseMessage ResponseClass=\"Success\"><m:ResponseCode>NoError</m:ResponseCode><m:Folders><t:Folder><t:FolderId Id=\"AQMkAGU3NDhhMDAANy1lMTk0LTQwZTEtYjQ5MS03NjA4MGE5NWE3ZjkALgAAA11CX9owgSpOh2Ly9Vqw8VIBAGMRBz9aJtNKqXbJT2coS9cAAAIBDAAAAA==\" ChangeKey=\"AQAAABYAAABjEQc/WibTSql2yU9nKEvXAACtJ2ae\"/></t:Folder></m:Folders></m:GetFolderResponseMessage></m:ResponseMessages><"
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a74bb0) "/m:GetFolderResponse></s:Body></s:Envelope"
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a74bb0) ">"
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a74bb0) ""
org.kde.pim.ews.client.proto: response dumped to "/tmp/akonadi-ews-XcTJ2mg/ews_xmldump_XFW8019.xml"
org.kde.pim.ews.client.request: Got GetFolder response (id: f3b41c, name: )
org.kde.pim.ews: requestPassword: start
org.kde.pim.ews: requestPassword: password already set
org.kde.pim.ews.client.proto: "<?xml version=\"1.0\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"><soap:Header><t:RequestServerVersion Version=\"Exchange2007_SP1\"/></soap:Header><soap:Body><m:GetFolder><m:FolderShape><t:BaseShape>IdOnly</t:BaseShape><t:AdditionalProperties><t:FieldURI FieldURI=\"folder:DisplayName\"/><t:ExtendedFieldURI PropertySetId=\"9bf757ae-69b5-4d8a-bf1d-2dd0c0871a28\" PropertyName=\"GlobalTags\" PropertyType=\"StringArray\"/><t:ExtendedFieldURI PropertySetId=\"9bf757ae-69b5-4d8a-bf1d-2dd0c0871a28\" PropertyName=\"GlobalTagsVersion\" PropertyType=\"Integer\"/></t:AdditionalProperties></m:FolderShape><m:FolderIds><t:DistinguishedFolderId Id=\"msgfolderroot\"/><t:DistinguishedFolderId Id=\"inbox\"/></m:FolderIds></m:GetFolder></soap:Body></soap:Envelope>\n"
org.kde.pim.ews.client.request: Starting GetFolder request ((EwsId(Distinguished: msgfolderroot), EwsId(Distinguished: inbox)))
org.kde.pim.ews.client.proto: data KIO::TransferJob(0x560ed5a6dcc0) ""
org.kde.pim.ews.client.proto: response dumped to "/tmp/akonadi-ews-XcTJ2mg/ews_xmldump_Zbw8019.xml"
org.kde.pim.ews.client: Failed to process EWS request - HTTP code 401
ERROR "Failed to process EWS request - HTTP code 401"

I ran into the same and managed to work around by manually calling the dbus method Settings/org.kde.Akonadi.Ews.Wallet::setPassword on the service org.freedesktop.Akonadi.Agent.akonadi_ews_resource_0 with my password as the parameter. I could see the password being written into kdewallet and now it's prefilled when I open the settings for my exchange calendar.

commented

Hi zsol, can you provide an example for your call? I never used dbus before. Thanks.
Also since this code was merged into KDE I think all bug reporting happens on the kde bug tracker.

Hi, I faced the same issue today, Kmail-EWS was not saving password to Kwallet. I found this bug and after checing around here's the dbus command I used to enter a password (app password) for my Office365 subscription:

qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_6 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "my_app_password"

It still didn't work but when I opened the account gui, re-entered password once more, I could see the folder list. the list started to come after a while.

Btw, you can also install kwalletmanager and add the passwword manually under the ews password folder, after creating a pass entry with name "akonadi_ews_resource_6rc" equivalent of your resource name. I didn't see any encryption on the password at least for my kwallet settings. I used classic kwallet when setting it up, with no password.

This also worked for me. On its own, KMail would repeatedly forget the password and hit 401s. With this, it can log in without issue.

Probably fixed here: https://bugs.kde.org/show_bug.cgi?id=393002

Is this still the right place to talk about bugs, anyway?

I had the same issue. I wonder if it is because of special chars in the password.

I also experienced the issue, and could solve it thanks to this thread. I referenced it there.

Also ran into this issue. Don't if this helps, but I configured KDE in a way it should always prompt for confirmation if something tries to access kWallet.

So will there be a patch at all or is akonadi-ews dead?

commented

This extension has been merged into main KDE repo. This bug has been fixed in there some time ago.

Seems it isn't fixed.

There is screencast:
screencast.zip
GIF is too huge, so it is mp4 inside archive.

Temporary available here on filebin.net

Operating System: openSUSE Tumbleweed 20200125
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Kernel Version: 5.4.13-1-default
OS Type: 64-bit

KMail Version: 5.13.1 (19.12.1)

Still not fixed here...
KDE plasma: 5.17.5
KDE framework: 5.67.0
Qt: 5.13.2
OS : fedora 31

Have the same issue:
OS: OpenSuse Tumbleweed 20200416
KOrganizer: 5.13.3 (19.12.3)
KDE framework: 5.69.0
KDE plasma: 5.18.4
QT: 5.14.1
Akonadi 5.13.3 (19.12.3)

org.kde.pim.akonadiserver: New notification connection (registered as Akonadi::Server::NotificationSubscriber(0x7f05fc1b48e0) )
org.kde.pim.akonadiserver: Subscriber Akonadi::Server::NotificationSubscriber(0x7f05fc1b48e0) identified as "SpecialCollectionsMonitor - 93945876400032"
org.kde.pim.ews.client: Failed to process EWS request - HTTP code 401
org.kde.pim.ews: requestAuthFailed - going offline
:~> akonadictl status
Akonadi Control: running
Akonadi Server: running
Akonadi Server Search Support: available (Remote Search, Akonadi Search Plugin)
Available Agent Types: akonadi_akonotes_resource, akonadi_archivemail_agent, akonadi_birthdays_resource, akonadi_contacts_resource, akonadi_davgroupware_resource, akonadi_ews_resource, akonadi_ewsmta_resource, akonadi_followupreminder_agent, akonadi_googlecalendar_resource, akonadi_googlecontacts_resource, akonadi_ical_resource, akonadi_icaldir_resource, akonadi_imap_resource, akonadi_indexing_agent, akonadi_kalarm_dir_resource, akonadi_kalarm_resource, akonadi_knut_resource, akonadi_kolab_resource, akonadi_maildir_resource, akonadi_maildispatcher_agent, akonadi_mailfilter_agent, akonadi_mbox_resource, akonadi_migration_agent, akonadi_mixedmaildir_resource, akonadi_newmailnotifier_agent, akonadi_notes_agent, akonadi_notes_resource, akonadi_openxchange_resource, akonadi_pop3_resource, akonadi_sendlater_agent, akonadi_tomboynotes_resource, akonadi_unifiedmailbox_agent, akonadi_vcard_resource, akonadi_vcarddir_resource

Found some info about:
https://bugs.kde.org/show_bug.cgi?id=390798

This patch can solve the problem:
https://cgit.kde.org/kdepim-runtime.git/commit/?id=7afd99abbfa141f6e6dfbe69b01827af8f16ba27

From git log: https://cgit.kde.org/kdepim-runtime.git/log/ - the issue can be solved from version v20.03.90. Actualy I'm using installed Akonadi v19.12.3-1.1

Same issue here with:
OS: Arch Linux 20200420
Akonadi: 19.12.3-2
Plasma: 5.18.4.1

But as i far as i understand there is a fix and it is in v20? So i just have to wait? :)

I was using Kububtu 20.04 and found this problem. Just to be sure that it was not something that has already been fixed as part of a proper upstream release I tested this on the latest Manjaro Testing ISO, which gives me access to the latest akonadi 20.04 version, but the problem still persists. So has the fix been integrated into a release or not?

Hi, I faced the same issue today, Kmail-EWS was not saving password to Kwallet. I found this bug and after checing around here's the dbus command I used to enter a password (app password) for my Office365 subscription:

qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_6 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "my_app_password"

It still didn't work but when I opened the account gui, re-entered password once more, I could see the folder list. the list started to come after a while.

Btw, you can also install kwalletmanager and add the passwword manually under the ews password folder, after creating a pass entry with name "akonadi_ews_resource_6rc" equivalent of your resource name. I didn't see any encryption on the password at least for my kwallet settings. I used classic kwallet when setting it up, with no password.

If it wasn't for this SUPER HELPFUL tip EWS would be essentially broken on KDE PIM.

It looks like this problem is still present in 5.16.0 (20.12.0)

And still present in Akonadi 23.08.2 (Framework 5.111.0, Plasma 5.27.8)

I just found several EWS resources in kwalletmanager, with only two having the correct password, three were wrong and one was even empty. After setting all passwords to the correct one, I can now reliably send E-Mails again.

Looks like the Mail-Send-Agent picked a resource randomly, so sending would fail in 67% of all cases.