Skip to content

Commit 68d5891

Browse files
committed
fix: SSL certificate verification issue
Error message as follows: > error: certificate verify failed (unable to get certificate CRL)
1 parent c3fd7b7 commit 68d5891

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

script/init_environment.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ pre-flight() {
1111
# Installing git package
1212
pacman -S --noconfirm git
1313

14-
# Installing ca-certificates package to avoid SSL issues
15-
pacman -S --noconfirm ca-certificates
16-
update-ca-trust
17-
1814
# Installing openssh package
1915
if [[ -n "${SSH_PRIVATE_KEY}" ]]; then
2016
pacman -S --noconfirm openssh
@@ -58,6 +54,19 @@ init_ruby() {
5854

5955
# debug
6056
ruby -v && bundle version
57+
58+
# Update CA certificates to avoid SSL issues
59+
# See https://github.com/ruby/openssl/issues/949
60+
read -r -d '' UPDATE_SSL_CODE << EOF
61+
require "openssl"
62+
s = OpenSSL::X509::Store.new.tap(&:set_default_paths)
63+
OpenSSL::SSL::SSLContext.send(:remove_const, :DEFAULT_CERT_STORE) rescue nil
64+
OpenSSL::SSL::SSLContext.const_set(:DEFAULT_CERT_STORE, s.freeze)
65+
EOF
66+
UPDATE_SSL_CODE_PATH="${WORKING_DIR}/.rubyopenssl_default_store.rb"
67+
echo "${UPDATE_SSL_CODE}" > ${UPDATE_SSL_CODE_PATH}
68+
export RUBYOPT="-r${UPDATE_SSL_CODE_PATH} $RUBYOPT"
69+
6170
}
6271

6372
pre-flight && init_ruby

0 commit comments

Comments
 (0)