zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
26.82k stars 1.87k forks source link

[BUG] Desktop Client doesn't check trusted cert store #3934

Open FalcoGer opened 1 year ago

FalcoGer commented 1 year ago

Trilium Version

0.59.4

What operating system are you using?

Ubuntu

What is your setup?

Local + server sync

Operating System Version

Linux [hostname redacted] 5.15.0-70-generic #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Description

The desktop client does not check the trusted certificate store in /etc/ssl/certs/. I have generated a certificate authority and signed a client certificate with it and added the CA to the trusted cert store by putting it into /usr/local/ca-certificates/[name redacted]/CA_[name redacted].crt and then running sudo update-ca-certificates.

The programs like wget and curl accept the certificate. But in trilium there is no option to either ignore invalid certificates nor an option to import the CA and it doesn't check /etc/ssl/certs either, so it seems that it's impossible to use a self signed certificate.

The specific error is ERR_CERT_AUTHORITY_INVALID

I use a reverse proxy on the URI /trilium/ in apache to redirect to localhost:8080. The web interface works fine on that URI, but the desktop client doesn't even get there because it rejects the cert.

The certificate in question is similar to this

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
        Signature Algorithm: sha512WithRSAEncryption
        Issuer: O=testing, CN=CA Server
        Validity
            Not Before: May 12 18:12:09 2023 GMT
            Not After : May  9 18:12:09 2033 GMT
        Subject: O=testing, CN=webhost.tld/emailAddress=webmaster@webhost.tld
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (8192 bit)
                Modulus:
                    00:93:4d:6e:ab:6a:c3:a5:01:f2:7b:6e:4f:5c:fa:
                    fb:d3:0f:dc:08:21:f8:43:3c:09:c6:3c:29:2d:8a:
                    e1:31:30:8a:2b:54:46:1f:9e:b9:9e:c7:af:3e:1c:
                    19:21:17:49:db:4f:4d:27:a4:25:0e:bb:00:c1:11:
                    d5:99:b6:ae:80:df:19:e6:52:5d:40:52:eb:35:28:
                    e7:eb:a7:64:ca:a0:9e:e3:46:ca:91:00:b6:e3:b9:
                    ca:a9:d7:e2:ac:86:49:14:13:66:f7:14:95:a2:df:
                    f6:93:e2:e9:ca:94:ce:7a:f7:5e:f8:78:32:af:7a:
                    17:4b:ed:84:19:7a:0f:ee:17:82:2d:d8:76:be:9c:
                    47:7f:ca:ce:81:0c:3f:62:3d:a2:7a:5e:9b:c9:9e:
                    c6:3e:77:21:75:00:c7:a3:bc:f4:21:ba:fb:e4:e6:
                    10:74:37:43:ad:01:dc:f3:36:0c:3f:11:bc:4c:22:
                    4d:7b:36:11:d4:22:80:a1:85:9e:3a:c2:37:0f:93:
                    2c:2b:15:ee:e4:68:90:39:d4:a2:0c:df:aa:5b:12:
                    2b:58:6f:a6:40:d5:62:41:7f:0f:fe:a7:2e:66:d1:
                    12:85:c3:2e:c6:d7:61:99:c3:7e:25:b7:b2:61:af:
                    34:0d:81:2d:52:56:a6:87:83:fa:2f:75:b3:21:5b:
                    b5:5f:81:54:e3:41:2f:ac:d9:9f:a7:5a:e5:1b:24:
                    63:b7:01:80:25:88:9e:78:61:a8:50:b2:ad:41:47:
                    56:44:1b:5e:35:2c:5d:bb:39:af:05:46:71:55:5f:
                    b9:34:fb:65:a9:cd:43:48:71:01:69:89:52:3d:c4:
                    b0:bf:f3:3b:e0:a5:13:d9:4c:fe:99:05:5c:a5:66:
                    85:93:78:0c:c8:b6:b5:c7:65:fe:d5:49:16:62:c5:
                    b2:98:b3:39:81:9d:4b:74:3b:ea:2a:23:bb:70:5c:
                    32:3c:97:2d:f9:ae:8b:5d:dd:b5:d9:4d:5a:1b:57:
                    73:30:90:51:09:78:3a:20:f7:b2:34:63:28:5d:3f:
                    64:b5:db:54:fd:ab:c9:74:9c:5d:5d:ef:35:9a:28:
                    a6:a8:3e:22:b8:8d:66:07:92:78:dc:30:2d:7b:42:
                    c6:cd:3d:f0:55:b5:f9:ad:94:64:37:59:59:e4:e2:
                    fd:41:ca:19:07:8a:53:ca:25:15:33:99:31:b6:81:
                    bb:48:da:14:7c:6e:7b:b0:d2:1d:eb:9f:88:8d:4e:
                    ce:88:ec:f5:e4:69:b6:83:d9:48:09:5a:55:b7:91:
                    39:e5:d4:b8:73:07:94:78:e3:f6:82:63:b8:50:e3:
                    ad:99:73:df:cf:5c:00:52:e2:ac:8b:1d:0e:80:43:
                    03:1e:b3:8a:e6:20:c7:00:d5:a0:bb:19:e3:a3:d5:
                    70:01:bf:c8:2f:2f:14:c6:94:30:21:21:68:2e:1b:
                    02:55:a3:84:96:ae:da:97:01:2b:ee:d1:23:82:b3:
                    f0:8c:5b:ef:69:3b:93:79:58:7b:e9:a8:80:e4:ba:
                    ca:4f:48:71:90:37:30:26:40:a5:19:0c:4c:73:ae:
                    21:a3:51:95:02:5f:13:80:e7:aa:13:22:7d:83:4b:
                    f3:82:73:94:dd:8f:9f:b6:a6:1f:fc:75:37:97:9f:
                    9b:15:3e:28:31:c3:72:b2:c3:b8:65:a3:e8:c2:7b:
                    bb:e6:d8:c6:52:e1:61:e1:60:9c:22:c9:d6:e9:8e:
                    40:3a:f3:4e:f4:58:3b:0a:65:35:47:84:0a:09:5a:
                    ec:02:23:d1:f6:39:25:d2:7d:b7:f4:c3:51:d1:84:
                    d0:54:ef:09:a0:22:29:a5:29:e8:7c:1f:5d:ff:fc:
                    ca:95:5b:e5:18:ef:19:fa:8d:e1:24:86:0b:3c:9f:
                    b9:7f:db:02:76:bc:bc:d7:ad:fb:e2:f9:7c:29:08:
                    ed:b4:07:3d:a0:52:6c:1b:fa:1c:fc:e2:de:07:64:
                    a2:5e:94:25:77:83:4b:1e:b3:07:bd:e3:b3:73:28:
                    b2:59:cc:43:11:39:f0:b4:db:1b:79:35:4c:e9:33:
                    fa:d2:5f:b3:eb:e4:b2:8b:ff:c0:22:ad:07:80:a2:
                    a8:64:a3:ab:e2:7f:d1:65:d8:b6:e7:11:00:40:9b:
                    f3:e9:71:56:d2:03:23:49:f2:a5:8b:cc:cb:ae:0a:
                    5f:4f:f0:62:8d:52:14:bc:7a:81:77:79:50:2f:26:
                    cb:63:9f:65:69:9e:88:d3:a0:6f:56:11:6f:ed:a7:
                    62:d9:9f:85:36:1f:23:b0:e2:8e:24:55:40:6f:1f:
                    fc:c9:38:8c:0f:3c:be:c2:db:76:dd:04:5a:dc:dd:
                    1e:6c:60:d5:06:b8:7a:73:73:f1:b3:b5:4c:a2:2b:
                    c5:58:d6:cb:1c:b4:14:f2:d5:53:2f:6b:7d:2c:e7:
                    00:c5:62:0d:a9:d7:24:af:b5:f9:c2:27:9d:6a:7d:
                    72:50:27:cc:69:a5:5c:80:22:1b:e0:52:63:0d:50:
                    a9:10:1b:cd:95:eb:1f:05:27:d0:74:ae:c7:ff:f6:
                    f6:ea:da:c2:a3:5a:79:04:fb:e7:af:6a:c1:61:b4:
                    79:0d:ed:9e:e0:02:83:cb:18:01:66:13:b2:11:ed:
                    e2:6b:15:5c:07:7d:68:3c:1f:9c:7b:b5:78:a1:75:
                    53:31:01:33:30:e8:76:b0:bb:3a:aa:c1:fd:27:c2:
                    17:56:22:71:00:c0:81:81:cf:67:f0:a0:8f:51:28:
                    f5:8e:cd:93:39
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Authority Key Identifier:
                keyid:A6:8E:83:0B:8D:A6:25:1E:6A:F5:BA:CF:58:0E:F7:B5:C7:16:0C:94
                DirName:/O=testing/CN=CA Server
                serial:2A:48:89:2B:A7:73:A4:C1:F0:68:E6:4E:DE:48:9B:43:FB:D7:43:24
            X509v3 Subject Key Identifier:
                4B:56:B2:A6:4C:5E:1D:C5:17:3F:71:55:6E:4D:5F:A6:26:E1:9D:01
            X509v3 Issuer Alternative Name:
                <EMPTY>

            Authority Information Access:
                CA Issuers - URI:http://0.0.0.0/CA_testing-cert.pem
            X509v3 CRL Distribution Points:
                Full Name:
                  URI:http://0.0.0.0/crl.pem
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment, Data Encipherment
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name:
                DNS:webhost.tld, email:webmaster@webhost.tld, DNS:othername.tld, IP Address:0.0.0.0
    Signature Algorithm: sha512WithRSAEncryption
    Signature Value:
        43:44:4e:93:ed:60:22:f0:ad:1b:4b:7b:83:c8:5e:88:27:5e:
        24:b4:cc:7b:a4:ea:21:bd:6b:5c:17:3a:29:d6:ab:c1:d5:33:
        9e:4b:f4:48:f0:a3:b0:11:ba:09:f0:05:fd:a2:28:05:45:06:
        d6:66:64:e1:5f:35:ec:1f:d4:c3:f6:a2:74:58:db:ae:48:ba:
        80:0c:99:7b:88:bc:30:26:1a:1e:cf:c2:66:a4:f0:d8:2f:4c:
        34:35:12:81:62:8a:1d:14:da:ea:e2:4e:8f:68:55:82:27:e0:
        67:e2:ff:30:9a:86:17:f8:06:8a:14:7a:9d:70:c3:0a:9a:0e:
        22:7a:00:be:17:53:32:d7:ad:8d:56:70:6d:df:72:a4:d4:60:
        3c:0d:1b:b0:c0:bd:dd:b0:04:f5:04:ff:7c:85:f6:5b:d2:69:
        a3:e2:33:1a:bc:54:e1:34:4e:f0:8a:db:ee:93:8d:be:8a:82:
        44:12:0e:3b:10:f5:03:47:9b:dc:8f:e7:b3:24:7a:b2:40:7a:
        42:b6:a3:18:05:90:a3:39:3d:70:0e:de:29:73:40:37:d8:ab:
        8a:8c:ef:d3:a9:81:54:af:c6:09:c5:c4:51:83:be:4b:fe:2c:
        e3:d8:48:7d:dd:8c:ea:6e:00:7f:d8:c6:de:3c:87:df:9f:3c:
        a5:a8:01:cf:62:73:0b:b0:59:9f:22:73:2b:59:0b:d7:00:4f:
        c5:24:a7:2c:f7:cf:90:ac:56:ba:30:bb:e4:97:64:cf:de:cb:
        ba:3e:c9:e6:fb:34:7b:d0:3a:a4:34:50:cb:a5:06:e8:bd:2e:
        85:d4:4a:fb:81:a9:98:96:f6:fd:ff:51:81:a2:a7:2b:b2:6e:
        25:33:55:9a:c8:07:4b:c3:7d:1a:93:de:46:c2:f3:a8:a2:0c:
        90:d4:62:61:59:47:b9:37:d4:5f:1a:e8:b8:41:5a:bc:a4:21:
        79:1a:21:88:45:ef:ea:cd:06:92:a6:cf:b9:82:4c:74:c2:7a:
        b1:51:8d:a1:43:6c:c8:34:60:2d:6d:21:93:db:ec:0e:b9:8b:
        98:d1:7e:b5:77:61:fe:a7:34:b7:d8:06:59:2b:f6:cd:d3:e9:
        b6:aa:39:09:3e:8a:62:7f:62:99:5f:64:b8:f0:c2:2d:6a:fa:
        8e:37:7c:e1:e4:6d:8d:be:4b:c9:be:84:0e:27:10:4f:8f:eb:
        4e:ac:6b:00:81:db:3a:31:eb:40:f1:ec:f3:43:3a:25:e1:f0:
        c7:67:da:71:19:56:12:51:0d:97:fd:67:51:c2:79:96:29:d5:
        b0:c2:86:ad:f0:36:32:95:d3:d0:26:a7:55:9b:66:c4:71:4d:
        73:4c:42:8f:3a:45:b0:33:c3:42:fe:ae:1f:6d:79:06:31:44:
        c2:8d:1b:66:aa:5c:f5:1c:96:61:46:1a:7f:cb:8b:95:89:19:
        db:8f:37:e0:02:2e:63:80:27:5a:19:6c:fb:52:ab:c7:9e:83:
        2a:71:f5:89:41:b7:a6:62:d6:1a:b7:00:bb:b6:0c:93:23:e7:
        10:b3:22:df:05:f8:30:1b:47:2d:da:09:b2:ed:b3:8a:17:0f:
        a0:25:1e:74:fe:de:d6:f3:4a:0d:59:7b:6d:01:78:2a:8c:6c:
        cb:6e:44:5e:ca:32:b3:7e:0c:04:3c:03:9a:43:a6:e5:e3:80:
        42:89:bb:11:55:08:5a:ab:0c:d9:f4:10:62:9d:54:35:fb:1b:
        cf:ad:07:13:6e:0b:13:f3:bd:3f:ac:5e:21:1e:5b:88:70:33:
        a2:e9:5b:4a:29:24:5b:6b:fb:dc:c5:fc:06:12:34:3d:7f:a9:
        75:d1:ff:e3:eb:7d:f9:40:dc:d7:04:19:91:28:dc:d0:a5:15:
        6a:f3:b4:d9:03:f0:bf:02:53:6a:35:ea:1e:09:29:91:8a:6d:
        52:ea:02:30:71:24:cc:c7:51:c3:4e:f7:e9:b6:32:10:03:b4:
        07:e2:9e:75:f2:85:b8:40:6c:50:2f:a1:13:8b:5c:d3:df:c0:
        f0:b8:98:5b:e1:b1:3a:35:09:42:ee:89:2e:8d:3e:04:22:70:
        79:e4:d1:43:f8:b2:e9:e2:90:4b:38:52:13:7a:b5:97:1e:42:
        8b:6c:25:a7:b8:09:f7:41:81:a4:88:e0:5c:e4:59:6e:e6:f2:
        eb:7e:eb:7c:89:d9:76:9e:d2:ec:c8:52:64:2b:93:53:8b:95:
        1b:91:02:f6:04:8c:8f:e7:29:74:9d:8c:bc:e5:ba:cd:71:9b:
        ef:d6:43:4d:5f:67:df:d4:ef:ab:48:ba:5e:91:0b:b0:34:02:
        db:9b:0b:4b:fc:a5:52:11:dd:14:e7:2b:ab:7b:82:b8:3e:ad:
        a3:94:aa:a8:cd:34:34:18:9e:16:1a:03:78:e5:32:a8:db:25:
        5a:83:cf:50:97:15:df:66:fc:76:51:63:c2:6f:ec:ff:fb:05:
        82:0d:45:26:3b:7d:31:f6:1a:1d:8c:98:b6:3a:aa:76:36:64:
        6a:51:e7:74:2e:bf:dd:a2:77:34:f2:04:21:2b:b6:ed:da:20:
        1d:ab:0a:14:d3:31:4a:2f:72:c7:60:a2:5b:1a:2a:fb:4c:0f:
        2e:d7:7d:71:fe:5b:20:c8:53:89:19:0f:61:77:25:b0:65:95:
        08:e6:49:85:c8:7b:91:5b:aa:6b:7f:a4:19:b5:ba:59:62:b1:
        aa:0a:89:e1:7c:12:bc:75:1c:d8:2d:4a:86:8d:7d:3a
