Bug in OpenSSL : Timestamping error #242
Comments
Hello, Please provide more informations:
Can you provide us with a timestamped pdf and a token so we can try to reproduce ? |
Hi Nicolas,
OS: Archlinux x86_64, Kernel 4.5.1 Best regards, Alex |
Yep, I can confirm too, weird, because it was working fine before, and I don't think I changed anything. Can you confirm it works in 1.1.8-p2 ? Because if I do a git checkout 1.1.8-p2, it still doesn't work. Or even 1.1.8. And it was working in alpha, because I tested it a few days ago. Could it be a problem on DFN side ? |
Yep you're right. Downgrading doesn't help, even a fresh install of anything down to 1.1.7 doesn't help.
I'll check if they've changed anything regarding their certificate chain. |
Yeah thanks, it'll be easier for you (language-wise). |
Responding to the request for more information: Installed version: 1.1.8-p2 I didn't customize -- followed the directions at doc/_build/html/install-drop.html |
Just a quick update: The certificate chain is unchanged (aka "the good news") and I can reproduce the faulty behavior with OpenSSL on on the command line level. The bad news is that we're probably hitting an OpenSSL issue first noticed back in 2013: The summary is that OpenSSL can't digest TS replies well if attribute certificates are added to them. This scenario (although conformant to the rfc3161) is not supported by OpenSSL. My best guess is that the guys at DFN changed the way their TS replies are formed (software update, etc.). I'll try to get in contact with them to figure out if they are able (and willing) to fix their service for OpenSSL users again. There's absolutely nothing we can do in the meantime (aka "the really bad news"). The consequences are that any timestamps generated before DFN broke for us will still validate because the stored binary responses are ok for OpenSSL, but you will not be able to generate new ones. I'll report back as soon as I get a response from the DFN. Cheers, |
Yep, thanks for the update Athemis, I saw the page you linked before. |
I got an answer from the DFN. They are aware of the issue. A patched openssl should work again without any problems in combination with the DFN service. Until the patch is mainlined you have to patch openssl yourself. Furthermore they are developing a small java program to verify RFC3161 timestamps and will publish it when it's ready. The release will be announced here: https://blog.pki.dfn.de Our options are:
Cheers, EDIT: To be more precise what the DFN changes mean: They are enforcing at least SHA256 hashes throughout the whole timestamping prodecure including the fingerprints of the signing certificate. In OpenSSL this is hardcoded to SHA1 and that's why it fails. |
Ok thanks Athemis for this information. I think we'll go with option 1. And maybe I can disable the verification step in timestamping until openssl is patched. And show a message referencing this issue. |
I would opt for keeping the verification functional. There is no point in timestamping if the timestamps are not verified. This issue is not present for all TSAs but only for those who add attribute certificates. We can catch the error message from openssl and display a more meaningful error instead, pointing out that the timestamp cannot be validated because of shortcomings in openssl and suggesting the user to install a patched openssl version or (when mainlined) urging to update to a recent openssl version. Imho that's more transparent then just pretending everything is fine although no verification is done at all. |
I agree the problem might not arise for another TSA, but I highly doubt people are using something else than the default… Now I agree that timestamping without actually verifying is useless, so I'll do what you suggest, catch this specific error and display a message :) |
The DFN published their java tool for timestamp verification and also put up a site explaining in detail what changed and why openssl is currently broken in this context. |
Yep, I was able to verify an old token with their tool. So the question is : do we introduce this tool as a failsafe for validating the token ? This would allow to continue timestamping until the bug in openssl is fixed, what do you think ? |
Taking into account that openssl is not known for merging pull requests very fast (especially the timestamping subsystem doesn't seem to get much love from the devs) this sounds to me like a good idea. We just need to make sure to mention somewhere in the documentation that if the verification fails and one wants to use this fallback mechanism, a functional java installation is required. |
Yep, I'll do that. |
So for now, the java validator works on my machine. Didn't work in the docker image for some reason... I was thinking to include the patched version of openssl with elab. I guess it should work. I'll see about that :) |
Works as well on my machine. Well done! |
As openssl is installed on most machines, and as it is already a requirement for elabftw, I don't need to build a static binary, because libs should be there! Also, I'm pretty sure 99.5% of people are on x86_64 arch. I'll still try, and maybe give up after failing to compile openssl :p |
I don't manage to validate with the patched version anyway... Verification: FAILED
140165594154648:error:2F064067:time stamp routines:ts_check_imprints:message imprint mismatch:ts_rsp_verify.c:675: |
Ok so now the validation of timestamps works in docker also. \o/ I'll soon release 1.2.0 so that users can continue to timestamp their experiments. |
Hello, I've been struggling for some time with this problem. Could you please tell me how did you solve it? Applying a patch? Using DFN Java verification tool? I talking about: System command failed: 139639965218464:error:2F067065:time stamp routines:TS_CHECK_SIGNING_CERTS:ess signing certificate error:ts_rsp_verify.c:291:, Verification: FAILED” Could you help me I'm not expert enough to apply a patch myself or install the java DFN Java verification without any hint. |
Hello, Please try the latest BETA version, it works with Java to validate the timestamps. You can |
You're talking about patching Openssl right? not using the DFN Java client. I'm not sure. I'm in ubuntu 14.04, I cloned git My Openssl version: |
No, I'm talking about using the beta version of elabftw, which uses the Java client to validate timestamps. |
Would you be so kind to tell me which are the steps I should perform. I really don't understand what should I do. This is my best guess, please correct me:
|
Hello, The only difference I see is the call to « bash » to launch the script. Have you tried to just invoque ./verify.sh with same parameters ? Does-it change anything ? As Java can’t find the file, I guess everything is OK in the script but maybe a privilege is missing somewhere ?
|
Yeah, I didn't spot something obvious either... BTW, to get rid of «it worked in preprod, but not in prod», use Docker, it rocks ;) |
@typepub, this is what happens if i remove the "bash" or "sh": ubuntu@certifydoc04:/tmp/timestampverifier$ ./verify.sh /tmp/tsq.tsq /tmp/tsr.tsr /tmp/ChainZeitstempel.pem Maybe the bash has a problem? @nicolas, I'm using a VM image in the Openstack infrastructure, same image to start but then they cannot be synchronized and overtime they diverge, also because they run Wordpress and its MySql database that is hoghly dependent on the main website URL. |
@MarioScalabrino remove windows line ending (^M) !!! |
Buff, that was it, solved. Almost 4 days for that silly thing. |
ahah I knew it ! :D |
Great suggestion, I will take it very seriously now, sooo much time for such a minor thing. I'm using Sublime text build 3103 and the Netbeans IDE 8.1 patch 1. Do you know how to do that things you suggest in Sublime text and Netbeans for Ubuntu 14.04? |
You can use this one : https://github.com/SublimeText/TrailingSpaces |
Great thanks, tomorrow I'll install them. |
Hi, not all of use have "real" server, so for those who host elabFTW on a standard shared hoster, but still want to somehow time stamp, these service works: It is only freely available for 5 ts per day, but if you have a bigger group, you probably should invest in a real server anyway. Regards, PS: I am not affiliated in any way with above mentioned service. |
Why wouldn't it work with the default TSA on your shared server? Thanks for the tip anyway @gebauer :) I added it to the documentation. BTW, you should use https://tsa.safecreative.org instead of the http address! |
Because of the openSSL bug? |
Just as a follow up, the patch has been merged to master and I could verify a timestamp with openssl from master. Hopefully the next release will contain this patch \o/ |
Hy, I got the again the error : I installed a new instance on a private shared host (Dreamhost). I checked if java was installed, as it seems to be the issue, and the command
I could go for the safecreative tsa certificate configuration, but I need more than 5 validation per day. (The labnote is for 20 students working at the same time over university wifi network with the same IP...). Sorry for the noob question. |
Hello, What happens if you just run |
I guessed that the isJavaInstalled() function was doing something like that. When I run the command
|
Ok weird. I don't get why java is not correctly detected… What is |
Yes, I don't understand. |
Try this: 1/ Comment out these lines. So we disable the check (we know it's installed anyway). 2/ (optional) Edit this line and replace java with /usr/bin/java. And try to timestamp. |
I get an |
Can you now check in the logs (either on sysadmin panel or the Apache/Nginx logs)? |
LOGS on sysadmin panel only show the errors when the IsJavaIntalled() function is active
I haven't found the Apache/nginx logs yet... |
On a shared host you might need to go your control panel to acces them. Or maybe you have a "log" folder somewhere at the root dir ? Or maybe you just can't access them. Also, as a curiosity, how much do you pay for your shared hosting? 10$/month for 1Go RAM? Because with DigitalOcean you get twice as much RAM for the same price, and you're root on the machine, and you can install Docker, and you can access the logs, and you can forget about these troubles :p |
No information either on server error log... |
I pay 9.95$/month and have no idea how much RAM is available. But indeed I can't install docker. |
Yeah, probably 1 Go, and it's shared RAM, so cannot be guaranted afaik. With Docker you get the added benefits of not having to worry about php versions, php available extensions, java version, etc… It just works (once it's setup properly ofc). And at DigitalOcean you have a lot of nice little tools at your disposal for making an entire backup and other stuff. Out of curiosity, what php version is it running on? (you can see that in the sysadmin panel) |
php version of the shell:
php version of the site: 7.0 also Yes I have also a docker install on a VM for the lab note at work, and for this one the timespamping works with the default config but not with the SafeCreative certificate. I bothererd you with this also some time ago (issue #435 ). Here its a git install on my shared host for students labnote during practicals (haven't asked for hosting by the university IT this year, I wanted to check first if it was working with the students). Anayway, I am also using my shared host plan for personal blogs, picture gallery, rss agregator and other self-hosted services, so I'm not so eager to change the host... |
I've been looking for other free timestamping services that would work with elabftw. You can get 10 free timestamps per IP with registration on SafeStamper. The certificate is the same as SafeCreative and it works. I tried also FreeTSA (unknown limitation) and got it to work with https://freetsa.org/tsr and their Freetsa CA Certificate: cacert.pem. It will solve my problem for the time being. |
Ok great, I should write documentation for all the different TSA one can use… |
When attempting to timestamp, we have gotten the error below. Can anybody help us out?
System command failed: 139639965218464:error:2F067065:time stamp routines:TS_CHECK_SIGNING_CERTS:ess signing certificate error:ts_rsp_verify.c:291:, Verification: FAILED”
The text was updated successfully, but these errors were encountered: