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

ECC certificate server status not detected #5128

Closed
2 tasks done
Soham3-1415 opened this issue Jul 30, 2021 · 5 comments
Closed
2 tasks done

ECC certificate server status not detected #5128

Soham3-1415 opened this issue Jul 30, 2021 · 5 comments
Assignees
Labels
bug Production bug
Milestone

Comments

@Soham3-1415
Copy link

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

ECC certificates, like the ones issued from Let's Encrypt, do not have "Key Encipherment" listed as a key usage. These certificates may have the appropriate extensions for being considered a server certificate (e.g.: TLS Web Server Authentication extended key usage), but they are not recognized as server certificates by OPNSense. In OPNSense 21.7, the lack of server certificate status prevents such certificates from being used for the Web GUI.

To Reproduce

Certificates and key material have been provided in the "Additional context" section.

Steps to reproduce the behavior:

  1. Go to /system_certmanager.php?act=new
  2. Provide a descriptive name
  3. Paste the certificate labeled BAD.pem into "Certificate data"
  4. Paste the key labeled KEY.pem into "Private key data"
  5. Click "save"

The certificate will be marked as "CA:No, Server:No"

  1. Go to /system_certmanager.php?act=new
  2. Provide a descriptive name
  3. Paste the certificate labeled GOOD.pem into "Certificate data"
  4. Paste the key labeled KEY.pem into "Private key data"
  5. Click "save"

The certificate will be marked as "CA:No, Server:Yes"

The only appreciable difference between the two certificates is that one of them is lacking the "Key Encipherment" key usage extension.

Expected behavior

Both certificates should be marked as "CA:No, Server:Yes" because they have the TLS Web Server Authentication extended key usage extension.

Describe alternatives you considered

  • Use certificates with the "Key Encipherment" key usage extension. This is not possible with ECC certificates.
  • Use a version of OPNSense before 21.7. The server flag will still be no, but the certificate can be used with the Web GUI.

Screenshots
diff
bad
good

Relevant log files

N/A

Additional context

KEY.pem

-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA3HnVoEg1uaufJwvxnM0A+0v2iD6ZV5F+qRuR1T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h1iHtUEEKuAwZhB8Niw/dERSjCcajxcDrOhoQ7aMtTsGSk08+gk
lMp1bnX9JZo43OwOWWfUNJTdEIZ+tG+JOO+ZAPJbml8jK16BW/YMXq0SjLzRtp1z
3fkDCtJ6GeTD4b4h
-----END CERTIFICATE-----

Environment

Reproduced on
OPNsense 21.1.8_1 (amd64, LibreSSL).
OPNsense 21.7 (amd64, LibreSSL).

@AdSchellevis
Copy link
Member

Looking at the track record of how the current logic landed via #2459 (which is likely the state you're looking for) and #2463, I'm doubting a bit if there's actually a valid reason to check for existence of "Digital Signature" and "Key Encipherment/Agreement" (which seems to originate from https://community.openvpn.net/openvpn/wiki/HOWTO#ImportantNoteonpossibleMan-in-the-Middleattackifclientsdonotverifythecertificateoftheservertheyareconnectingto ).

It might be a best practice for OpenVPN, but if the question is "is this a server cert", these attributes aren't necessarily needed. @fichtner what do you think?

@fichtner
Copy link
Member

fichtner commented Aug 1, 2021

Also reported here: https://forum.opnsense.org/index.php?topic=24153.0

@AdSchellevis I wasn't aware that the server flag was so specific to OpenVPN, at least the naming did not suggest it although it is for sure only used by OpenVPN at the moment. We should make a correct server flag and then maybe check for further constraints in OpenVPN itself (or ask for OpenVPN server suitability per optional flag?

@fichtner fichtner added the bug Production bug label Aug 1, 2021
@fichtner fichtner self-assigned this Aug 1, 2021
@fichtner fichtner added this to the 22.1 milestone Aug 1, 2021
AdSchellevis added a commit that referenced this issue Aug 1, 2021
…() and id-kp-serverAuth according to rfc3280, for #5128
@AdSchellevis
Copy link
Member

@fichtner how about b9b6e3e ? should keep it rather simple, if other rfc purposes would matter at a later time we can always parse them separately.

@fields987
Copy link

The workaround I used was manually editing the config.xml file to use the refid of the ecc cert and restarting the webgui service. The new cert is now in use, however any further edits to the systems/settings/administration page throw the same error of "certificate is not intended for server use"

@fichtner fichtner assigned AdSchellevis and unassigned fichtner Aug 2, 2021
fichtner pushed a commit that referenced this issue Aug 2, 2021
…() and id-kp-serverAuth according to rfc3280, for #5128

(cherry picked from commit b9b6e3e)
@fichtner
Copy link
Member

fichtner commented Aug 2, 2021

@AdSchellevis b9b6e3e make sense, thanks a lot!

@fichtner fichtner closed this as completed Aug 2, 2021
AdSchellevis added a commit that referenced this issue Aug 15, 2021
…() and id-kp-serverAuth according to rfc3280, for #5128
oshogbo pushed a commit to DynFi/opnsense-core that referenced this issue Mar 3, 2022
…() and id-kp-serverAuth according to rfc3280, for opnsense/core#5128

(cherry picked from commit b9b6e3e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Production bug
Development

No branches or pull requests

4 participants