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

TLS min/max version updates #518

Merged
merged 1 commit into from
Dec 22, 2014
Merged

Conversation

jehiah
Copy link
Member

@jehiah jehiah commented Dec 20, 2014

Switch to allow tls_min_version="tls1.0" from a config file instead of opaque integer (and same for manually setting Config objects).

Default min version tls1.0 to avoid allowing ssl3.0 by default, and specify max TLS version of 1.2 to take advantage of TLS_FALLBACK_SCSV prior to Go 1.5

for more discussion see: #513

@jehiah
Copy link
Member Author

jehiah commented Dec 20, 2014

not my cleanest code ever, but RFR @mreiferson @twmb

@mreiferson
Copy link
Member

did you see my comments on #513?

I'm fine if you want to add . to the strings - but I don't think we actually needed the code for config file support and I don't think we need strings for setting Config directly. I think it makes more sense to be consistent with max version and use the constants provided by the tls package.

}
if v, exists := cfg["tls_min_version"]; exists {
var t tlsVersionOption
err := t.Set(fmt.Sprintf("%v", v))
Copy link
Member

Choose a reason for hiding this comment

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

ok, yes, we do need this - whooops 😁

Copy link
Member

Choose a reason for hiding this comment

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

it might make sense to "promote" this translation behavior up into go-options itself in some generic way.

if the destination type implements a "set" interface then use that for coercion?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that's my general thought. I need to review better how we landed w/ that and validation for reader-options in go-nsq. I'll ping when i have taken a pass at updating.

@jehiah
Copy link
Member Author

jehiah commented Dec 21, 2014

Ok, did some refactoring to main() to make it testable (and as a nice benefit dropped all unused flagset variables). I found the problem i was having which was related to handling empty string from the config file.

We should improve config validation in a future PR.

type config map[string]interface{}

// Validate settings in the config file, and fatal on errors
func (cfg config) Validate() {
Copy link
Member

Choose a reason for hiding this comment

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

not sure Validate is the right word here, but I don't have any better ideas

@mreiferson
Copy link
Member

this came out pretty cool - LGTM after that minor nitpick

maxDeflateLevel = flagSet.Int("max-deflate-level", 6, "max deflate compression level a client can negotiate (> values == > nsqd CPU usage)")
snappyEnabled = flagSet.Bool("snappy", true, "enable snappy feature negotiation (client compression)")
)
var ()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why keep this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

ha. oops.

good catch

@twmb
Copy link
Contributor

twmb commented Dec 22, 2014

This should be followed with a corresponding change to go-nsq that adds dots to the min version flag name and also adds max version.

👍

@jehiah
Copy link
Member Author

jehiah commented Dec 22, 2014

Thanks for the feedback @mreiferson @twmb

RFM after travis goes green.

mreiferson added a commit that referenced this pull request Dec 22, 2014
@mreiferson mreiferson merged commit 0547fc1 into nsqio:master Dec 22, 2014
@mreiferson mreiferson deleted the tls_min_max_518 branch December 22, 2014 17:02
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.

3 participants