Skip to content

Commit

Permalink
fix: provide option to enable certificate verification
Browse files Browse the repository at this point in the history
Addresses #63
  • Loading branch information
JasonConger committed Sep 2, 2022
1 parent 4e98380 commit e8c9d23
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fixed issue that marked python.version settings invalid for modular inputs in inputs.conf. Issue [#50](https://github.com/splunk/vscode-extension-splunk/issues/50)
- Fixed issues with searchbnf.conf files. Issue [#49](https://github.com/splunk/vscode-extension-splunk/issues/49)
- Added version to spec config object so that special version comparisons and fixes can be implemented. See issue [#53](https://github.com/splunk/vscode-extension-splunk/issues/53)
- Added option to enable certificate verification. See issue [#63](https://github.com/splunk/vscode-extension-splunk/issues/63)

## [0.2.8]
- Added spec files for Splunk 8.1 and 8.2
Expand Down
8 changes: 5 additions & 3 deletions out/embeddedReportProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
const vscode = require("vscode");
const splunkToken = vscode.workspace.getConfiguration().get('splunk.commands.token');
const splunkUrl = vscode.workspace.getConfiguration().get('splunk.commands.splunkRestUrl');
const enableCertificateVerification = vscode.workspace.getConfiguration().get('splunk.commands.enableCertificateVerification');
const https = require("https");
const agent = new https.Agent({
rejectUnauthorized: false
});
const axios = require("axios");

axios.defaults.headers.common["Authorization"] = `Bearer ${splunkToken}`;
const agent = new https.Agent({
rejectUnauthorized: enableCertificateVerification
});

const splunkSavedSearchProvider = require("./searchProvider.js");

Expand Down
8 changes: 5 additions & 3 deletions out/searchProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ const vscode = require("vscode");
const splunkUrl = vscode.workspace.getConfiguration().get('splunk.commands.splunkRestUrl');
const splunkToken = vscode.workspace.getConfiguration().get('splunk.commands.token');
const outputMode = vscode.workspace.getConfiguration().get('splunk.search.searchOutputMode');
const enableCertificateVerification = vscode.workspace.getConfiguration().get('splunk.commands.enableCertificateVerification');
const https = require("https");
const agent = new https.Agent({
rejectUnauthorized: false
});
const axios = require("axios");

axios.defaults.headers.common["Authorization"] = `Bearer ${splunkToken}`;
const agent = new https.Agent({
rejectUnauthorized: enableCertificateVerification
});

class SearchProvider {
constructor() {}
Expand Down
72 changes: 44 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,6 @@
"configuration": {
"title": "Splunk",
"properties": {
"splunk.enableSplunkExplorer": {
"type": "boolean",
"description": "Enables the Splunk Explorer in the activity bar.",
"default": true
},
"splunk.reports.viewRefreshInterval": {
"type": "integer",
"scope": "resource",
"default": 300,
"description": "Specify an interval, in seconds, to refresh embedded reports."
},
"splunk.reports.SplunkSearchHead": {
"type": "string",
"scope": "resource",
"default": "http://localhost:8000",
"description": "Specify the Search Head URL used to display reports."
},
"splunk.spec.FilePath": {
"type": "string",
"scope": "resource",
"default": "",
"description": "Specify an absolute path to the Splunk spec files. For example, if Splunk is installed locally, $SPLUNK_HOME/etc/system/README/ can be used where $SPLUNK_HOME is set to the path where Splunk is installed.\nNote: leave this setting blank to use built-in spec files."
},
"splunk.spec.FileVersion": {
"type": "string",
"enum": [
Expand All @@ -96,28 +73,52 @@
"8.2",
"9.0"
],
"order": 0,
"scope": "resource",
"default": "9.0",
"description": "Specifies the version of spec files to use.\nNote: this setting is ignored if you specify a Spec File Path."
},
"splunk.spec.trimEqualSignWhitespace": {
"type": "boolean",
"splunk.spec.FilePath": {
"type": "string",
"scope": "resource",
"default": false,
"description": "When auto-completing settings, trim whitespace around the '=' sign. For example, key = value will become key=value.\nNote: changing this setting requires a restart of Visual Studio Code."
"default": "",
"order": 1,
"description": "Specify an absolute path to the Splunk spec files. For example, if Splunk is installed locally, $SPLUNK_HOME/etc/system/README/ can be used where $SPLUNK_HOME is set to the path where Splunk is installed.\nNote: leave this setting blank to use built-in spec files."
},
"splunk.enableSplunkExplorer": {
"type": "boolean",
"description": "Enables the Splunk Explorer in the activity bar.",
"default": true,
"order": 2
},
"splunk.commands.splunkRestUrl": {
"type": "string",
"scope": "resource",
"default": "https://localhost:8089",
"description": "Specify the URL for the Splunk REST API"
"description": "Specify the URL for the Splunk REST API",
"order": 3
},
"splunk.commands.enableCertificateVerification": {
"type": "boolean",
"scope": "resource",
"default": false,
"description": "Enable SSL certificate verification for Splunk",
"order": 4
},
"splunk.commands.token": {
"type": "string",
"scope": "resource",
"default": "",
"order": 5,
"description": "Splunk Enterprise token used for authentication. Refer to the Splunk documentation for more information about tokens at https://docs.splunk.com/Documentation/Splunk/latest/Security/UseAuthTokens"
},
"splunk.reports.SplunkSearchHead": {
"type": "string",
"scope": "resource",
"default": "http://localhost:8000",
"order": 6,
"description": "Specify the Search Head URL used to display reports."
},
"splunk.search.searchOutputMode": {
"type": "string",
"enum": [
Expand All @@ -127,7 +128,22 @@
],
"scope": "resource",
"default": "csv",
"order": 7,
"description": "Controls how Splunk search results are rendered"
},
"splunk.reports.viewRefreshInterval": {
"type": "integer",
"scope": "resource",
"default": 300,
"order": 8,
"description": "Specify an interval, in seconds, to refresh embedded reports."
},
"splunk.spec.trimEqualSignWhitespace": {
"type": "boolean",
"scope": "resource",
"default": false,
"order": 9,
"description": "When auto-completing settings, trim whitespace around the '=' sign. For example, key = value will become key=value.\nNote: changing this setting requires a restart of Visual Studio Code."
}
}
},
Expand Down

0 comments on commit e8c9d23

Please sign in to comment.