Heroku的与FTPTLS - 对SSL连接错误(Heroku with FTPTLS - Er

2019-10-16 22:24发布

我试图通过TLS在Heroku上连接到FTP,护栏1.9

Rails的1.9不包括FTPTLS,所以我复制了Rails 1.8 ftptls.rb文件到LIB /资产。

这工作在本地主机上很好,但是当我因为证书验证失败推到Heroku的失败。

LIB /资产/ ftptls.rb:

=begin
= $RCSfile$ -- SSL/TLS enhancement for Net::HTTP.

= Info
  'OpenSSL for Ruby 2' project
  Copyright (C) 2003 Blaz Grilc <farmer@gmx.co.uk>
  All rights reserved.

= Licence
  This program is licenced under the same licence as Ruby.
  (See the file 'LICENCE'.)

= Requirements

= Version
  $Id: ftptls.rb 13657 2007-10-08 11:16:54Z gotoyuzo $

= Notes
  Tested on FreeBSD 5-CURRENT and 4-STABLE
  - ruby 1.6.8 (2003-01-17) [i386-freebsd5]
  - OpenSSL 0.9.7a Feb 19 2003
  - ruby-openssl-0.2.0.p0
  tested on ftp server: glftpd 1.30
=end

require 'socket'
require 'openssl'
require 'net/ftp'

module Net
  class FTPTLS < FTP
    def connect(host, port=FTP_PORT)
      @hostname = host
      super
    end

    def login(user = "anonymous", passwd = nil, acct = nil)
       store = OpenSSL::X509::Store.new
       store.set_default_paths
       ctx = OpenSSL::SSL::SSLContext.new('SSLv23')
       ctx.cert_store = store
       ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
       ctx.key = nil
       ctx.cert = nil
       voidcmd("AUTH TLS")
       @sock = OpenSSL::SSL::SSLSocket.new(@sock, ctx)
       @sock.connect
       @sock.post_connection_check(@hostname)
       super(user, passwd, acct)
       voidcmd("PBSZ 0")
    end
  end
end

从Heroku的错误:

所以SSL_connect返回= 1个错误号= 0状态的SSLv3 =读服务器证书B:证书验证失败

我发现有关HTTPS连接的主题: http://www.quora.com/What-is-the-path-to-the-SSL-root-certificate-trusted-root-CA-on-Heroku

所以,我想加入这个我ftptls.rb文件,但错误依然存在。

ctx.ca_file = '/usr/lib/ssl/certs/ca-certificates.crt'

任何想法获得此工作?

文章来源: Heroku with FTPTLS - Error on SSL Connection