diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.test.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.test.ts index d05107e5058d4..7a045ce0b0074 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.test.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.test.ts @@ -19,7 +19,8 @@ describe('getInstallCommandForPlatform', () => { expect(res).toMatchInlineSnapshot(` "sudo ./elastic-agent install \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ - --fleet-server-service-token=service-token-1" + --fleet-server-service-token=service-token-1 \\\\ + --fleet-server-insecure-http" `); }); @@ -33,7 +34,8 @@ describe('getInstallCommandForPlatform', () => { expect(res).toMatchInlineSnapshot(` ".\\\\elastic-agent.exe install \` --fleet-server-es=http://elasticsearch:9200 \` - --fleet-server-service-token=service-token-1" + --fleet-server-service-token=service-token-1 \` + --fleet-server-insecure-http" `); }); @@ -47,7 +49,8 @@ describe('getInstallCommandForPlatform', () => { expect(res).toMatchInlineSnapshot(` "sudo elastic-agent enroll \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ - --fleet-server-service-token=service-token-1" + --fleet-server-service-token=service-token-1 \\\\ + --fleet-server-insecure-http" `); }); @@ -66,7 +69,8 @@ describe('getInstallCommandForPlatform', () => { "sudo ./elastic-agent install \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ --fleet-server-service-token=service-token-1 \\\\ - --fleet-server-es-ca-trusted-fingerprint=fingerprint123456" + --fleet-server-es-ca-trusted-fingerprint=fingerprint123456 \\\\ + --fleet-server-insecure-http" `); }); }); @@ -84,7 +88,8 @@ describe('getInstallCommandForPlatform', () => { "sudo ./elastic-agent install \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ --fleet-server-service-token=service-token-1 \\\\ - --fleet-server-policy=policy-1" + --fleet-server-policy=policy-1 \\\\ + --fleet-server-insecure-http" `); }); @@ -100,7 +105,8 @@ describe('getInstallCommandForPlatform', () => { ".\\\\elastic-agent.exe install \` --fleet-server-es=http://elasticsearch:9200 \` --fleet-server-service-token=service-token-1 \` - --fleet-server-policy=policy-1" + --fleet-server-policy=policy-1 \` + --fleet-server-insecure-http" `); }); @@ -116,7 +122,8 @@ describe('getInstallCommandForPlatform', () => { "sudo elastic-agent enroll \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ --fleet-server-service-token=service-token-1 \\\\ - --fleet-server-policy=policy-1" + --fleet-server-policy=policy-1 \\\\ + --fleet-server-insecure-http" `); }); }); @@ -199,7 +206,8 @@ describe('getInstallCommandForPlatform', () => { expect(res).toMatchInlineSnapshot(` "sudo elastic-agent enroll \\\\ --fleet-server-es=http://elasticsearch:9200 \\\\ - --fleet-server-service-token=service-token-1" + --fleet-server-service-token=service-token-1 \\\\ + --fleet-server-insecure-http" `); }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.ts index 64ae4903af53f..1b9d7d2d6230d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/components/install_command_utils.ts @@ -40,13 +40,16 @@ export function getInstallCommandForPlatform( } commandArguments.push(['fleet-server-cert', '']); commandArguments.push(['fleet-server-cert-key', '']); + } else { + commandArguments.push(['fleet-server-insecure-http']); } const commandArgumentsStr = commandArguments.reduce((acc, [key, val]) => { if (acc === '' && key === 'url') { return `--${key}=${val}`; } - return (acc += ` ${newLineSeparator} --${key}=${val}`); + const valOrEmpty = val ? `=${val}` : ''; + return (acc += ` ${newLineSeparator} --${key}${valOrEmpty}`); }, ''); switch (platform) {