rubydockerhttpartyfaraday

Docker Ruby SSL_connect returned=1 errno=0 state=error: wrong signature type


I have ruby 2.7 in a Docker container running a rather simple HTTP client using Faraday:

conn = Faraday.new("https://jinio.com.ph")
conn.post("/tracker", {p: @code}.to_json, {"Content-Type" => "application/json"})

This code returns a SSL Error "wrong signature type" inside the container.

Faraday::SSLError (SSL_connect returned=1 errno=0 state=error: wrong signature type)

Any ideas on how this can be resolved? FYI, if I run this on Mac OS, the code runs without errors

My Dockerfile if this helps:

FROM ruby:2.7
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client nano
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY . /app

# Script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000

# Start server
CMD ["rails", "server", "-b", "0.0.0.0"]

Solution

  • I had same problem, solved with change in Dockerfile.

    after FROM ruby:2.7 add

    RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf

    Origin source (in Japanese):

    https://qiita.com/masayuki14/items/c34eafb9d6130e2c5b67