-----BEGIN CERTIFICATE-----
MIIKbDCCBlSgAwIBAgIBATANBgkqhkiG9w0BAQ0FADAmMRAwDgYDVQQKDAd0ZXN0
aW5nMRIwEAYDVQQDDAlDQSBTZXJ2ZXIwHhcNMjMwNTEyMTgxMjA5WhcNMzMwNTA5
MTgxMjA5WjBOMRAwDgYDVQQKDAd0ZXN0aW5nMRQwEgYDVQQDDAt3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HvlPy6KnzLr+dQvnWBKMv6
SWpByenK4R2geY+kSWxxGiS7DyXwBW1fFhXMPUlLF7To2TfrodkYWS9YyQ32UE6e
vIPb7ugaQrNj0irbaAl9z4HQ5dwqtrHjnh/Z4w+Gnyb/OLJz3RIvSzdUAp8Js3Jn
DxPxtMFeUOYwFQVqHZ3cPnpdFCSDOzcMZy89QhLAagY2vZQIhvVIUrQA21830hul
5LKVyqLgesCeztWO0SFV
-----END CERTIFICATE-----

Error logs

19:20:13.797 Updating option syncServerHost to https://hostname-redacted.lan/trilium/ 19:20:13.799 Updating option syncServerTimeout to 120000 19:20:13.800 Updating option syncProxy to 19:20:13.804 204 PUT /api/options with 0 bytes took 8ms 19:20:13.816 200 GET /api/options with 6339 bytes took 2ms 19:20:15.028 Slow 200 POST /api/sync/test with 143 bytes took 329ms

