diff --git a/ee/vulnerability-dashboard/docker-compose.yml b/ee/vulnerability-dashboard/docker-compose.yml index a1c92cdaed6e..054743ea65ea 100644 --- a/ee/vulnerability-dashboard/docker-compose.yml +++ b/ee/vulnerability-dashboard/docker-compose.yml @@ -14,6 +14,7 @@ services: sails_session__url: redis://redis:6379 sails_custom__fleetBaseUrl: '' #Add the base url of your Fleet instance: ex: https://fleet.example.com sails_custom__fleetApiToken: '' # Add the API token of an API-only user [?] Here's how you get one: https://fleetdm.com/docs/using-fleet/fleetctl-cli#get-the-api-token-of-an-api-only-user + sails_custom__fleetApiOptionalCookie: '' # If your fleet instance requires optional cookies, use this to interact with the APIs redis: image: "redis:alpine" diff --git a/ee/vulnerability-dashboard/scripts/replace-placeholder-host-values.js b/ee/vulnerability-dashboard/scripts/replace-placeholder-host-values.js index 20ecc4236899..89a2ff093b51 100644 --- a/ee/vulnerability-dashboard/scripts/replace-placeholder-host-values.js +++ b/ee/vulnerability-dashboard/scripts/replace-placeholder-host-values.js @@ -27,6 +27,10 @@ module.exports = { Authorization: `Bearer ${sails.config.custom.fleetApiToken}` }; + if (sails.config.custom.fleetApiOptionalCookie) { + headers['Cookie'] = sails.config.custom.fleetApiOptionalCookie; + } + let page = 0; let HOSTS_PAGE_SIZE = 100; @@ -85,4 +89,3 @@ module.exports = { }; - diff --git a/ee/vulnerability-dashboard/scripts/update-critical-software.js b/ee/vulnerability-dashboard/scripts/update-critical-software.js index efda7e2ee41f..29c0cc462b32 100644 --- a/ee/vulnerability-dashboard/scripts/update-critical-software.js +++ b/ee/vulnerability-dashboard/scripts/update-critical-software.js @@ -28,6 +28,9 @@ module.exports = { let headers = { Authorization: `Bearer ${sails.config.custom.fleetApiToken}` }; + if (sails.config.custom.fleetApiOptionalCookie) { + headers['Cookie'] = sails.config.custom.fleetApiOptionalCookie; + } sails.log('Running custom shell script... (`sails run update-critical-software`)'); @@ -354,4 +357,3 @@ module.exports = { }; - diff --git a/ee/vulnerability-dashboard/scripts/update-reports.js b/ee/vulnerability-dashboard/scripts/update-reports.js index fa56ac2c231b..92128905370d 100644 --- a/ee/vulnerability-dashboard/scripts/update-reports.js +++ b/ee/vulnerability-dashboard/scripts/update-reports.js @@ -28,6 +28,9 @@ module.exports = { let headers = { Authorization: `Bearer ${sails.config.custom.fleetApiToken}` }; + if (sails.config.custom.fleetApiOptionalCookie) { + headers['Cookie'] = sails.config.custom.fleetApiOptionalCookie; + } // Keep track of the latest vulnerabilities, hosts, and software seen in the Fleet scan. // We'll use these later to check if any records have gone missing.