Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Known devices with expired CAs can no longer connect #838

Closed
dnrce opened this issue Jul 1, 2022 · 0 comments · Fixed by #839
Closed

Known devices with expired CAs can no longer connect #838

dnrce opened this issue Jul 1, 2022 · 0 comments · Fixed by #839

Comments

@dnrce
Copy link
Contributor

dnrce commented Jul 1, 2022

Describe the bug
In our org we manually pin certs for each of our devices, rendering the device CA chain-of-trust essentially moot. We don't have CAs added to the org, because our understanding has been that org device CAs are only needed for trust during JITP. This has worked well for us in the past, but after an attempted upgrade to NervesHub v1.0.0, some of our devices were unable to reconnect to NervesHub due to a certificate error. The client logs:

13:59:14.466 [error] GenStateMachine #PID<0.21479.49> terminating
** (exit) {:socket_error, {:tls_alert, {:internal_error, 'TLS client: In state connection received SERVER ALERT: Fatal - Internal Error\n '}}}
    (stdlib 3.13) gen_statem.erl:1360: :gen_statem.loop_state_callback_result/11
    (stdlib 3.13) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

and the device server logs:

14:30:53.432 [notice] TLS :server: In state :wait_cert at ssl_handshake.erl:362 generated SERVER ALERT: Fatal - Internal Error
 - {:unexpected_error, {:case_clause, :cert_expired}}

The affected devices were provisioned with CAs that have since expired. Even though their device certs are known, they are now being rejected when attempting to connect. This seems to be related to OTP 24 and specifically to e67f4a6.

To Reproduce
Steps to reproduce the behavior:

  1. Provision a device with a pinned cert (i.e. non-JITP) from an expired CA in an older version of NervesHub (tested with 8c1dc08).
  2. Update NervesHub past e67f4a6.
  3. The device can no longer connect.

Expected behavior
The device is able to connect despite having an expired CA.

jjcarstens added a commit that referenced this issue Jul 1, 2022
Fixes #838

We were previously requiring that the signer CA to be registered even if the
device certificate was already pinned, which was incorrect. This fixes that to
skip the check if we're being presented with a signer CA so that validation of the
device certificate can happen.

If the device cert is pinned, the check will pass. If not, it will go through the
normal validation flow and fail due to an expired, unregistered signer CA anyway
jjcarstens added a commit that referenced this issue Jul 1, 2022
Fixes #838

We were previously requiring that the signer CA to be registered even if the
device certificate was already pinned, which was incorrect. This fixes that to
skip the check if we're being presented with a signer CA so that validation of the
device certificate can happen.

If the device cert is pinned, the check will pass. If not, it will go through the
normal validation flow and fail due to an expired, unregistered signer CA anyway
oestrich pushed a commit that referenced this issue Mar 22, 2023
Fixes #838

We were previously requiring that the signer CA to be registered even if the
device certificate was already pinned, which was incorrect. This fixes that to
skip the check if we're being presented with a signer CA so that validation of the
device certificate can happen.

If the device cert is pinned, the check will pass. If not, it will go through the
normal validation flow and fail due to an expired, unregistered signer CA anyway
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant