Skip to content

Resolve "Can't save pages domain form with Let's Encrypt enabled if current certificate is outdated"

What does this MR do?

When we check for intermediate certificates we actually just check if the certificate is valid now. It can be valid for a lot of reasons including expiration.

This prevents user from enabling Let's Encrypt integration:

image

This MR just turns off intermediates validation unless user changed certificate.

Alternative approaches:

  1. Check error codes:
    # This forces to load all intermediate certificates stored in `certificate`
    Tempfile.open('certificate_chain') do |f|
      f.write(certificate)
      f.flush
      store.add_file(f.path)
    end

    store.verify(x509)

    # store.error will contain error code, and we check only for missing intermediates
  1. Set time for validation:
    # This forces to load all intermediate certificates stored in `certificate`
    Tempfile.open('certificate_chain') do |f|
      f.write(certificate)
      f.flush
      store.add_file(f.path)
    end

    store.time = x509.not_after
    store.verify(x509)

They both will fix the current problem, but I think we can have similar issues later, so just disabling validation feels right.

NOTE: intermediates validation does not in any way depends on private_key, we check for consistency of key and certificate in another validation method.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #64870 (closed)

Edited by Vladimir Shushlin

Merge request reports

Loading