-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Possible BUG] Docker: Non Functional Certificate OCSP Certificate Revocation Check #2667
Comments
I was concerned that my local Docker environment (macOS on an M1, running Rancher Desktop) might have influenced the results, as the image's platform (linux/amd64) does not match the host platform (linux/arm64/v8). So I tested also on another Docker host (Debian x86_64) and successfully reproduced the behavior described above. So I expect that the examples should be reproducible as they are. |
Sigh... apparently, this is one of those cases where it's easy to kill hours. I have unsuccessfully tried to recreate the issue without using the official docker container. I started by compiling openssl-1.0.2.bad myself from source — when testing everything was alright. Next I rebuilt the docker container according to the instructions (whether based on opensuse or alpine) - everything was ok. Even when using the native OpenSSL version which is shipped within the container - everything just works as it should: docker run --rm drwetter/testssl.sh:3.2 --openssl /usr/bin/openssl --phone-out -S revoked.badssl.com What I could not figure out is how exactly replicating the build process for the Docker images you provide at Docker Hub. I don't want to look too far into it, or I might not see the daylight again 😅. Hence the following just as a gut feeling: Could it be that the binary was not built with nsswitch in mind? The reason I ask is because it behaves exactly as I would have it expected 15 or maybe even 20 years in the past. To sum up: I think the true nature of the issue is not testssl.sh itself, not even with openssl-1.0.2.bad in general, but it has something to do with the way how /home/testssl/bin/openssl.Linux.x86_64 is build and than shipped. It seems the issue is only traceable when using the precompiled openssl-1.0.2.bad binaries. After going down deep this rabbit hole, I think this issue here is a possible duplicate of #2516 At least - now it can be replicated easily - by using the official docker containers. |
Thanks for reporting. In fact the segfault smells a bit like #2516 . However the docker container for 3.2 doesn't contain any dubious name service switch which we blamed #2516 for (see comment).. The host here runs Debian 12: To my dismay ;-) the (/a?) segfault happened also there (dmesg: Can´t tell yet whether it is the same problem or something different.
Yes, that wasn't statically compiled and is in line with the base image. If I understood you correctly, compiling openssl-bad by yourself and copying it into the container, it didn't segfault, right? If so: did you compile it with the script, so that you had a static binary? |
The segfault happens under Debian 12 host also with the new binary *) within the container. *) for testing see https://testssl.sh/contributed_binaries/openssl.Linux.x86_64 |
…ne-out (3.0) As `--phone-out` sometimes doesn't work with our binary we switch transparently/automagically to the vendor support openssl binary -- if available. This is the PR for 3.0, for 3.2 see #2695 . This fixes at least #2516 where the issue has been explained/debugged in detail. See also #2667 and #1275.
FYI @lwillek : The segfault is gone but it still says error querying OCSP responder |
Before you spend additional time on this @lwillek : I spotted the problem and will provide a fix ~tommorow. |
It is a pleasure. Thank you - for picking, digging into, and implementing a workaround until the static binary has been newly compiled. (or whatever the final fix will be)
Hehe, too late. Time spend already, as my (way too long) comment was almost completed 😁 ... deleted. Good to know that you found something! I can't wait to see what the reason was. I am happy to test tomorrow! |
The last problem was me 😄 and you'll see in the PR later. The original problem was that a static binary with glibc has some problems with gethostbyname(3) which only seems only seems to happen when using ocsp queries with an URL. That's not fixable . Workaround is #2695. |
So true 🤡 - unsolvable when trying to statically compile with glibc. I learned that too the hard way yesterday. My yesterday's journey made me realize that I haven't done enough compiling myself in the last 10 years, but that's another story. I ended up this night in attempting to compile The musl libc is designed to facilitate static linking and for compatibility with standard C functions, including getaddrinfo. So it seemed to me worth a try. And when successful, also a good solution which addresses the underlaying core issue. On distributions like Alpine Linux musl is the default C library, so I ended up using ...But then I stopped my attempt (and also the comment yesterday evening), as you found a solution. The workaround #2695 is fine. Thanks again. |
you're welcome! We had Alpine docker images with musl libc now only in 3.0 (where also you encountered the issue). There were performance issues which got better when upgrading the Alpine version. Also IIRC there were issues when using glibc binaries, like other projects encountered. So to me musl libc could have been a solution, but OTOH we might run into other problems. Thus, the easiest solution is from >=3.3dev on to use any vendor supplied openssl binary as the primary one. |
FYI: Fixed now. Also there's a unit test which warns when there's a similar problem again |
Hello @drwetter
I think I found a possible bug when checking the certificate revocation status when using docker. The OCSP check did not succeed for me as expected, resulted in incorrect outputs and too high ratings in case a certificate has been actually revoked.
To exclude any issues with my own certificates or my own environment, I ended up using the
revoked
example from badssl.com, and tested with the Docker images you provide at Docker Hub. I could reproduce the issues I have seen on my local environment.Short Issue Description
Expected Behavior: Version
3.1dev
The expected behave is seen when using the older
drwetter/testssl.sh:3.1dev
docker container:Actual Behavior: Version
3.2
This version throws a "Segmentation fault" as well.
Actual Behavior: Version
3.0
I could reproduce the issue there as well:
Additional Information
This is how I tested manually. The only reason here to use the docker image is to exclude any local configuration issues on my end.
The text was updated successfully, but these errors were encountered: