mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Canvas] - Allow timelion data source to use configured certificateAuthorities (#26809)
* allow timelion data source to use configured certificateAuthorities * make it obvious that this is a temporary measure * fix lint error * Update src/legacy/core_plugins/interpreter/server/lib/create_handlers.js Co-Authored-By: legrego <lgregorydev@gmail.com> * fix lint error from comment updated via GH
This commit is contained in:
parent
746ed07505
commit
2bbc821024
2 changed files with 23 additions and 1 deletions
|
@ -27,6 +27,9 @@ export const createHandlers = (request, server) => {
|
|||
|
||||
return {
|
||||
environment: 'server',
|
||||
// TODO: https://github.com/elastic/kibana/issues/27437 - A temporary measure to allow the timelion data source to negotiate secure connections to the Kibana server, to be removed by 6.7
|
||||
// See https://github.com/elastic/kibana/pull/26809 and https://github.com/elastic/kibana/issues/26812
|
||||
__dangerouslyUnsupportedSslConfig: server.config().get('server.ssl'),
|
||||
serverUri:
|
||||
config.has('server.rewriteBasePath') && config.get('server.rewriteBasePath')
|
||||
? `${server.info.uri}${config.get('server.basePath')}`
|
||||
|
|
|
@ -4,10 +4,28 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { flatten } from 'lodash';
|
||||
import https from 'https';
|
||||
import { readFileSync } from 'fs';
|
||||
import _, { flatten } from 'lodash';
|
||||
import { fetch } from '../../../../common/lib/fetch';
|
||||
import { buildBoolArray } from '../../../../server/lib/build_bool_array';
|
||||
|
||||
const readFile = file => readFileSync(file, 'utf8');
|
||||
|
||||
function parseConfig(sslConfig = {}) {
|
||||
const config = {
|
||||
ssl: {
|
||||
rejectUnauthorized: true,
|
||||
},
|
||||
};
|
||||
|
||||
if (_.size(_.get(sslConfig, 'certificateAuthorities'))) {
|
||||
config.ssl.ca = sslConfig.certificateAuthorities.map(readFile);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export const timelion = () => ({
|
||||
name: 'timelion',
|
||||
context: {
|
||||
|
@ -77,6 +95,7 @@ export const timelion = () => ({
|
|||
...handlers.httpHeaders,
|
||||
},
|
||||
data: body,
|
||||
httpsAgent: new https.Agent(parseConfig(handlers.__dangerouslyUnsupportedSslConfig).ssl),
|
||||
}).then(resp => {
|
||||
const seriesList = resp.data.sheet[0].list;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue