MMRIZE / MMM-CalDAV

CalDav Parser
MIT License
8 stars 0 forks source link

CalDav with NextCloud and self-signed certificate #8

Closed AlexNathan345 closed 3 weeks ago

AlexNathan345 commented 9 months ago

Unfortunately, I'm unable to to use this module with my NextCloud installation as my SSL certificates are self-signed.

Is there a way to allow for self-signed certificates or disabling the check? Or a step-by-step guide on how to set this up successfully with NextCloud?

Thanks very much for your help!

eouia commented 9 months ago

I'm not experienced with Self-Signed SSL certification. What kind of error or symptom did the module spit out?

AlexNathan345 commented 9 months ago

This is the error message I get in the MagicMirror2 log: 23.02.2024 09:11.41.391] [ERROR] FetchError: request to https://XX.XXX.XXX.XX:444/remote.php/dav failed, reason: self-signed certificate at ClientRequest. (/magicmirror2/modules/MMM-CalDAV/node_modules/node-fetch/lib/index.js:1501:11) at ClientRequest.emit (node:events:517:28) at TLSSocket.socketErrorListener (node:_http_client:501:9) at TLSSocket.emit (node:events:517:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'DEPTH_ZERO_SELF_SIGNED_CERT', code: 'DEPTH_ZERO_SELF_SIGNED_CERT'

I also tried connecting with http:// but this doesn't work either...

The MM2 config is: { module: "MMM-CalDAV", // This module works in background, so position is not needed. config: { timeRangeStart: -30, // Get events from 30 days before timeRangeEnd: 60, // Get events from 60 days from today servers: [ { envPrefix: "NEXTCLOUD_", accountType: 'caldav', authMethod: 'Basic', serverUrl: "https://XX.XXX.XXX.XX:444/remote.php/dav", }, ], } }, { module: "calendar", header: "My upcoming events", position: "top_left", config: { servers: [ { symbol: "calendar", url: "http://XX.XXX.XXX.XX:8080/CALDAV/NEXTCLOUD_My_calendar.ics", auth: { // REQUIRED user: 'username1', // DEFINED in .env file. pass: 'password1', method: 'basic' }, }, ], } },

eouia commented 9 months ago

When you try https://USERNAME:PASSWORD@XX.XXX.XXX.XX:444/remote.php/dav in your browser, what happens?

AlexNathan345 commented 9 months ago

I get this: This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

eouia commented 9 months ago

The error was caused by node-fetch, a dependency of tsdav, which this module depends on. So, I cannot do anything at this moment. Maybe node-fetch seems unable to handle some irregular https certification. I'll report this error to the node-fetch developers, but I cannot guarantee that it will be fixed soon. Sorry.

AlexNathan345 commented 9 months ago

Thanks very much for looking into this. At least now I know that the error isn't in my config. I might try other certificates at some point but don't really need them for NextCloud as it isn't opened up to the internet. But thanks again.

eouia commented 9 months ago

Hmmm.. If I have NextCloud, I could look inside more, but atm I have not enough time to install and play with it. When I have some time, I'll research more.

AlexNathan345 commented 9 months ago

All good, don't worry too much.

eouia commented 3 weeks ago

I'll close this issue because I can't help anything. If you have any additional topic, I'll reopen it again.