# OpenSSL::SSL::SSLError (certificate has expired) with Rails running in a Docker container

**URL:** <https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [July 21, 2023, 3:18pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818 "2023-07-21T15:18:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [July 21, 2023, 3:18pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/1 "2023-07-21T15:18:23Z")

</div>

Hello,

I am integrating Auth0 authentication into our stack:

- a **Vue.js 2** SPA
- a Ruby on Rails API (Ruby 2.7.8, **Rails 5.2.5** ).

Both applications run in Docker containers, within a Docker compose setup.  
The container that runs the API uses the image **ruby:2.7-buster** from DockerHub with a few customizations steps and obviously with the auth0 gem.

I am working with tenant **dev-6w4hy15cawy5fx8q** (under [techops@sosv.com](mailto:techops@sosv.com))

Authentication flows as follows:

1. The user clicks a Sign In button in the Login page of our SPA.
2. They are redirected to Auth0 login page and log in there.
3. They are redirected back to the Login page of our SPA.
4. The Login page picks up on the new authentication status, and posts Auth0 JWT to our API.
5. Our API creates a new session. In this process, it calls an `AuthZero` module that contains a `Client` class, [massively inspired from the Auth0Client class described here](https://auth0.com/docs/quickstart/backend/rails#create-an-auth0client-class).

At step 5, I get the following error in our Rails API:  
`OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired)):`

The error happens in the `get_jwks` method of the `Client` class:

```auto
    def get_jwks
      jwks_uri = URI("#{domain_url}.well-known/jwks.json")
      Net::HTTP.get_response jwks_uri
    end

```

Here is my Auth0 Domain environment variable:  
`AUTH0_DOMAIN=https://dev-6w4hy15cawy5fx8q.us.auth0.com`

I already checked [this thread](https://community.auth0.com/t/auth0-is-down-for-all-our-environments-and-all-our-users-are-reporting-an-outage/95726/12). I checked the OpenSSL certificates of the Ruby image we are using to run our API. Within this Docker image:

- We used to have a DST Root CA X3 (outdated) certificate.  
I have deleted it, reinstalled the certificates and rebuilt the image with the updates, which did not fix the OpenSSL error.
- We already have a ISRG Root X1 certificate.
- We are using the version 1.1.1 of OpenSSL.

Can you please help me troubleshoot this issue?

Isabelle

---

<div class="post-metadata">

**Author:** ![carlastabile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlastabile/32/54630_2.png) [@carlastabile](https://community.auth0.com/u/carlastabile)\
**Post date:** [July 24, 2023, 9:19am UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/2 "2023-07-24T09:19:33Z")

</div>

Hi @ilpvn and welcome to the Auth0 Community!

You mention your `AuthZero` module is heavily inspired by our `Auth0Client` implementation, if that’s the case then could you try setting the `AUTH0_DOMAIN` env variable to `dev-6w4hy15cawy5fx8q.us.auth0.com` ? and remove the `https`. The original `domain_url` method should append the scheme at the beginning.

It could the your OpenSSL error is due to having a bad string.

Let me know if that works!

---

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [July 24, 2023, 4:01pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/3 "2023-07-24T16:01:28Z")

</div>

Hi Carla,  
Thanks for your answer.  
To be consistent with other environment variables, I had added the https:// flag to the URL and edited the client `domain_url` method as follow:

```auto
  def self.domain_url
      "#{Rails.config.auth0_domain}/"
  end

```

Do you have any other suggestion?

---

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [July 27, 2023, 1:15pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/4 "2023-07-27T13:15:43Z")

</div>

Hi Carla,

Which CA is the authority for Auth0 authentication?  
Where can I find a list of outdated and required OpenSSL certificates for this CA?

Thank you

---

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [July 31, 2023, 10:12am UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/5 "2023-07-31T10:12:22Z")

</div>

just specifying that I also removed the https from my environment variable and updated self.domain\_url accordingly

---

<div class="post-metadata">

**Author:** ![carlastabile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlastabile/32/54630_2.png) [@carlastabile](https://community.auth0.com/u/carlastabile)\
**Post date:** [August 1, 2023, 12:47pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/6 "2023-08-01T12:47:48Z")

</div>

Hi @ilpvn, is this the only endpoint from Auth0 that is failing for you?

From your first message it seems you’ve already tried everything explained here: [Auth0 is Down for all our Environments and all our Users are reporting an outage! - #12 by dan.woda](https://community.auth0.com/t/auth0-is-down-for-all-our-environments-and-all-our-users-are-reporting-an-outage/95726/12)

One other thing to check is which version of the SDK you’re using and upgrade to the latest one.

Can you try that and let me know how it goes?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [August 1, 2023, 2:02pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/7 "2023-08-01T14:02:18Z")

</div>

Thanks for the help @carlastabile!

---

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [August 2, 2023, 2:36pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/8 "2023-08-02T14:36:41Z")

</div>

Hi Carla,  
Thank you for your answer.  
Yes, I already tried removing the outdated certificate as outlined in the link above.  
Could my Docker setup (volumes) be interfering with the deletion of the certificate?

At the moment, I cannot test this issue further, as I am encountering another error (described in a separate ticket).

I am using version 2.0.1 of auth0-spa-js (vs 2.1.1 being the latest version) and version 4.8.0 on the back-end vs 5.14.1). I will try an update of the SDK.

---

<div class="post-metadata">

**Author:** ![ilpvn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ilpvn/32/48880_2.png) [@ilpvn](https://community.auth0.com/u/ilpvn)\
**Post date:** [August 17, 2023, 11:43am UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/9 "2023-08-17T11:43:55Z")

</div>

Hi Carla,

I finally solved this error.  
We were using an old gem (Ruby library) `certified` that was overwriting the HTTP class we are using for the call that provides the JWK keys.  
Thank you for your time!

Isabelle

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [August 17, 2023, 1:38pm UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/10 "2023-08-17T13:38:22Z")

</div>

Thanks for the update!

---

<div class="post-metadata">

**Author:** ![carlastabile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlastabile/32/54630_2.png) [@carlastabile](https://community.auth0.com/u/carlastabile)\
**Post date:** [August 18, 2023, 7:24am UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/11 "2023-08-18T07:24:11Z")

</div>

I’m glad you fixed it! 👏🏻

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [September 1, 2023, 7:24am UTC](https://community.auth0.com/t/openssl-sslerror-certificate-has-expired-with-rails-running-in-a-docker-container/111818/12 "2023-09-01T07:24:29Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
