Skip to content

Do not verify certs when using custom host and default certs#8034

Merged
spalger merged 2 commits intoelastic:masterfrom
spalger:implement/ignoreCertErrorsInDev
Aug 23, 2016
Merged

Do not verify certs when using custom host and default certs#8034
spalger merged 2 commits intoelastic:masterfrom
spalger:implement/ignoreCertErrorsInDev

Conversation

@spalger
Copy link
Copy Markdown
Contributor

@spalger spalger commented Aug 19, 2016

When running kibana in dev mode, the basePathProxy is active by default and requires that the hostname matches the hostname embedded in the ssl certificates used. This causes an issue when the --host cli arg is passed and blocks access to kibana via the proxy.

To fix that we disable ssl verification between the basePathProxy and the kibana server when the host is customized but the ssl certs are not (meaning the bundled dev certs will be used).

this.proxyAgent = new HttpsAgent({
ca: readFileSync(cert)
});
const httpsAgentConfig = {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why didn't HttpAgent API do the sensible thing and call the property allowUnauthorized, and not have a falsy value default to true. ;)

@thomasneirynck
Copy link
Copy Markdown
Contributor

LGTM

I like how this preserves the default startup behaviour in -dev, but overriding the server.host-param doesn't force users to start juggling cert files.

@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 19, 2016

I'll check this out on monday, I wanna test it with a couple VMs to make sure all is good!

@thomasneirynck thomasneirynck removed their assignment Aug 21, 2016
@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 22, 2016

@spalger I ran npm start -- --host 192.168.10.104

But I'm getting a page with the following JSON when I try to access Kibana at the url:

{"statusCode":502,"error":"Bad Gateway","message":"Hostname/IP doesn't match certificate's altnames: \"IP: 192.168.10.104 is not in the cert's list: \""}

screen shot 2016-08-22 at 5 49 11 pm

Am I forgetting something?

@spalger spalger force-pushed the implement/ignoreCertErrorsInDev branch from 8c5bb8e to 5183efd Compare August 22, 2016 22:12
@spalger
Copy link
Copy Markdown
Contributor Author

spalger commented Aug 22, 2016

@Bargs my bad, I forgot that the ssl config is defined via the userSettings when --dev mode is enabled. Changed to check for the specific scenario that the dev certs are being used, but the hostname is not localhost.

@Bargs
Copy link
Copy Markdown
Contributor

Bargs commented Aug 23, 2016

It works! 🎆

LGTM - thanks for figuring out a solution to this @spalger, it's going to make IE dev a lot easier

@Bargs Bargs assigned spalger and unassigned Bargs Aug 23, 2016
@spalger spalger merged commit 19a8738 into elastic:master Aug 23, 2016
@spalger spalger deleted the implement/ignoreCertErrorsInDev branch August 23, 2016 22:51
@epixa epixa added the dev label Oct 26, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
…rsInDev

Do not verify certs when using custom host and default certs

Former-commit-id: 19a8738
e40pud added a commit that referenced this pull request Nov 13, 2023
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.

4 participants