zadam commented 1 year ago

Hi, you can set NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable to the trilium process, it will then allow self signed certificates.

I'm not sure if it's possible to force the electron process to use the system certificate store.

FalcoGer commented 1 year ago

Thanks, although that's a bit inconvenient. Would it be possible to add that as a checkbox? Or better yet some way to import the CA as trusted?

This is a security concern because globally setting it to allow unauthorized certificates would probably also affect webview. Importing the CA as trusted would be a lot safer.

FalcoGer commented 1 year ago

I started trillium like this, but the error persists.

NODE_TLS_REJECT_UNAUTHORIZED=0 trilium
DB size: 7475 KB
Trusted reverse proxy: false
App HTTP server starting up at port 37840
{
  "appVersion": "0.59.4",
  "dbVersion": 213,
  "syncVersion": 29,
  "buildDate": "2023-04-17T21:40:35+02:00",
  "buildRevision": "1d3272e9f8c27106a66227fbb580677ae5d70427",
  "dataDirectory": "/home/paul/.local/share/trilium-data",
  "clipperProtocolVersion": "1.0",
  "utcDateTime": "2023-05-13T16:33:44.680Z"
}
CPU model: AMD A12-9720P RADEON R7, 12 COMPUTE CORES 4C+8G, logical cores: 4 freq: 1800 Mhz
Listening on port 37840
Becca (note cache) load took 43ms
Registered global shortcut Ctrl+Alt+P for action createNoteIntoInbox
[2178760:0513/183347.557465:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.561388:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264ConstrainedBaseline and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.577868:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.578510:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264Main and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.578776:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.579285:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264High and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.581031:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.581247:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264ConstrainedBaseline and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.581636:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.582289:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264Main and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.582983:ERROR:vaapi_wrapper.cc(1095)] vaCreateConfig failed, VA error: an invalid/unsupported value was supplied
[2178760:0513/183347.585342:ERROR:vaapi_wrapper.cc(1070)] FillProfileInfo_Locked failed for va_profile VAProfileH264High and entrypoint VAEntrypointEncSlice
[2178760:0513/183347.630266:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
Generated CSRF token m5CTs4dU-av0iB54iOcu1uohv9Cx6E674Kgk with secret _csrf=QYA5KL2am11IvcD7p6vkUDnp; Path=/
200 GET /api/options with 6339 bytes took 2ms
200 GET /api/tree with 52421 bytes took 4ms
200 GET /api/keyboard-actions with 12153 bytes took 2ms
200 GET /api/script/widgets with 2 bytes took 2ms
websocket client connected
200 GET /api/keyboard-shortcuts-for-notes with 2 bytes took 2ms
200 GET /api/note-map/_optionsSync/backlink-count with 11 bytes took 1ms
200 GET /api/options with 6339 bytes took 2ms
200 GET /api/script/startup with 2 bytes took 3ms
Table counts: notes: 757, note_revisions: 871, branches: 772, attributes: 307, etapi_tokens: 0
All consistency checks passed with no errors detected (took 50ms)
[2178713:0513/183352.255126:ERROR:cert_issuer_source_aia.cc(32)] Error parsing cert retrieved from AIA (as DER):
ERROR: Failed parsing Certificate SEQUENCE
ERROR: Failed parsing Certificate

sync failed: Request to GET https://pihole.lan/trilium//api/setup/status failed, error: Error: net::ERR_CERT_AUTHORITY_INVALID
stack: Error: Request to GET https://pihole.lan/trilium//api/setup/status failed, error: Error: net::ERR_CERT_AUTHORITY_INVALID
    at generateError (/usr/lib/trilium/resources/app.asar/src/services/request.js:191:12)
    at ClientRequest.<anonymous> (/usr/lib/trilium/resources/app.asar/src/services/request.js:58:47)
    at ClientRequest.emit (node:events:394:28)
    at ClientRequest._die (node:electron/js2c/browser_init:101:8391)
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:101:7128)
    at SimpleURLLoaderWrapper.emit (node:events:394:28)
    at SimpleURLLoaderWrapper.callbackTrampoline (node:internal/async_hooks:130:17)
