sabre-io / Baikal

Baïkal is a Calendar+Contacts server
https://sabre.io/baikal/
GNU General Public License v3.0
2.44k stars 282 forks source link

Baikal fails to sync on DAVx5 & aCalDAV on android and on desktop app #1178

Closed ll3N1GmAll closed 1 year ago

ll3N1GmAll commented 1 year ago

Baikal version: 0.9.3

Expected behaviour: DAV sync on android and desktop

Current behaviour: sync fails with multiple apps on both desktop and android

Steps to reproduce:

  1. input following address to test:
  2. https://SERVER_ADDRESS/dav.php/calendars/USER/default/
  3. input following address to test:
  4. https://SERVER_ADDRESS/dav.php/

Both addresses fail to sync on DAVX5 and aCalDAV on android and fail on desktop app as well.

aCalDAV error "invalid server answer, check URL" DAVx5 error: "couldn't find CalDAV or CardDAV service."

Desktop app gives no error; but sync fails silently.

HTTPS is running on non-standard port. Not sure if this is part of the issue. I can get to the admin interface on the non-standard port successfully. I also got a certificate "accept" prompt when I try to add the account to DAVx5. So, it is reaching Baikal.

I can provide additional log details that may help. I didn't want to add them all here before I knew what would be helpful.

ner00 commented 1 year ago

I tested this with Outlook CalDav Synchronizer for Windows and DAVx5 for Android 13, both worked fine. It was successful with both plain HTTP and secure HTTPS (self-signed). The only thing I didn't try was using a non-standard port.

ll3N1GmAll commented 1 year ago

I tested this with Outlook CalDav Synchronizer for Windows and DAVx5 for Android 13, both worked fine. It was successful with both plain HTTP and secure HTTPS (self-signed). The only thing I didn't try was using a non-standard port.

I tried this on standard 443 and on the non-standard port, both failed. What can I provide or look for in the logs that would help diagnose the issue? Thanks for your reply and for taking the time to test this!

ner00 commented 1 year ago

To be honest, I have no clue. I would probably look at the webserver logs and PHP logs to see what's happening, maybe increase verbosity on the logging part, use Wireshark in the extreme.

I just started using Baikal 2 days ago, it was extremely straightforward to set up and I didn't have any issues. If possible start testing the service on the localhost, both server and client, if that works move another step and put the client in LAN, and so on and so forth until the communication breaks.

ll3N1GmAll commented 1 year ago

To be honest, I have no clue. I would probably look at the webserver logs and PHP logs to see what's happening, maybe increase verbosity on the logging part, use Wireshark in the extreme.

I just started using Baikal 2 days ago, it was extremely straightforward to set up and I didn't have any issues. If possible start testing the service on the localhost, both server and client, if that works move another step and put the client in LAN, and so on and so forth until the communication breaks.

I am doing this all on the local LAN to get it setup. It's just so bizarre that it setup so easily and so quickly, yet it wont connect to any of my clients (or the other way around, rather) with no real errors.

I can get logged into the interface with no issues. I wish there was an option to import my calendar and contacts, but I was going to try to do this with a desktop client. Which is what led to where I am now.

ner00 commented 1 year ago

Yeah, you seem to have everything right, but something seems to be messing the stuff somewhere. It may be overkill but at this point I would probably use Wireshark on the client side (or server side) and use plain http protocol to have a view into what's being transmitted and replied. That might give you some clue about which side gives up first, and maybe also why.

ll3N1GmAll commented 1 year ago

