Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

CLOSED - Fix add sslkeys endpoint to always use the input certificate#3417

Closed
rawlinp wants to merge 1 commit intoapache:masterfrom
rawlinp:store_cert_as_is
Closed

CLOSED - Fix add sslkeys endpoint to always use the input certificate#3417
rawlinp wants to merge 1 commit intoapache:masterfrom
rawlinp:store_cert_as_is

Conversation

@rawlinp
Copy link
Copy Markdown
Contributor

@rawlinp rawlinp commented Mar 18, 2019

Which issue is fixed by this PR? If not related to an existing issue, what does this PR do?

Sometimes, the Certificate.Verify method will remove elements from a
valid certificate chain. Instead of using the output of that method,
always use the user input certificate and return a warning if the input
certificate does not match the output of the Certificate.Verify method.

Fixes #3398

Which TC components are affected by this PR?

  • Documentation
  • Grove
  • Traffic Analytics
  • Traffic Monitor
  • Traffic Ops
  • Traffic Ops ORT
  • Traffic Portal
  • Traffic Router
  • Traffic Stats
  • Traffic Vault
  • Other _________

What is the best way to verify this PR? Please include manual steps or automated tests.

(If no tests are part of this PR, please provide explanation as to why no tests are included.)

Includes changes to the unit tests, but there is currently an unrelated unit test failure in statuses_test.go which should be addressed in a separate PR:

# github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/status [github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/status.test]
status/statuses_test.go:82:20: too few values in TOStatus literal

Manual verification can be done by adding an sslkey to a delivery service that would normally get mangled by the API and checking that the stored cert matches the input cert.
If you don't have a cert like that on hand, you can still check by adding a non-self-signed cert and verifying that the stored cert matches the input cert.

Check all that apply

  • This PR includes tests
  • This PR includes documentation updates
  • This PR includes an update to CHANGELOG.md
  • This PR includes all required license headers
  • This PR includes a database migration (ensure that migration sequence is correct)
  • This PR fixes a serious security flaw. Read more: www.apache.org/security

Sometimes, the Certificate.Verify method will remove elements from a
valid certificate chain. Instead of using the output of that method,
always use the user input certificate and return a warning if the input
certificate does not match the output of the Certificate.Verify method.

Fixes apache#3398
@rawlinp rawlinp added bug something isn't working as intended Traffic Ops related to Traffic Ops SSL support for/problems with SSL features labels Mar 18, 2019
@asfgit
Copy link
Copy Markdown
Contributor

asfgit commented Mar 18, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/3354/
Test PASSed.

@rawlinp
Copy link
Copy Markdown
Contributor Author

rawlinp commented Mar 18, 2019

This PR might be getting rolled into #3382 since that PR touches the same code.

rawlinp pushed a commit that referenced this pull request Apr 3, 2019
…ps (AddSSLKeys Endpoint) (#3382)

* Fix add sslkeys endpoint to always use the input certificate

Sometimes, the Certificate.Verify method will remove elements from a
valid certificate chain. Instead of using the output of that method,
always use the user input certificate and return a warning if the input
certificate does not match the output of the Certificate.Verify method.

Fixes #3398

(cherry picked from commit dde742e)

* Combine PR #3382 with PR #3417 and add ECDSA support for DNS delivery services

* Update unit tests to fail faster

* Update comments related to RSA/ECDSA key mismatch verification

* Make decoding ECDSA PEM blocks more readable

* Add Unit tests for ECDSA privateKey decoding with and without param pem block

* Rename Unit test methods.
Add unit test for encrypted ECDSA private key

* Add unit test to verify DSA signed x509 certificates are rejected

* Gofmt

* Fix ECDSA unit tests
Add ECDSA mismatched cert/key unit test
Update error messages to be more meaningful

* Add more unit tests related to critical x509 cert/key validation
Missing RSA keyEncipherment unit test
Missing ECDSA digitalSignature unit test
Missing serverAuth extendedKeyUsage (x509v3 only) unit test

* Add self-signed x509v1 server certificate unit test.

* Remove redundant error message header.

* Revert change, gofmt

* Use getDSType() to permit ECDSA keys for only DNS* DS types.

* Update tc.DSType.IsDNS() method to only include DNS DS types.

* Use updated tc.DSType.isDNS() method to determine if DS is a DNS type.

* Check errors returned from rsa/ecdsa private key decoding methods
Minor changes to error message formatting and string comparison
Re-sort go import statements
@rawlinp
Copy link
Copy Markdown
Contributor Author

rawlinp commented Apr 3, 2019

This has been addressed in #3382

@rawlinp rawlinp closed this Apr 3, 2019
@rawlinp rawlinp deleted the store_cert_as_is branch April 3, 2019 15:42
@mitchell852 mitchell852 changed the title Fix add sslkeys endpoint to always use the input certificate CLOSED - Fix add sslkeys endpoint to always use the input certificate Oct 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

abandoned bug something isn't working as intended SSL support for/problems with SSL features Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TO is mangling SSL server cert on update

3 participants