本文介绍了无法验证证书 - 请设置'ENV ['SSL_CERT_FILE'] = path_to_file'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Carrierwave上传文件的Rails 4应用程序。安装Fog将文件上传到Amazon 3后,上传文件时我开始收到以下错误:

  Excon :: Errors :: SocketError in VideosController#create 

无法验证证书,请设置`Excon.defaults [:ssl_ca_path] = path_to_certs`,`ENV ['SSL_CERT_DIR'] = path_to_certs`,`Excon.defaults [:ssl_ca_file ] = path_to_file`,`ENV ['SSL_CERT_FILE'] = path_to_file`,`Excon.defaults [:ssl_verify_callback] = callback`(参见OpenSSL :: SSL :: SSLContext#verify_callback)或`Excon.defaults [:ssl_verify_peer] = (不安全)。

我很困惑,因为我已经将SSL_CERT_FILE添加到我的环境路径(在用户和系统变量通过控制面板),将其设置为c:/RailsInstaller/cacert.pem(并重新启动计算机)。



当我的控制器调用@ video.save in controllers / videos_controller:

  class SessionsController< ApplicationController 

def create
@video = Video.new(video_params)
if @ video.save
redirect_to videos_path,notice:Video has been uploaded。
else
呈现新
结束
结束


私人

def video_params
params.require(:video).permit(:name,:attachment)
end

end

我在Windows 7上使用ruby 1.9.3p484和RubyGems 2.2.2。有人可以帮助我了解这个错误的原因以及如何解决这个错误?

解决方案

使用 RVM 修复 SSL 证书



最近版本的 RVM Ruby版本管理器,包含诊断和解决由过期证书文件导致的错误的实用程序。有关说明和建议,请参阅安装Rails文章。 RVM 网站介绍如何安装RVM。



如果您已经安装了 3RVM ,尝试这样:

  $ rvm -v 
#rvm 1.19.1(stable)
$ rvm osx-ssl-certs status全部

$ rvm的证书osx-ssl-certs更新全部
#更新证书

有关更多问题,请参阅


I have a Rails 4 application that uses Carrierwave to upload files. After installing Fog to upload files to Amazon 3, I started getting the following error when uploading files:

Excon::Errors::SocketError in VideosController#create

Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `ENV['SSL_CERT_DIR'] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, `ENV['SSL_CERT_FILE'] = path_to_file`, `Excon.defaults[:ssl_verify_callback] = callback` (see OpenSSL::SSL::SSLContext#verify_callback), or `Excon.defaults[:ssl_verify_peer] = false` (less secure).

I'm confused because I have added 'SSL_CERT_FILE' to my environment paths (under both user and system variables via the Control Panel), setting it to c:/RailsInstaller/cacert.pem (and restarted my computer).

The error is coming up when my controller calls @video.save in controllers/videos_controller:

class SessionsController < ApplicationController

def create
  @video = Video.new(video_params)
  if @video.save
    redirect_to videos_path, notice: "Video has been uploaded."
  else
    render "new"
  end
end


private

def video_params
  params.require(:video).permit(:name, :attachment) 
end

end

I'm on Windows 7, using ruby 1.9.3p484 and RubyGems 2.2.2. Can somebody help me understand the cause of this error and how to fix it?

解决方案

Use RVM to Fix SSL Certificates

Recent versions of RVM, the Ruby Version Manager, include a utility to diagnose and resolve errors caused by outdated certificate files. See the article Installing Rails for instructions and advice. The RVM website explains how to install RVM.

If you have installed 3RVM, try this:

$ rvm -v
 # rvm 1.19.1 (stable)
$ rvm osx-ssl-certs status all
 # Certificates for
$ rvm osx-ssl-certs update all
 # Updating certificates

For more on the issue, see a discussion at https://github.com/rvm/rvm/pull/1764

这篇关于无法验证证书 - 请设置'ENV ['SSL_CERT_FILE'] = path_to_file'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 06:07