slack-ruby / slack-ruby-client

A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
MIT License
1.19k stars 214 forks source link

Can't send slack message - Faraday::SSLError · SSL_CTX_load_verify_file: system lib - Ubuntu 22.04 & OpenSSL 3.0.2 #457

Closed dylandamsma closed 1 year ago

dylandamsma commented 1 year ago

Hi there,

I am running into this SSL error when trying to send a slack message using the slack-ruby-client. This does not happen locally, but does happen on my server, using:

Ubuntu 22.04.1 LTS OpenSSL 3.0.2

Came across another reddit thread facing the same issue: https://www.reddit.com/r/ruby/comments/un9rn1/comment/ifqidwl/

Suggestions made on reddit: Downgrade ubuntu OR downgrade OpenSSL (seems to be dangerous considering vulnerabilities in older versions).

Is there any safer solution to this issue?

Bug gets triggered when calling slack client:

Screenshot 2023-03-25 at 3 27 16 PM
dblock commented 1 year ago

I found an old discussion on this in https://www.reddit.com/r/ruby/comments/un9rn1/having_issues_installing_ruby/. Which version of slack-ruby-client and ruby are you running?

dylandamsma commented 1 year ago

I found an old discussion on this in https://www.reddit.com/r/ruby/comments/un9rn1/having_issues_installing_ruby/. Which version of slack-ruby-client and ruby are you running?

Hi dblock, yes I found the same thread. I'm on Ruby 3.0.4 and the latest slack-Ruby-client (1.0.0), with faraday 1.10.2

The thread suggests downgrading OpenSSL or Ubuntu, which does not seem to be the right way to fix this issue.

dylandamsma commented 1 year ago

A solution was to specify the cert file for the slack client. But it seems this should be redundant on this set-up.

def call
      # fix error SSL_CTX_load_verify_file: system lib (Faraday::SSLError) in production
      ca_file = "/usr/lib/ssl/certs/ca-certificates.crt"
      client = Slack::Web::Client.new(ca_file: ca_file)
      client.chat_postMessage(channel: @channel, text: @message, as_user: true)
    end
dblock commented 1 year ago

Which version of slack-ruby-client are you using? Can you please confirm it's at least 2.0.0 (which has https://github.com/slack-ruby/slack-ruby-client/pull/416)?

megatux commented 1 year ago

Hello, I'm having the same issue, after upgrading the Heroku stack to heroku-20, but I'm seeing that I'm using an old version of the gem, 1.0.0. I checked the Changelog and seems like it was fixed in 2.0. Should I upgrade? I hope it is transparent process.

dblock commented 1 year ago

Yes, you should upgrade @megatux. It's not going to be trivial, but do post your outcomes here?

dblock commented 1 year ago

Closing as fixed in recent versions.