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

Improve TLS support #54

Merged
merged 1 commit into from
Jun 26, 2014
Merged

Improve TLS support #54

merged 1 commit into from
Jun 26, 2014

Conversation

jehiah
Copy link
Member

@jehiah jehiah commented Jun 25, 2014

We need to make a few changes to improve go-nsq support for TLS.

The default validation for TLS connections should be set to ServerName, and that should validate the broadcast_address used from lookupd, or the hostname of a direct nsqd connection against the certificate.

We also need to expose options for setting InsecureSkipVerify and the CA root so that they can be accessed via the config Set(key, value) interface.

cc: @mreiferson

@jehiah
Copy link
Member Author

jehiah commented Jun 25, 2014

@mreiferson thoughts on this approach?

@mreiferson
Copy link
Member

It's interesting.

But in this case, for these options, it's not actually necessary to use the plumbing, right?

@jehiah
Copy link
Member Author

jehiah commented Jun 25, 2014

We can choose not to export this stuff; I didn't like the code structure of dumping everything in Set() which read struct tags so that was my motivation. I thought it would/could be useful to treat this as a generic interface for defining higher order settings keys that did a bunch of lower level settings.

@jehiah
Copy link
Member Author

jehiah commented Jun 25, 2014

Validated this works. Thoughts on exposing this api for doing future translations for reader options, or do you want to land this w/o exporting that api?

@mreiferson
Copy link
Member

I agree that the super-long Set method isn't great, but this API is weird because the ConfigHandler ends up receiving the Config object and having intimate knowledge of its layout anyway (setting properties on it directly).

When we had been discussing config hooks a few weeks ago, I really meant it as a notification mechanism, not necessarily as a refactoring of how the Config object was modified internally.

@jehiah
Copy link
Member Author

jehiah commented Jun 25, 2014

There isn't actually any intimate knowledge of the Config object in this setup; it's only setting the exported TlsConfig.

@mreiferson
Copy link
Member

Ok, it isn't "intimate".

I'm just not sure how this is actually an improvement for this use case. Don't get me wrong, I like the idea of some sort of "notification" when values are changed, but we ended up going in a different direction.

Just feels like overkill. More importantly, it's inconsistent with how all the other values are set. If we were to go in this direction they should all follow suit. However, I anticipate that the end result wouldn't really be any cleaner or easier to understand.

@jehiah
Copy link
Member Author

jehiah commented Jun 26, 2014

per offline conversation. the interface for config handlers was unexported and will be re-exported in a later change that moves struct tag handling to use that interface.

🍔

mreiferson added a commit that referenced this pull request Jun 26, 2014
@mreiferson mreiferson merged commit f4ae369 into nsqio:master Jun 26, 2014
@jehiah jehiah mentioned this pull request Jun 27, 2014
@jehiah jehiah deleted the tls_configs_54 branch June 27, 2014 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants