-
Notifications
You must be signed in to change notification settings - Fork 37
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
Set OPENSSL_CONF to use the config from OpenSSL 1.1.1 if the OpenSSL … #93
base: main
Are you sure you want to change the base?
Conversation
…version is higher than 1.1.1 to fix PhantomJS
This doesn't compile on my Mac. Is it necessary to include compiled code?
Also, regarding your comment in #90 (comment), I don't think it makes sense to run PhantomJS with the new config on all platforms, if it's not needed. That just increases the risk of problems. Just a note: I'm occupied with other projects these days and don't have much time to test this stuff out on all relevant platforms, so it will be hard for me to evaluate big changes like this. |
The error arises because the build needs openssl headers to be installed on the machine and visible to the linker. (Could be fixed by modifying the appveyor.yml to pre-install openssl for Mac OS and Windows.) The change which breaks PhantomJS is the removal of RANDFILE from the config. It is easily visible in this commit. The workaround is:
Alternatively, I could avoid using compiled code if I used openssl::openssl_config()$version to get the OPENSSL_VERSION_TEXT. However, version comparison then becomes harder as the variable is a string (1.1.1-preX vs 1.1.1d vs 1.1.1). OPENSSL_VERSION_NUMBER on the other hand is a strictly increasing integer and easier to compare. |
I realize that one can install the OpenSSL headers on their own system to get this to compile. The issue is that most people don't have them installed, and so this won't build on their systems. Most people on Mac and Windows install binary packages from CRAN, so they wouldn't be directly affected by this. However, I don't believe that CRAN's Windows and Mac build systems have those headers installed, because I have experience with other packages that use OpenSSL and have to download the OpenSSL sources as part of the install process. (It's possible I'm wrong about the CRAN build machines, though.) |
I do agree that adding external compiled dependencies introduces more complexity, hence my proposal from above:
If you are fine with that, I can close this PR and open up a new one which does not use compiled code: As for the CRAN build machines I am not sure either. However, openssl also depends on OpenSSL (see openssl/src/info.c) and it is on CRAN already. |
Note that the openssl package:
On Unix-like platforms, the We basically used the same strategy for the websocket package. One thing I wonder about using |
Just to clarify things, my concern is this: most people currently can just do Can you just check the version by running |
This is for anyone who encounters the issue and also to say why the openssl.cnf should be edited instead of introducing a workaround in your package. @wch , feel free to close this PR. Exact cause of the issueIt appears the reason is in the following patch to openssl on Debian: PhantomJS is compiled statically against OpenSSL 1.0.2e (more details on this below), but the OpenSSL lib still tries to load the openssl.cnf from its default location (for windows and other OSes) at runtime (which is good because it allows the users to choose their own settings). Unfortunately, the OpenSSL built with PhantomJS is too old and cannot work with the new config. OpenSSL version used by PhantomJS 2.1.1PhantomJS 2.1.1 actually compiles against a static version of the QT libs which in turn compile against a static version of the OpenSSL libs (https://github.com/ariya/phantomjs/blob/2.1.1/build.py#L161). For the Windows build, OpenSSL version 1.0.2e is used (see here https://github.com/vitallium/phantomjs-3rdparty-win/blob/19051aa97cecdcd3ef8c8862e36a3cb4cd3471fc/openssl/include/openssl/opensslv.h#L33). For Mac OS and other Unix based OSes, it depends on the OpenSSL version which was installed on the machine used to build PhantomJS. My guess is that those builds should also use OpenSSL 1.0.2e, but there is no easy way to tell as (AFAICT) PhantomJS does not expose an API to the OpenSSL version it uses. It boils down to the OpenSSL config
Indeed, the openssl.cnf (supplied with OpenSSL 1.1.1d which is the latest stable version at the time of writing) I have on my Ubuntu machine does not enforce TLSv1.2 as a minimum and thus PhantomJS runs just fine. That said, I can easily reproduce the error by simply applying the changes from the patch. As for the PR
To clarify, given that PhantomJS is not actively maintained anymore and it uses OpenSSL 1.0.2e, it is unrealistic to expect that the user's system openssl will also be at the same version. I think that it makes more sense to change the openssl.cnf locally than to provide any workarounds in your package. It is likely that a future version of OpenSSL will alter the default config beyond what PhantomJS 2.1.1 (the last release before project maintenance ended) can work with, but it should be up to the end users to decide what they should do in that case:
That said, you could add a warning just before calling the phantom process to let the user know: warnAboutNewerSSLConf <- function() {
ssl_executable <- Sys.which("openssl")
if (ssl_executable == "") {
# check SSL default installation dirs to determine the path to the ssl binary/exe:
# Mac OS: see phantomjs build script: https://github.com/ariya/phantomjs/blob/2.1.1/build.py#L216
# Win: https://github.com/openssl/openssl/blob/c08dea30d4d127412097b39d9974ba6090041a7c/NOTES.WIN
# Unix: https://github.com/openssl/openssl/blob/c08dea30d4d127412097b39d9974ba6090041a7c/NOTES.UNIX
ssl_executable <- "..."
}
ssl_ver <- system(sprintf("%s version -v", ssl_executable), intern = T)
if (grepl(pattern = "^OpenSSL", x = ssl_ver, perl = T)) {
match <- regexpr(pattern = "\\d(\\.\\d){2}", text = ssl_ver, perl = T)
ssl_ver_num <- substring(ssl_ver, match, match + attr(match, "match.length") - 1)
if (compareVersion(ssl_ver_num, "1.0.2") == 1L) warning(sprintf("Your current OpenSSL version (%s) is higher than the one used to build PhantomJS.", ssl_ver))
}
} |
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details. Reviewed-By: Alexander Bokovoy <[email protected]>
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details.
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details. Reviewed-By: Alexander Bokovoy <[email protected]>
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details. Reviewed-By: Alexander Bokovoy <[email protected]>
WebUI unit tests fail with: ``` PhantomJS threw an error:ERROR >> Auto configuration failed 0 [ >> 'Auto configuration failed', >> '140613066520384:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory', >> '140613066520384:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:', >> '140613066520384:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf', >> '140613066520384:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf' >> ] ... Warning: PhantomJS exited unexpectedly with exit code 1.� Use --force to continue. Aborted due to warnings. ``` See wch/webshot#93 for details. Reviewed-By: Alexander Bokovoy <[email protected]> Reviewed-By: Alexander Bokovoy <[email protected]>
…version is higher than 1.1.1 to fix PhantomJS