Module: Bundler::CLI::Doctor::SSL::Explanation
Instance Method Summary collapse
- #explain_bundler_or_rubygems_error(error) ⇒ Object
- #explain_net_http_error(error, host, tls_version) ⇒ Object
- #summarize(bundler_success, rubygems_success, host) ⇒ Object
Instance Method Details
#explain_bundler_or_rubygems_error(error) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/bundler/cli/doctor/ssl.rb', line 148 def explain_bundler_or_rubygems_error(error) case error. when /certificate verify failed/ "certificate verification" when /read server hello A/ "SSL/TLS protocol version mismatch" when /tlsv1 alert protocol version/ "requested TLS version is too old" else error. end end |
#explain_net_http_error(error, host, tls_version) ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/bundler/cli/doctor/ssl.rb', line 161 def explain_net_http_error(error, host, tls_version) case error. # Check for certificate errors when /certificate verify failed/ <<~MSG #{show_ssl_certs} Your Ruby can't connect to #{host} because you are missing the certificate files OpenSSL needs to verify you are connecting to the genuine #{host} servers. MSG # Check for TLS version errors when /read server hello A/, /tlsv1 alert protocol version/ if tls_version.to_s == "TLS1_3" "Your Ruby can't connect to #{host} because #{tls_version} isn't supported yet.\n" else <<~MSG Your Ruby can't connect to #{host} because your version of OpenSSL is too old. You'll need to upgrade your OpenSSL install and/or recompile Ruby to use a newer OpenSSL. MSG end # OpenSSL doesn't support TLS version specified by argument when /unknown SSL method/ "Your Ruby can't connect because #{tls_version} isn't supported by your version of OpenSSL." else <<~MSG Even worse, we're not sure why. Here's the full error information: #{error.class}: #{error.} #{error.backtrace.join("\n ")} You might have more luck using Mislav's SSL doctor.rb script. You can get it here: https://github.com/mislav/ssl-tools/blob/8b3dec4/doctor.rb Read more about the script and how to use it in this blog post: https://mislav.net/2013/07/ruby-openssl/ MSG end end |
#summarize(bundler_success, rubygems_success, host) ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/bundler/cli/doctor/ssl.rb', line 199 def summarize(bundler_success, rubygems_success, host) guide_url = "http://ruby.to/ssl-check-failed" = if bundler_success && rubygems_success <<~MSG Hooray! This Ruby can connect to #{host}. You are all set to use Bundler and RubyGems. MSG elsif !bundler_success && !rubygems_success <<~MSG For some reason, your Ruby installation can connect to #{host}, but neither RubyGems nor Bundler can. The most likely fix is to manually upgrade RubyGems by following the instructions at #{guide_url}. After you've done that, run `gem install bundler` to upgrade Bundler, and then run this script again to make sure everything worked. ❣ MSG elsif !bundler_success <<~MSG Although your Ruby installation and RubyGems can both connect to #{host}, Bundler is having trouble. The most likely way to fix this is to upgrade Bundler by running `gem install bundler`. Run this script again after doing that to make sure everything is all set. If you're still having trouble, check out the troubleshooting guide at #{guide_url}. MSG else <<~MSG It looks like Ruby and Bundler can connect to #{host}, but RubyGems itself cannot. You can likely solve this by manually downloading and installing a RubyGems update. Visit #{guide_url} for instructions on how to manually upgrade RubyGems. MSG end Bundler.ui.info("\n#{}") end |