Inf*_*mer 5 ssl ruby-on-rails ssl-certificate
我是 ruby on Rails 的新手,在使用此命令创建我的第一个项目时rails new n_project,出现此错误
run bundle install
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see ...
Run Code Online (Sandbox Code Playgroud)
我尝试在 Gemfile 中将 https 更改为 http 并仅执行bundle install,但问题并未解决。而是出现此消息:
Fetching gem metadata from http://rubygems.org/.
Retrying dependency api due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://index.rubygems.org/api/v1/dependencies?gems=rails%2Csqlite3%2Cpuma%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Cbyebug%2Cweb-console%2Ctzinfo-data.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying dependency api due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://index.rubygems.org/api/v1/dependencies?gems=rails%2Csqlite3%2Cpuma%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Cbyebug%2Cweb-console%2Ctzinfo-data.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying dependency api due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://index.rubygems.org/api/v1/dependencies?gems=rails%2Csqlite3%2Cpuma%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Cbyebug%2Cweb-console%2Ctzinfo-data.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see .... To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Run Code Online (Sandbox Code Playgroud)
小智 8
当我在谷歌上搜索同一问题的答案时,出现了你的问题。我刚刚创建了一个新的 Rails 项目,但出现了错误。
remove config/initializers/new_framework_defaults_5_1.rb
run bundle install
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.o
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed forormation about OpenSSL certificates, see bitlylink. To connect without using SSL, edit your Gemfile sources and change 'https
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.o
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed forormation about OpenSSL certificates, see bitlylink. To connect without using SSL, edit your Gemfile sources and change 'https
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.o
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed forormation about OpenSSL certificates, see bitlylink. To connect without using SSL, edit your Gemfile sources and change 'https
Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see bitlylink. To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Run Code Online (Sandbox Code Playgroud)
希望您能够解决您的问题,但我想我会描述为我解决问题的步骤,以防其他人遇到同样的问题。
此解决方案适用于 Windows 10、Ruby 2.3.3、Rails 5.1 和 Git-Bash。
我遵循了这个指南。 https://bundler.io/v2.0/guides/rubygems_tls_ssl_troubleshooting_guide.html#automated-ssl-check
希望未来对 SSL 证书问题的任何更改和解决方案都能在本指南中更新。
首先。编辑 Gemfile 并更改
source 'https://rubygems.org'
Run Code Online (Sandbox Code Playgroud)
到
source 'http://rubygems.org'
Run Code Online (Sandbox Code Playgroud)
根本不起作用。
所以根据指南:
步骤1.运行
curl -Lks 'https://git.io/rg-ssl' | ruby
Run Code Online (Sandbox Code Playgroud)
这只是表明我无法通过 SSL 连接,所以不是特别有帮助。
步骤 2. 更新捆绑程序
gem install bundler
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (httppecs.4.8.gz)
Run Code Online (Sandbox Code Playgroud)
由于 SSL 错误,这也失败了。
步骤 3. 更新 Rubygems。
gem update --system
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
Run Code Online (Sandbox Code Playgroud)
这也失败了。
步骤4.更新系统时钟。是的,不,我在 Windows 上,所以不这样做。
这是事情开始努力解决问题的地方:
步骤 5. 更新 CA 证书。指南要我下载证书文件。
Download the .pem file from this link: GlobalSignRootCA.pem
Run Code Online (Sandbox Code Playgroud)
使用实际指南查找最新的证书链接。我下载了证书文件。
步骤 5.1。在您的安装中查找 RubyGems 证书目录
gem which rubygems
Run Code Online (Sandbox Code Playgroud)
对我来说,目录是 'C:\RailsInstaller\Ruby2.3.3\lib\ruby\2.3.0\rubygems\ssl_certs'
步骤 5.2。我将 GlobalSignRootCA_R3.pem 文件复制到此目录中。
这样做之后我应该按照指南
按照顶部的说明自动更新 RubyGems。
步骤 5.3。因此,在我运行的目录中使用证书文件
gem update --system
ERROR: Interrupted
Updating rubygems-update
Successfully installed rubygems-update-3.2.15
Parsing documentation for rubygems-update-3.2.15
Installing ri documentation for rubygems-update-3.2.15
Run Code Online (Sandbox Code Playgroud)
这需要很长时间而没有任何用户反馈,所以我中断了终端。但它似乎已经做了一些工作。
步骤 5.4。然后,我尝试运行捆绑安装来下载并安装依赖项。
bundle install
Fetching source index from https://rubygems.org/
Resolving dependencies...
Could not verify the SSL certificate for
https://rubygems.org/quick/Marshal.4.8/rails-5.1.7.gemspec.rz.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see a bitly link. To connect
without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Run Code Online (Sandbox Code Playgroud)
但我仍然收到一些 SSL 证书错误。
步骤 5.5。然而,该指南特别提到捆绑程序本身应该更新。所以我这样做
gem install bundler
Successfully installed bundler-2.2.15
Parsing documentation for bundler-2.2.15
Installing ri documentation for bundler-2.2.15
Done installing documentation for bundler after 21 seconds
1 gem installed
Run Code Online (Sandbox Code Playgroud)
并且捆绑程序更新成功。
步骤 5.6。最后,我再次运行捆绑安装,现在开始下载和安装依赖项,没有任何 ssl 错误。
bundle install
Fetching gem metadata from https://rubygems.org/.............
Resolving dependencies......
Fetching rake 13.0.3
Installing rake 13.0.3
Fetching concurrent-ruby 1.1.8
Installing concurrent-ruby 1.1.8
Fetching i18n 1.8.9
Installing i18n 1.8.9
Fetching minitest 5.14.4
Installing minitest 5.14.4
Using thread_safe 0.3.6
Fetching tzinfo 1.2.9
... and so on
Run Code Online (Sandbox Code Playgroud)
额外:安装时出现 sqlite3 错误,已使用此处找到的信息解决了该错误。如何在设置 Ruby on Rails 时安装 SQLite3?
毕竟。它已启动并正在运行。
$ rails server
=> Booting Puma
=> Rails 5.1.7 application starting in development
=> Run `rails server -h` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.12.6 (ruby 2.3.3-p222), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10584 次 |
| 最近记录: |