Slow 200 POST /api/sync/test with 143 bytes took 315ms

I have also noticed that when I edit the entry in the gnome menu, that it would revert. It would even recreate it if I delete it.

I also noticed this error [2178713:0513/183352.255126:ERROR:cert_issuer_source_aia.cc(32)] Error parsing cert retrieved from AIA (as DER):. The certificate is offered as PEM on the URL. does it need to be DER?

Edit

Where the information is available via HTTP or FTP, accessLocation MUST be a uniformResourceIdentifier and the URI MUST point to either a single DER encoded certificate as specified in [RFC2585] or a collection of certificates in a BER or DER encoded "certs-only" CMS message as specified in [RFC2797].

I'll convert it. silly me.

Edit 2 I did that and reissued the certificate. The failed to parse error is gone, but the cert is still not accepted.

zadam commented 1 year ago

Try setting "noproxy" into the proxy field here:

image

The reasoning is a bit complex, basically electron has 2 network stacks and trilium by default uses the chromium one which doesn't respect the NODE_TLS_REJECT_UNAUTHORIZED. By setting the noproxy you're forcing trilium to use the node's network stack (which is pretty obscure of course) which should respect it.

Some background on electron networking and TLS is here: https://stackoverflow.com/questions/58615762/will-an-electron-based-app-pass-system-wide-nodejs-environment-variables