The machine running Baikal has the firewall completely open. So this is not a firewall issue. Here is the log I get from the desktop client: Exception: MailClient.Accounts.ConnectionException: An error occurred while sending the request. 23:42:52.026|07C| ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. 23:42:52.026|07C| ---> System.IO.IOException: The response ended prematurely. 23:42:52.026|07C| at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 23:42:52.026|07C| --- End of inner exception stack trace --- 23:42:52.026|07C| at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.AuthenticationHelper.SendWithNtAuthAsync(HttpRequestMessage request, Uri authUri, Boolean async, ICredentials credentials, Boolean isProxyAuth, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, Boolean async, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.InteractionController.HttpClientCertificationValidationMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.Common.HttpClientHandlers.HttpClientLoggingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.Common.HttpClientHandlers.HttpClientBackoffHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 23:42:52.026|07C| at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 23:42:52.026|07C| at MailClient.Protocols.CalDav.ProtocolCommands.Connector.RunCommand(CalDavAccount account, ICommand command, CancellationToken cancellationToken) 23:42:52.026|07C| --- End of inner exception stack trace --- 23:42:52.026|07C| at MailClient.Protocols.CalDav.ProtocolCommands.Connector.RunCommand(CalDavAccount account, ICommand command, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.CalDav.FolderSynchronizer.UpdateOptions(Uri[] baseUris, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.CalDav.FolderSynchronizer.Bootstrap(WorkerStatus status, CancellationToken cancellationToken) 23:42:52.026|07C| at MailClient.Protocols.CalDav.CalDavGenericCommand.Execute(WorkerStatus status) 23:42:52.026|07C| at MailClient.Commands.Command.Process(WorkerStatus status) 23:42:52.026|05B| AccountBase.ChangeOnlineState : State changed to OFFLINE due BrokenConnection

I find this to be very bizarre. I can get to the Baikal admin interface and I can login successfully. The android client fails as well. However, its log out put is VERY verbose. So, I'm at information overload there. Not sure what is useful in that.

This is when I attempt to connect over HTTP.

ll3N1GmAll commented 1 year ago

The following post is what I get when connecting over HTTPS and the non-standard port the server is running on. I think the previous HTTP request fails because my server is setup to use HTTPS..at least I think so. So, the directly above HTTPS request looks like it is working more so.

ll3N1GmAll commented 1 year ago

Account's UID is 3989ea28-1e6e-4118-83d8-1e64c121f9e3 AccountBase.ChangeOnlineState : State changed to ONLINE due User BOOTSTRAP Updating account properties https://:/dav.php/ Request: Method: OPTIONS, RequestUri: 'https://:/dav.php/', Version: 1.1, Content: , Headers: { User-Agent: eMClient/9.2.1628.0 }

Response: StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.DecompressionHandler+GZipDecompressedContent, Headers: { Date: Fri, 24 Mar 2023 04:45:03 GMT Server: Apache/2.4.41 (Ubuntu) Set-Cookie: PHPSESSID=44qdoj705g1vnfts3c0haisvgi; path=/; HttpOnly Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Vary: Accept-Encoding Expires: Thu, 19 Nov 1981 08:52:00 GMT Content-Type: text/html; charset=utf-8 }

Error: Class 'DOMDocument' not found in /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php:259
Stack trace:
#0 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
#1 /var/www/baikal/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
#2 /var/www/baikal/html/dav.php(69): Baikal\Core\Server->start()
#3 {main}

   Request:
  Method: PROPFIND, RequestUri: 'https://:/dav.php/', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
  {
    Accept: text/xml
     Brief: t
    Depth: 0
   User-Agent: eMClient/9.2.1628.0
    Content-Type: text/xml; charset=utf-8
 }
  

   Response:
   StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.DecompressionHandler+GZipDecompressedContent, Headers:
   {
     Date: Fri, 24 Mar 2023 04:45:03 GMT
     Server: Apache/2.4.41 (Ubuntu)
    Cache-Control: no-store, no-cache, must-revalidate
     Pragma: no-cache
    Vary: Accept-Encoding
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
     Content-Type: text/html; charset=utf-8
   }
   
Error: Class 'DOMDocument' not found in /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php:259
Stack trace:
#0 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
#1 /var/www/baikal/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
#2 /var/www/baikal/html/dav.php(69): Baikal\Core\Server->start()
#3 {main}

  Request:
  Method: REPORT, RequestUri: 'https://:/dav.php/', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
     Accept: text/xml
  Brief: t
     User-Agent: eMClient/9.2.1628.0
    Content-Type: text/xml; charset=utf-8
  }
   
  Response:
  StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.DecompressionHandler+GZipDecompressedContent, Headers:
  {
    Date: Fri, 24 Mar 2023 04:45:03 GMT
    Server: Apache/2.4.41 (Ubuntu)
    Cache-Control: no-store, no-cache, must-revalidate
    Pragma: no-cache
    Vary: Accept-Encoding
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Content-Type: text/html; charset=utf-8
  }
   
Error: Class 'DOMDocument' not found in /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php:259
Stack trace:
#0 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
#1 /var/www/baikal/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
#2 /var/www/baikal/html/dav.php(69): Baikal\Core\Server->start()
#3 {main}

   BOOTSTRAP finished
   Request:
  Method: PROPFIND, RequestUri: 'https://:/dav.php/', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
   {
    Accept: text/xml
     Brief: t
   Depth: 1
    User-Agent: eMClient/9.2.1628.0
   Content-Type: text/xml; charset=utf-8
   }
  

  Response:
   StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.DecompressionHandler+GZipDecompressedContent, Headers:
   {
     Date: Fri, 24 Mar 2023 04:45:03 GMT
    Server: Apache/2.4.41 (Ubuntu)
     Cache-Control: no-store, no-cache, must-revalidate
    Pragma: no-cache
     Vary: Accept-Encoding
     Expires: Thu, 19 Nov 1981 08:52:00 GMT
     Content-Type: text/html; charset=utf-8
  }
   
Error: Class 'DOMDocument' not found in /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php:259
Stack trace:
#0 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
#1 /var/www/baikal/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
#2 /var/www/baikal/html/dav.php(69): Baikal\Core\Server->start()
#3 {main}
            
ll3N1GmAll commented 1 year ago

I apologize for the above post. I cannot get the post to not nest parts of it in itself as you see above. I used the code button and tried it without. It still does this. It's a mess. I'm sorry. I cannot get it to stop behaving badly.

ll3N1GmAll commented 1 year ago

I have a wireshark dump of the communication attempt as well. If anyone has ideas of what to share from it, please let me know.

ll3N1GmAll commented 1 year ago

I figured out the issue! The relevant error in all that out put was this - Error: Class 'DOMDocument' not found in /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php:259

To fix this issue you need to do the following: sudo apt install php7.4-fpm php7.4-sqlite3 php7.4-xml php-mbstring sudo a2enmod proxy_fcgi setenvif sudo a2enconf php7.4-fpm sudo service apache2 restart

ner00 commented 1 year ago

All of the above seem useful, but most probably this one: php7.4-xml seeing as class DOMDocument depends on it, and of course sudo service apache2 restart