【问题标题】:OpenSSL::SSL::SSLError in UsersController#create (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol)UsersController#create 中的 OpenSSL::SSL::SSLError(SSL_connect 返回=1 errno=0 状态=未知状态:未知协议)
【发布时间】:2015-01-14 20:33:13
【问题描述】:

我已经看过很多 StackOverFlow 的回答并再次发布这个问题。 有时在发送邮件时出现问题,如果我重新启动服务器,我会再次遇到问题。

SMTP 设置:

config.action_mailer.smtp_settings = {
 address:              'smtp.1and1.com',
 port:                 25,
 domain:               'leotechnosoft.net',
 user_name:            'santoshk@leotechnosoft.net',
 password:             'password',
 openssl_verify_mode:  'none',
 authentication:       'plain',
 enable_starttls_auto: true  }

错误

OpenSSL::SSL::SSLError in UsersController#create

SSL_connect returned=1 errno=0 state=unknown state: unknown protocol

我厌倦了更改设置 ssl true/false、tls true/false、open_ssl_verify_mode:none enable_starttls_auto: true。

请解释一下这个问题的根本原因以及我该如何解决。

Ruby 1.9.3 (实际上升级到 ruby​​ 2.1.2 后问题出现了,然后在 1.9.3 中也无法使用)

Ubuntu 12.04

谢谢

【问题讨论】:

    标签: ruby-on-rails ruby ssl openssl sendmail


    【解决方案1】:

    我使用 gmail smtp 收到相同的消息,但是当我从“普通”更改为“登录”时,问题就解决了。

      config.action_mailer.delivery_method = :smtp
      config.action_mailer.perform_deliveries = true
      config.action_mailer.raise_delivery_errors = true
      config.action_mailer.smtp_settings = {
          enable_starttls_auto: true,
          address:              'smtp.gmail.com',
          port:                 587,
          domain:               'gmail.com',
          user_name:            'youremail@gmail.com',
          password:             'yourpassword',
          authentication:       :login
        }
    

    【讨论】:

      【解决方案2】:

      使用 openssl 1.0.1 时,它似乎与 ubuntu 12.04 中的一个已知错误有关,如此处最后一个答案所述:

      OpenSSL::SSL::SSLError Ubuntu 12.04 only

      您可以在 Ubuntu 的错误跟踪器 https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371 上找到有关该错误的更多信息

      显然,如果你强制使用 SSLv3,错误应该会消失。

      Ruby SSL error - sslv3 alert unexpected message

      您可能还想检查leotechnosoft.net 在使用 SSL 时是否阻止了端口 25,因为某些托管服务提供商有时会默认阻止端口 25。当您使用 SSL 时,请尝试使用端口 465。

      【讨论】:

      • 不幸的是,使用 SSLv3 是一种解决方法,因为 POODLE 漏洞不再受信任。
      • 你说得对……这个漏洞是在我的原始帖子之后发现的。我会尽快提交更新的答案。
      猜你喜欢
      • 2019-04-03
      • 2013-06-26
      • 2023-04-06
      • 2015-07-25
      • 2016-12-02
      • 2017-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多