-
Notifications
You must be signed in to change notification settings - Fork 64
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
Tls rootca option #337
Open
garmr-ulfr
wants to merge
3
commits into
Jigsaw-Code:main
Choose a base branch
from
garmr-ulfr:tls-rootca-option
base: main
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.
Open
Tls rootca option #337
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
We need to update the validation function, otherwise I think this will have no effect.
It would be helpful to have a test to exercise this. I wonder if LLM can help 😅
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.
LLM?
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.
I meant to generate the test that shows it working/not working, because it's a bit complicated to create the test. But we can probably piggy back on existing tests somewhere
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.
Here is an example test: https://pkg.go.dev/crypto/tls#example-Dial
We need to redesign the certificate validation. I don't want to repeat the same mistake many TLS libraries do that spread a bunch of options that tweak validation, making it hard to figure out what options are relevant for what and how they interact.
We should get rid of all validation options (CertificateName, RootCA), and replace with a
VerifyConnection
function instead. Unlike the standard function, I'd make it take a slice ofPeerCertificates
, nottls.ConnectionState
, so we don't tie it to the standard TLS implementation.Then we can provide a helper struct type with CertificateName and RootCAs that implements the verify function. It needs to set
x509.VerifyOptions.Roots
andDNSName
. That function can be passed to ourtls.ClientConfig
.If someone wants the "InsecureSkipVerify" behavior, they can simply set a function that returns nil.
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.
Oooohh, OK. I will do that!