-
Notifications
You must be signed in to change notification settings - Fork 29
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
[FEAT] Add server_name field in ClientTLS auth request claims #210
base: main
Are you sure you want to change the base?
Conversation
@@ -70,6 +70,7 @@ type ClientTLS struct { | |||
Cipher string `json:"cipher,omitempty"` | |||
Certs StringList `json:"certs,omitempty"` | |||
VerifiedChains []StringList `json:"verified_chains,omitempty"` | |||
ServerName string `json:"server_name,omitempty"` |
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.
Should this be HostName? Would that be more descriptive?
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 used the same terminology as crypto/tls
: https://pkg.go.dev/crypto/tls#ConnectionState, and I though that in the context of a ClientTLS block, ServerName
would have a clear meaning.
But I understand that it may be misleading due to the fact that a server also has a server_name
, so I would like for you to make the choice 😅
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.
Good point, we can stick with ServerName or SNI.
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 think that SNI
may be the best candidate here. Googling "tls sni" gives pretty relevant results, and it does not reuse an existing field name from other claims data.
If that's ok with you, I can push a commit with this modification.
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.
The change would be:
VerifiedChains []StringList `json:"verified_chains,omitempty"`
- ServerName string `json:"server_name,omitempty"`
+ SNI string `json:"sni,omitempty"`
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.
Looping in @philpennock and @ripienaar for their opinions here. I could do either.
This PR introduces a new field on ClientTLS struct to hold the server name used in TLS handshake.
Discussed in nats-io/nats-server#4706