-
Notifications
You must be signed in to change notification settings - Fork 442
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 is (I believe) broken #78
Conversation
This is what I get for writing code entirely untested, I'm sorry. I'll fix this up, write some tests and make sure this works end-to-end. Thanks for the report @twmb |
changes look good, but this is failing travis tests against nsqd versions 0.2.24 and 0.2.27 |
a52c3f7
to
65bee43
Compare
OK, this run should pass |
close, but missing on Go 1.0.3. (I think we are ready to cut support there though. Is now the time?) |
65bee43
to
c049591
Compare
those words make my ❤️ sing |
I just fixed it actually, we can do that as a separate PR on both repos... |
c049591
to
a9fa553
Compare
First, the new
tls_key
andtls_cert
support is broken in the Set method:https://github.com/bitly/go-nsq/blob/e0b1455c6272a9c95bad4a020170846644b992a7/config.go#L332
These cases do not return early, like the other switch cases. You don't do this because of the following if block to load certs if both the tls_key and tls_cert flag are not empty:
https://github.com/bitly/go-nsq/blob/e0b1455c6272a9c95bad4a020170846644b992a7/config.go#L360-L366
One problem is that, no matter what, the first pass through this method (as the config is parsing all opts) necessarily will not have both
t.certFile
andt.keyFile
set and will skip the if condition and returnunknown option
. The second is that, even if both were loaded, the if condition doesn't return, at which point the method would still returnunknown option
.The fix is to make the
unknown option
error return asdefault
in the switch statement, andreturn nil
as the last line in that method. I would do this myself, however, after testing it, using tls still panics:Which doesn't happen when I do not use any tls flag (and turn off require-verify with all tls flags in nsqd).