Skip to content

Commit

Permalink
Use a sandboxed openssl.cnf file for phantomjs
Browse files Browse the repository at this point in the history
Debian buster ahs changed /etc/ssl/openssl.cnf far enough that the
openssl built into phantomjs can't parse it.  I found this out by
stracing a test run and watching it access /etc/ssl/openssl.cnf.  We
want bazel to not rely on anything outside the sandbox.  The error that
is returned otherwise is:

140302110000960: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
140302110000960:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140302110000960:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
140302110000960:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf

Fixes: bazelbuild#351
  • Loading branch information
AustinSchuh committed Apr 2, 2019
1 parent cf1e44e commit a932350
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions third_party/openssl/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
licenses(["unencumbered"])

filegroup(
name = "files",
srcs = ["openssl.cnf"],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions third_party/openssl/openssl.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# An empty openssl.cnf file seems to be good enough for phantomjs
1 change: 1 addition & 0 deletions third_party/phantomjs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sh_binary(
"//third_party/fontconfig:config",
"//third_party/fontconfig:libfontconfig_k8",
"//third_party/freetype:libfreetype_k8",
"//third_party/openssl:files",
"//third_party/png:libpng_k8",
],
)
Expand Down
1 change: 1 addition & 0 deletions third_party/phantomjs/phantomjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export OPENSSL_CONF=/etc/ssl/
export FONTCONFIG_PATH="${RUNFILES}/third_party/fontconfig"
export XDG_DATA_HOME="${RUNFILES}"
export XDG_CACHE_HOME="$(mktemp -d "${TMPDIR:-/tmp}/fontcache.XXXXXXXXXX")"
export OPENSSL_CONF="${RUNFILES}/third_party/openssl/openssl.cnf"

"${RUNFILES}/third_party/phantomjs/bin/phantomjs" "$@"
rc="$?"
Expand Down

0 comments on commit a932350

Please sign in to comment.