FalcoGer commented 1 year ago

That worked (after a restart). But I would still consider this a workaround because of the security implications with webview.

Without NODE_TLS_REJECT_UNAUTHORIZED=0 the error message changed to this

Sync server handshake failed, error: Request to GET https://pihole.lan/trilium/api/setup/status failed, error: Error: self signed certificate in certificate chain
zadam commented 1 year ago

But I would still consider this a workaround because of the security implications with webview.

Sorry, I don't get it. What does web view have to do with this?

FalcoGer commented 1 year ago

Sorry, I don't get it. What does web view have to do with this?

If you set NODE_TLS_REJECT_UNAUTHORIZED=0, wouldn't that mean that web view would also accept invalid certificates when it shows content from an https source? Using CAs is a security feature. Whitelisting your own CA if you use one is the proper way to do it. Allowing any self signed certificate is a problem.

FalcoGer commented 1 year ago

I tested it with a webview

#webViewSrc="https://self-signed.badssl.com/" 

It does not load. (but it also doesn't show any errors.) I'd still prefer properly allowing the CA in a whitelist without whitelisting everything for node components.

zadam commented 1 year ago

If you set NODE_TLS_REJECT_UNAUTHORIZED=0, wouldn't that mean that web view would also accept invalid certificates when it shows content from an https source?

AFAIK no, because NODE_TLS_REJECT_UNAUTHORIZED has effect only on the node process network stack (within electron) while web view using the chromium network stack.

ttlttc commented 11 months ago

Try setting "noproxy" into the proxy field here:

image

The reasoning is a bit complex, basically electron has 2 network stacks and trilium by default uses the chromium one which doesn't respect the NODE_TLS_REJECT_UNAUTHORIZED. By setting the noproxy you're forcing trilium to use the node's network stack (which is pretty obscure of course) which should respect it.

Some background on electron networking and TLS is here: https://stackoverflow.com/questions/58615762/will-an-electron-based-app-pass-system-wide-nodejs-environment-variables

strange but it really waorked,thanks! ony use :set NODE_TLS_REJECT_UNAUTHORIZED=0: is still not enough for avoid handshake error