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

Consistent server.ssl settings #8855

Closed
wants to merge 7 commits into from
Closed

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Oct 27, 2016

Per #7777 we want to move towards consistent SSL settings across the stack.

This introduces the following new settings:

  • server.ssl.enabled
  • server.ssl.keyPassphrase
  • server.ssl.certificateAuthorities
  • server.ssl.clientAuthentication
  • server.ssl.supportedProtocols

and deprecates the following:

  • server.ssl.cert -> server.ssl.certificate

We're currently using an undocumented setting secureOptions when creating the http polyglot server; however, per nodejs/node#9025 this is acceptable and I'll be working on a pull request to node to get this documented.

#server.ssl.cert: /path/to/your/server.crt
# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: true
Copy link
Member

Choose a reason for hiding this comment

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

thoughts on changing this to false? for the most part these config examples are set as their defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine switching it to false, especially if it makes it consistent

@jbudz
Copy link
Member

jbudz commented Oct 31, 2016

Will also close #4262

@jbudz
Copy link
Member

jbudz commented Oct 31, 2016

This looks great, I tested protocols, client auth, and passphrases. One minor issue I ran into:

dev mode + a cert specified in config/kibana.yml gives:

{
  statusCode: 502,
  error: "Bad Gateway",
  message: "Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not cert's CN: undefined""
}

I also think it could be nice to add a friendlier error message with passphrases, I know in most areas we are just dumping a stack trace but this slightly more cryptic than usual:

FATAL Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt at Error (native)...

Is it possible to use the server logger with a [fatal] too?

@kobelb
Copy link
Contributor Author

kobelb commented Oct 31, 2016

Nice catch @jbudz you found another setting that the BasePathProxy doesn't support: keyPassphrase. I'll get that added in there.

That cryptic error is one that is thrown by the underlying OpenSSL library, I think we'd manually have to map the OpenSSL errors to something that we want the user's to see.

This error is being thrown before the server logger is configured, so we'd have to change that workflow around; what are your thoughts on this @spalger?

@kobelb
Copy link
Contributor Author

kobelb commented Oct 31, 2016

@spalger Do you happen to remember your original reasoning for the following code in the BasePathProxy:

const httpsAgentConfig = {};
if (certificate === DEV_SSL_CERT_PATH && config.get('server.host') !== 'localhost') {
  httpsAgentConfig.rejectUnauthorized = false;
} else {
  httpsAgentConfig.ca = readFileSync(certificate);
}

In my preliminary testing, if we always set httpsAgentConfig.rejectUnauthorized = false; and the httpsAgentConfig.ca = readFileSync(certificate); we can eliminate some of those situations where we're seeing the browser print out errors like the following

{
  statusCode: 502,
  error: "Bad Gateway",
  message: "Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not cert's CN: undefined""
}

and instead just server up the bad cert, more closely simulating what the user's see without the BasePathProxy.

@spalger
Copy link
Contributor

spalger commented Nov 1, 2016

See #8034 for the reasons behind that conditional.

If we set httpsAgentConfig.rejectUnauthorized = false; then there is no point in setting the ca as the agent will treat any ssl configuration as valid. I agree that better error messages from the BasePathProxy would be nice, but i don't think we should change the way that things are being done in KbnServer to accommodate them.

@kobelb
Copy link
Contributor Author

kobelb commented Nov 8, 2016

Jenkins, test this

@kobelb kobelb force-pushed the ssl-protocol branch 2 times, most recently from 7ad854c to 80bfca5 Compare November 8, 2016 14:12
@kobelb
Copy link
Contributor Author

kobelb commented Nov 8, 2016

The deprecation warnings on usage have been removed per our Zoom discussion, and the BasePathProxy has been modified to work with all settings per my Zoom discussion with @spalger.

@jbudz your peer reviews comments should have been addressed, if you wouldn't mind giving this a second look.

@kobelb
Copy link
Contributor Author

kobelb commented Nov 8, 2016

I just talked to @epixa, and this PR won't be merged until all of the ssl settings are made consistent, so we don't risk only having some of the settings being changed and even more inconsistency.

I still think it'd be beneficial to have you guys look over it as it stands so I don't replicate the same mistakes more than once, but I'll leave that decision up to you all.

@kobelb
Copy link
Contributor Author

kobelb commented Nov 21, 2016

@jbudz @spalger this is ready for a second review.

@kobelb kobelb added the review label Nov 21, 2016
@epixa
Copy link
Contributor

epixa commented Nov 21, 2016

Let's target this for 5.2.0 instead of 5.1.0. It's a huge PR that hasn't undergone extensive review yet, and I suspect it would take each reviewer a good chunk of the day to review this properly. I know @spalger and @jbudz are working on other important stuff for 5.1 right now, so we might as well set the expectation now.

@epixa epixa added v5.2.0 and removed v5.1.0 labels Nov 21, 2016
@kobelb
Copy link
Contributor Author

kobelb commented Dec 5, 2016

@jbudz @spalger you guys think you'll have time to look at this after all the 5.1 release this week?

@jbudz
Copy link
Member

jbudz commented Dec 5, 2016

@kobelb sorry for the long delay. Yeah, I'll hop on this shortly.

@kobelb
Copy link
Contributor Author

kobelb commented Dec 5, 2016

@jbudz no worries at all, I know it's a large one so lemme know if I can do anything to help out

@epixa
Copy link
Contributor

epixa commented Dec 14, 2016

This branch has conflicts. I'm not sure if they are linting related.

@kobelb
Copy link
Contributor Author

kobelb commented Dec 20, 2016

Tribe support is going to introduce a number of conflicts, so I've removed the 'review' label until I resolve all those.

@kobelb kobelb removed the review label Dec 20, 2016
@tbragin tbragin removed the v5.2.0 label Jan 4, 2017
@kobelb
Copy link
Contributor Author

kobelb commented Jan 11, 2017

Closing this PR out in favor of #9823 which integrates all the tribe changes

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.

7 participants