-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetDiscovery fails: Failed to add certificate to CA store error:0588000B:x509 certificate routines::X509 lib #718
Comments
Hi @g-bougard Version 1.10 is working if the inventory is started from the web UI of the agent, but not from the CLI. here are the logs for version 1.10:
Could it be that NetInventory is using a different client implementation compared to Collect, where #530 has not been fixed? I'm just guessing. Last working version is 1.5. Then 1.6 has a different issue (probably #530). And I couldn't get newer versions to work from CLI. |
Hi @silhusk I don't see any error in the first log, do you mean it just blocks ? Anyway can better you share the output when run from the commandline ? You have to run the command from an administrative console and from the installation folder. You need also to force the task preparation in GlpiInventory plugin just before starting the command.
|
Hi @g-bougard log copied from administrative prompt: glpi-agent_110_cli.log
Yes, exactly. It looks like the first worker that tries to send a result crashes the whole process. Sometimes it prints the error, sometimes not. On the server the task is left in the "execution" state. |
Thank, this output is more useful. I think this should also work if you use |
It does work with |
Hi @silhusk it looks like another problem occurs in your context. I'll try to reproduce, but as it's probably related to multi-threading support on windows and as multi-threading context can really change from one user to another, I've no guaranty to find what's going on. By now, as a work-around, you still can use ssl-fingerprint. But as it seems your server certificate is signed by the Let's Encrypt public CA, this is not a good work-around as you'll have to update it every time the certificate is updated and if I remember well the default expiration for this certificate kind is 3 months. As you use Let's Encrypt public CA on GLPI server, glpi-agent shouldn't really require to extract locally known certificate from Windows keystore. The fix I pointed in my first comment make indeed the keystore export don't expire in multi-threading context. This way glpi-agent http client will use cached exported certificates. But in your log, it seems the error occurs in OpenSSL, when we load cached certificates. So we should manage on your case to disable keystore export. I think you can disable the export by better set Another work-around could also be to implement a new option to define if glpi-agent should load server certificate from keystore. Anyway such an option could also be developed to help users to set which stores section have to be exported. |
Hi @g-bougard thank you for your very kind support. Since the agent 1.10 now works correctly as a service, this issue is just a minor annoyance for me personally.
full glpi-agent_110_ca-cert-dir.txt I confirm that without the
|
Hi @silhusk your url here is probably wrong, but this is not the reason of the error. It should probably be just: I failed to reproduce on friday and I really don't know what happens in your context. Maybe one of the keystore extracted & cached certificates makes the OpenSSL stack to crash/fail. And I won't be able to check that point without the extracted certificates. Anyway, the To know if a possible option to disable the local keystore can help in your context, can you try to remove l.519 & l.520 in Client.pm ? |
Hi @g-bougard removing the lines you indicate doesn't seem to make any difference But if, instead, I change the conditions on l.621 and l.681 to always be false, then it works.
|
I replaced l.621 with I replaced This time it did not crash: glpi-agent_110_cacert.txt Crash traceI got it to run with Visual Studio attached, the crash message is
No-forkWhen setting |
Hi @g-bougard (being back from vacation)
Do you mean everything is working when glpi-agent is running from the service context ? If yes, when running from VS debugger, are you able to check from where DLLs are loaded ? I want you to check if libcrypto-3__.dll can be loaded from a wrong place or if it loads openssl from a wrong place. |
Hi @g-bougard
Sorry, I thought so because the server seems to get some result from time to time. But while the task is scheduled daily, the successful runs are a couple in a month. The rest of the time it reports an error. I cannot tell for sure if the NetDiscovery task is always run. Now I've set log level to debug=2 on the service to try to get a better picture.
It is the one in the agent's install path. I can compile perl for the agent using glpi-agent-extlibs-build.pl, but I cannot figure out how to generate debug symbols. Any suggestion? If you think it can help. |
1.11-git7b8a5f0b is still affected: |
Hello @silhusk I tried to reproduce, but without success. I suspect something is going wrong with one of your certificate in the keystore or maybe with the SSL negotiate with the server itself. I tried to develop a test script to emulate the same comportment: test-certs-for-issue-718.zip Can you extract the script from this archive, copy it to glpi-agent installation folder and run it from an administrative console using the following command:
Of course, you must use your server URL for The script support only I'm curious to know if this is sufficient to reproduce the issue in your case. Here is my own output against my GLPI 10.0.16 test instance for which I require ssl-fingerprint option:
So can you tell me if this simple script reproduces your issue ? And than share the output ? |
Hi @silhusk have you any feedback after my last comment ? Anyway, you may be interested by last d23ad9f commit. It introduces So can you test this new feature using the next nightly build ? |
Hi @g-bougard, sorry for the delay in the response, I was trying to catch up with other things the script does not reproduce the issue: glpi-agent_test-718.txt I'm using the full url, including I modified the test script to add Will try the nightly. But I have a feeling it's more due to threading than certificates. |
Thank you for this feedback. Indeed, the test I asked to run tends more to tell this is not a multi-threading issue and indeed the original error you have is really related to keystore certificates loading. Now you explained you also use basic authentication, maybe this can also be related but I really hope not. Let's wait to see if the new option permits you to use it as work-around. |
This variation of the script does trigger the problem here the respective log: glpi-agent_test-718-mod.txt It is based on NetDiscovery.pm. In particular it uses When run with |
Nightly d23ad9f with |
Nice to hear the new option helps you. About your change on the test script, I don't see error triggered in your log. Did I miss something ? |
It just crashes midway through, no error message. A complete execution would end with each thread having printed
In the log attached to the previous post, please notice the last |
This glpi-agent_test-718-t1nos.txt is a run with errors instead of crash. The first requests go through, but the second child fails. |
Hi @g-bougard okay, thank you for this feedback. By now, I can only suppose Parallel::ForkManager is doing something wrong in this context. And I need to find out what before investigating for a fix. |
Hi @silhusk fyi, just released GLPI-Agent 1.11 which includes the |
Bug reporting acknowledgment
Yes, I read it
Professional support
Yes, I know
Describe the bug
The NetDiscovery task causes the following error:
It seems to crash, and the error message is not always printed. Sometimes it just stops with
The full log with the error: glpi-agent_error.log
With
--no-ssl-check
version 1.9 works fine: glpi-agent_no-ssl-check.log.Version 1.10 doesn't work, even with
--no-ssl-check
, and doesn't print any error.Other tasks (collect, deploy) are working correctly.
To reproduce
glpi-agent.exe --force --debug --debug --task=NetDiscovery
Expected behavior
Operating system
Windows
GLPI Agent version
1.9
GLPI version
10.0.16
GLPIInventory plugin or other plugin version
GLPI Inventory v1.3.5
The text was updated successfully, but these errors were encountered: