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

use receptorNames (oid=otherNames) in tls bootstrap; fixed associated unit tests for receptor and receptorctl #578

Conversation

sarabrajsingh
Copy link
Contributor

upstream issue #420

added otherName (SAN) checks to tlsconfig.go using utils.ReceptorNames()

@fosterseth @thenets @shanemcd please re-review!

Copy link
Member

@thenets thenets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the certificate generation for the receptorctl test suite.

@shanemcd
Copy link
Member

I just tried this and I'm not sure if I'm doing something wrong, but I'm still able to join the mesh after modifying my receptor config to include a mismatching node name. If you are around today and have time, let's jump on a call and look at this together.

…ociated unit tests for receptor and receptorctl
@sarabrajsingh sarabrajsingh force-pushed the feature/issue-420-receptor-names-node-ids branch from 2238548 to 4a0c940 Compare March 21, 2022 19:35
RequireClientCert bool `required:"false" description:"Require client certificates" default:"false"`
ClientCAs string `required:"false" description:"Filename of CA bundle to verify client certs with"`
PinnedClientCert []string `required:"false" description:"Pinned fingerprint of required client certificate"`
SkipReceptorNamesCheck bool `required:"false" description:"if enabled, validate cert using ReceptorNames OID in Certificate"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the description for this is tricky, I think we want to emphasize this boolean only controls the check at startup, not during the quic TLS handshake (where the receptor names will always be checked, regardless of how this boolean is set)

maybe something like,

Skip verifying Receptor node ID in certificate at startup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarabrajsingh sarabrajsingh self-assigned this Mar 25, 2022
@sarabrajsingh sarabrajsingh changed the title use receptorNames (oid=otherNames) in tls-server bootstrap; fixed associated unit tests for receptor and receptorctl use receptorNames (oid=otherNames) in tls bootstrap; fixed associated unit tests for receptor and receptorctl Mar 27, 2022
@shanemcd
Copy link
Member

Let's get the "fix lint" and "fix tests" commits rebased out of the history here. Those should get squashed into the commits that introduced whatever problems you were addressing.

@sarabrajsingh sarabrajsingh force-pushed the feature/issue-420-receptor-names-node-ids branch 2 times, most recently from fe7edae to 09e59ce Compare March 28, 2022 20:47
@sarabrajsingh sarabrajsingh force-pushed the feature/issue-420-receptor-names-node-ids branch from 09e59ce to f6f22df Compare March 28, 2022 20:49
@sarabrajsingh
Copy link
Contributor Author

@shanemcd done

@shanemcd
Copy link
Member

Awesome, thank you. @fosterseth have you pulled this down and played around?

return err
}

if !found {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still need to return without error here if len(receptorNames) == 0

if I create a cert without a nodeID, and use that on a config with node ID foo, but I see this error

[sbf@fedora sockceptor]$ ./receptor -c foo.yml
Error: MainInstance.nodeID=foo not found in certificate name(s); names found=[]; cfg section=server2; server cert=/home/sbf/sockceptor/certs/bob.crt

we want this to be permissible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fosterseth - just thinking about this before i write a patch. would it be more optimal for the consumer to just flip the bit for the SkipReceptorNamesCheck flag to true if they give a ReceptorName/OID="" and skip the check altogether?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with that option

RootCAs string `required:"false" description:"Root CA bundle to use instead of system trust"`
InsecureSkipVerify bool `required:"false" description:"Accept any server cert" default:"false"`
PinnedServerCert []string `required:"false" description:"Pinned fingerprint of required server certificate"`
SkipReceptorNamesCheck bool `required:"false" description:"if enabled, skip verifying ReceptorNames OIDs in certificate at startup"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

golang will default this to false, but for consistency and clarify I think we can add default:"false" , similar to InsecureSkipVerify

To make the description a little shorter, we could omit "if enabled," and just start with "Skip.."

@fosterseth
Copy link
Member

fosterseth commented Mar 31, 2022

Note: if users that have set up tls-server and tls-client to be used for TCP connections only, and thus may not have the receptor name in the cert, they should add SkipReceptorNamesCheck=true to those tls-server/client entries in the config file.

…d SkipReceptorNamesCheck in tlsServerConfig and tlsClientConfig structs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants