lieser / dkim_verifier

DKIM Verifier Extension for Mozilla Thunderbird
MIT License
213 stars 36 forks source link

Using libunbound results in an internal error #385

Closed ghost closed 11 months ago

ghost commented 1 year ago

I get an internal error when using libunbound by following the instructions in the wiki (https://github.com/lieser/dkim_verifier/wiki/DNS). The JavaScript DNS library works fine with the same settings.

My system configuration:

What I have already tried:

lieser commented 1 year ago

Could you please enable the advance logging in the settings and post the output of the debug log (https://github.com/lieser/dkim_verifier/wiki/Debug#view-error-and-debug-messages)? It would be important to see the log for the first verified message after the start of TB or the DNS settings are reconfigured.

Hopefully this will give a hint on what is going wrong. Otherwise this will be really hard to debug.

ghost commented 1 year ago
OperationError: PathUtils.join: Could not append to path: NS_ERROR_FILE_UNRECOGNIZED_PATH libunbound.js:130:23
    path jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:130
    map self-hosted:221
    load jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:126
    configure jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:398
    result resource://gre/modules/ExtensionParent.sys.mjs:1144
    withCallContextData resource://gre/modules/ExtensionParent.sys.mjs:627
    result resource://gre/modules/ExtensionParent.sys.mjs:1143
    withPendingBrowser resource://gre/modules/ExtensionParent.sys.mjs:637
    result resource://gre/modules/ExtensionParent.sys.mjs:1142
    callAndLog resource://gre/modules/ExtensionParent.sys.mjs:1095
    recvAPICall resource://gre/modules/ExtensionParent.sys.mjs:1141
    AsyncFunctionNext self-hosted:852
DKIM_Verifier.Verifier  FATAL    Error during DKIM verification: Error: An unexpected error occurred verifier.mjs.js:1447:8
    #handleException moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1447
    #processSignatures moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1489
lieser commented 1 year ago

@sanyazuev151 Could you please post the path you configured?

lieser commented 1 year ago

Note that in TB 115 there seems to be an issue with the Path relative to profile directory option, if the relative path contains a folder.

What works for me as a workaround for now:

@sanyazuev151 You initially reported that you also tried it also with an absolute path, and for you it did not work. Can you please try again if you can reproduce it, and if yes post the error in the logs together with the used path?

ghost commented 1 year ago

In the first log, the path was set to extensions/libunbound-8.dll with Path relative to profile directory enabled following the instructions in the wiki.

Following your workaround and moving the DLL directly to the profile folder, the path was set to libunbound-8.dll with Path relative to profile directory enabled:

Error in libunboundWorker: libunboundWorker: Error: error in ub_ctx_set_fwd: syntax error. errno: 0; subType: DKIM_DNSERROR_UNKNOWN; stack: update_ctx/<@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:448:10
update_ctx@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:446:14
onmessage@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:493:16
libunbound.js:263
    #onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:263
    onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:96
DKIM_Verifier.Verifier  FATAL    Error during DKIM verification: Error: An unexpected error occurred verifier.mjs.js:1447:8
    #handleException moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1447
    #processSignatures moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1489

With the DLL remaining in the profile folder, the path was set to C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/libunbound-8.dll with Path relative to profile directory disabled:

Error in libunboundWorker: libunboundWorker: Error: error in ub_ctx_set_fwd: syntax error. errno: 0; subType: DKIM_DNSERROR_UNKNOWN; stack: update_ctx/<@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:448:10
update_ctx@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:446:14
onmessage@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:493:16
libunbound.js:263
    #onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:263
    onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:96
DKIM_Verifier.Verifier  FATAL    Error during DKIM verification: Error: An unexpected error occurred verifier.mjs.js:1447:8
    #handleException moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1447
    #processSignatures moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1489
lieser commented 1 year ago

The second error looks like another unrelated problem. The libunbound dll is successfully loaded, but it fails to set the manually configured DNS servers.

Can you post what you have set as the DNS servers?

ghost commented 1 year ago

I use https://github.com/DigitaleGesellschaft/DNS-Resolver.

lieser commented 1 year ago

I meant the exact string you configured. This has to be a IP4 or IP6 address. What you currently have configured there does not follow the expected syntax, looking at the link you provided probably because you set an URL.

Also note that although unbound seems to support both DNS over TLS (DoT) and DNS over HTTPS (DoH), I never tested it with the addon. And I don't think the build of the libraries I provide at https://github.com/lieser/libunbound-builds even include this support. So you probably need to configure a normal DNS server.

ghost commented 1 year ago

I tested all of the IP addresses listed on the project page, as well as Google's, Cloudflare's and my ISP's default DNS address. They all produce the same error as previously mentioned.

d4k0 commented 1 year ago

I had the same problem when I updated to Thunderbird 115 a few days ago. For me using the absolute path (and unchecking Path relative to profile directory) worked.

Another important note: It only worked with the build of the library from https://github.com/lieser/libunbound-builds, the official build (I tested the latest version 1.18.0) somehow didn't work.

lieser commented 1 year ago

I just tried again to reproduce the problem of ub_ctx_set_fwd: syntax error and was unable to do so. Using Thunderbird version 115.2.2 (64-bit) and the dll from https://github.com/lieser/libunbound-builds/releases/download/v1.17.1/libunbound_release-1.17.1_64-bit.zip.

Please try the following:

  1. Remove all the input for the manually configured DNS servers
  2. Enable getting the DNS servers from the OS
  3. Try verifying an e-mail
    1. This should work, unless your OS configured DNS servers for some reasons do not work.
    2. It should defiantly not result in the ub_ctx_set_fwd: syntax error error, as this is only called if something is configured for the manually set DNS servers.
  4. Disable getting DNS servers from the OS
  5. Set the DNS servers to exactly 8.8.8.8, and nothing more.
  6. Try again to verifying an e-mail

If the last part fails again that would be very strange, as the exact same input does not give any error for me.


@d4k0

Another important note: It only worked with the build of the library from https://github.com/lieser/libunbound-builds, the official build (I tested the latest version 1.18.0) somehow didn't work.

I created this builds because in the past unbound stopped providing windows binaries that contained the libunbound dll. But that has seemed to change again. Note that in the official build the libunbound-8.dll dll also depends on the libcrypto-1_1-x64.dll, libssl-1_1-x64.dll and libssp-0.dll dlls, which you need to copy to the same location. It is also best to explizitly load the dependencies to avoid some strange behaviors (https://github.com/lieser/dkim_verifier/issues/170#issuecomment-534318043), so e.g. set the dll path to libcrypto-1_1-x64.dll;libssl-1_1-x64.dll;libssp-0.dll;libunbound-8.dll (of course with the correct absolute paths for the dlls..

ghost commented 1 year ago
Error in libunboundWorker: libunboundWorker: Error: libunbound not correctly initialized (ub_ctx_create missing); subType: DKIM_DNSERROR_UNKNOWN; stack: update_ctx@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:406:9
onmessage@chrome://dkim_verifier_libunbound/content/libunboundWorker.jsm.js:493:16
libunbound.js:263
    #onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:263
    onmessage jar:file:///C:/Users/User/AppData/Roaming/Thunderbird/Profiles/xxxxxxxx.default-release/extensions/dkim_verifier@pl.xpi!/experiments/libunbound.js:96
DKIM_Verifier.Verifier  FATAL    Error during DKIM verification: Error: An unexpected error occurred verifier.mjs.js:1447:8
    #handleException moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1447
    #processSignatures moz-extension://f86688dc-855e-4139-94bf-fa818cc259b4/modules/dkim/verifier.mjs.js:1489
lieser commented 1 year ago

Could you please post the complete log with debugging enabled? At which step did the error occur?

d4k0 commented 1 year ago

@lieser Thanks for the tip with the dlls. I tried it with all dlls at that time, but then I didn't know that you had to disable Path relative to profile directory, so it didn't work either. But your version is better, because everything is linked in one dll.

lieser commented 12 months ago

The issue with the relative path not working in Thunderbird 115 should be solved now. For the other issue I would need more information to investigate further.