Skip to content

Replace openssl with libressl in Alpine Images #106

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions 2.1/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.1.10
ENV RUBY_DOWNLOAD_SHA256 5be9f8d5d29d252cd7f969ab7550e31bbb001feb4a83532301c0dd3b5006e148
ENV RUBYGEMS_VERSION 2.6.8

ADD patch/ruby-randegd.patch /tmp/ruby-randegd.patch

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
# readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
Expand All @@ -34,8 +36,8 @@ RUN set -ex \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
libressl \
libressl-dev \
procps \
readline-dev \
ruby \
Expand All @@ -62,6 +64,9 @@ RUN set -ex \
} > file.c.new \
&& mv file.c.new file.c \
\
&& patch -p0 < /tmp/ruby-randegd.patch \
&& rm /tmp/ruby-randegd.patch \
\
&& autoconf \
# the configure script does not detect isnan/isinf as macros
&& ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
Expand All @@ -80,7 +85,7 @@ RUN set -ex \
bzip2 \
ca-certificates \
libffi-dev \
openssl-dev \
libressl-dev \
yaml-dev \
procps \
zlib-dev \
Expand Down
44 changes: 44 additions & 0 deletions 2.1/alpine/patch/ruby-randegd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git ext/openssl/extconf.rb ext/openssl/extconf.rb
index c2fc8b0..39e091d 100644
--- ext/openssl/extconf.rb
+++ ext/openssl/extconf.rb
@@ -87,6 +87,7 @@ have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
have_func("PKCS5_PBKDF2_HMAC")
have_func("PKCS5_PBKDF2_HMAC_SHA1")
+have_func("RAND_egd")
have_func("X509V3_set_nconf")
have_func("X509V3_EXT_nconf_nid")
have_func("X509_CRL_add0_revoked")
diff --git ext/openssl/ossl_rand.c ext/openssl/ossl_rand.c
index abd1809..63c3c20 100644
--- ext/openssl/ossl_rand.c
+++ ext/openssl/ossl_rand.c
@@ -125,6 +125,8 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE len)
return str;
}

+#ifdef HAVE_RAND_EGD
+
/*
* call-seq:
* egd(filename) -> true
@@ -158,6 +160,7 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
}
return Qtrue;
}
+#endif /* HAVE_RAND_EGD */

/*
* call-seq:
@@ -195,8 +198,10 @@ Init_ossl_rand()
DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
+#ifdef HAVE_RAND_EGD
DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+#endif /* HAVE_RAND_EGD */
DEFMETH(mRandom, "status?", ossl_rand_status, 0)
}

6 changes: 3 additions & 3 deletions 2.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ RUN set -ex \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
libressl \
libressl-dev \
procps \
readline-dev \
ruby \
Expand Down Expand Up @@ -80,7 +80,7 @@ RUN set -ex \
bzip2 \
ca-certificates \
libffi-dev \
openssl-dev \
libressl-dev \
yaml-dev \
procps \
zlib-dev \
Expand Down
6 changes: 3 additions & 3 deletions 2.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ RUN set -ex \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
libressl \
libressl-dev \
procps \
readline-dev \
ruby \
Expand Down Expand Up @@ -80,7 +80,7 @@ RUN set -ex \
bzip2 \
ca-certificates \
libffi-dev \
openssl-dev \
libressl-dev \
yaml-dev \
procps \
zlib-dev \
Expand Down
6 changes: 3 additions & 3 deletions 2.4/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ RUN set -ex \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
libressl \
libressl-dev \
procps \
readline-dev \
ruby \
Expand Down Expand Up @@ -80,7 +80,7 @@ RUN set -ex \
bzip2 \
ca-certificates \
libffi-dev \
openssl-dev \
libressl-dev \
yaml-dev \
procps \
zlib-dev \
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ RUN set -ex \
linux-headers \
make \
ncurses-dev \
openssl \
openssl-dev \
libressl \
libressl-dev \
procps \
readline-dev \
ruby \
Expand Down Expand Up @@ -80,7 +80,7 @@ RUN set -ex \
bzip2 \
ca-certificates \
libffi-dev \
openssl-dev \
libressl-dev \
yaml-dev \
procps \
zlib-dev \
Expand Down