This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 353
Feature - Traffic Ops Client Certificate Authentication #7110
Open
tcfdev
wants to merge
10
commits into
apache:master
Choose a base branch
from
tcfdev:feature/to-client-cert-verification
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #7110 +/- ##
=========================================
Coverage ? 26.16%
=========================================
Files ? 621
Lines ? 75297
Branches ? 0
=========================================
Hits ? 19704
Misses ? 53787
Partials ? 1806
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ocket8888
reviewed
Feb 9, 2023
| An alternative mechanism for providing credentials and authenticating access. | ||
|
|
||
| There are multiple mechanisms, specifically within Traffic Ops, that provide a means for authentication. | ||
|
|
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... what are they, though?
zrhoffman
suggested changes
Feb 23, 2023
Member
zrhoffman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Just a few comments and suggestions.
4 tasks
Member
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
medium impact
impacts a significant portion of a CDN, or has the potential to do so
new feature
A new feature, capability or behavior
Traffic Ops
related to Traffic Ops
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Add the ability for a Traffic Ops instance to accept TLS certificates from a client request and verify them against specified Root CA's certificate as a form of login. This is not to be confused with mTLS, albeit has a similar design. Should a client not send a TLS certificate as part of the request login functionality will default to standard form authentication (current implementation).
Client
The client will provide a TLS certificate (and intermediate(s)) when hitting the
/user/loginendpoint.The client will need to attach a certificate (and intermediate(s)) that was provided by the Root CA. The client certificate will need to contain a UID Relative Distinguished Name in the DN for the x509 certificate. The object identifier for this field is:
0.9.2342.19200300.100.1.1This will result in a subject that looks something like:
Traffic Ops
In
cnd.confthere is a new section to define the location of the Root CA certificates that are used for verification.cdn.conf
Additionally, to enable a line must be added to the
traffic_ops_golang.tls_configsection if it exists. If this section is not present, ClientAuth will be enabled (but not required) by default.cdn.conf
Traffic Ops does not require the client TLS certificate to be present. And will not verify the client provided TLS certificates during the TLS handshake when establishing a connection. Only if the client sends a TLS certificate to the
/user/loginwill it be processed. If the certificate (and intermediate(s)) provided by the client verifies correctly against the defined Root certificates, the UID field will be parsed. If there is more than 1 UID field, only the first one is accepted. Order is not guaranteed. The UID value will then be used for authentication.Should the TLS certificate authentication fail at any point, Traffic Ops will attempt to perform form value authentication (username and password) which is the current functionality. TLS client certificate authentication is not present on Oauth or Token login endpoints currently.
Which Traffic Control components are affected by this PR?
What is the best way to verify this PR?
Unit
Verify unit tests pass. Unit tests have been added to test TLS authentication. Existing unit tests ensure current default behavior continues to work as expected.
Manual
Test certificates can be created using the file located at
trafficcontrol/experimental/certificate_auth/generate_certs.go. Runninggo run generate_certs.gowill produce private keys and certificates for Root, Intermediate, and Client (Server cert/key is also created, but can be ignored since they too are used only in tests). Place the Root certificate in the directory location specified in thecdn.conffile.Launch a Traffic Ops instance.
Ensure a user exists with appropriate permissions with the name
userid(This can be changed in thegenerate_certs.gofile if you want to use a different username).Send a request to the
user/loginTraffic Ops with the Client and Intermediate certs. For a Go client this would look something like:client.go A more complete version can be found at
trafficcontrol/experimental/certificate_auth/example/client.goUpon success, a 200 OK status code will be returned along with the following body:
{ "alerts": [ { "text": "Successfully logged in.", "level": "success" } ] }Additional tests may also be performed if desired, such as sending a POST request with a username/password body and no certificate (current behavior). Or a bad cert (either malformed or not signed by the correct Root CA) with or without username/password form.
PR submission checklist