-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fleet] Configure ca trusted fingerprint for on prem users #120549
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
856a007
[Fleet] Configure ca trusted fingerprint for on prem users
nchaulet 5579aef
Add ca_trusted_fingerprint to the output model
nchaulet d80d284
Merge branch 'main' of github.com:elastic/kibana into fleet-ca-truste…
nchaulet 2229309
fix fleet server instrucitons
nchaulet 226c94c
Add missing test
nchaulet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,37 +13,49 @@ export function getInstallCommandForPlatform( | |
serviceToken: string, | ||
policyId?: string, | ||
fleetServerHost?: string, | ||
isProductionDeployment?: boolean | ||
isProductionDeployment?: boolean, | ||
sslCATrustedFingerprint?: string | ||
) { | ||
let commandArguments = ''; | ||
const newLineSeparator = platform === 'windows' ? '`' : '\\'; | ||
const commandArguments = []; | ||
const newLineSeparator = platform === 'windows' ? '`\n' : '\\\n'; | ||
|
||
if (isProductionDeployment && fleetServerHost) { | ||
commandArguments += `--url=${fleetServerHost} ${newLineSeparator}\n`; | ||
} else { | ||
commandArguments += ` ${newLineSeparator}\n`; | ||
commandArguments.push(['url', fleetServerHost]); | ||
} | ||
|
||
commandArguments += ` --fleet-server-es=${esHost}`; | ||
commandArguments += ` ${newLineSeparator}\n --fleet-server-service-token=${serviceToken}`; | ||
commandArguments.push(['fleet-server-es', esHost]); | ||
commandArguments.push(['fleet-server-service-token', serviceToken]); | ||
if (policyId) { | ||
commandArguments += ` ${newLineSeparator}\n --fleet-server-policy=${policyId}`; | ||
commandArguments.push(['fleet-server-policy', policyId]); | ||
} | ||
|
||
if (sslCATrustedFingerprint) { | ||
commandArguments.push(['fleet-server-es-ca-trusted-fingerprint', sslCATrustedFingerprint]); | ||
} | ||
|
||
if (isProductionDeployment) { | ||
commandArguments += ` ${newLineSeparator}\n --certificate-authorities=<PATH_TO_CA>`; | ||
commandArguments += ` ${newLineSeparator}\n --fleet-server-es-ca=<PATH_TO_ES_CERT>`; | ||
commandArguments += ` ${newLineSeparator}\n --fleet-server-cert=<PATH_TO_FLEET_SERVER_CERT>`; | ||
commandArguments += ` ${newLineSeparator}\n --fleet-server-cert-key=<PATH_TO_FLEET_SERVER_CERT_KEY>`; | ||
commandArguments.push(['certificate-authorities', '<PATH_TO_CA>']); | ||
if (!sslCATrustedFingerprint) { | ||
commandArguments.push(['fleet-server-es-ca', '<PATH_TO_ES_CERT>']); | ||
} | ||
commandArguments.push(['fleet-server-cert', '<PATH_TO_FLEET_SERVER_CERT>']); | ||
commandArguments.push(['fleet-server-cert-key', '<PATH_TO_FLEET_SERVER_CERT_KEY>']); | ||
} | ||
|
||
const commandArgumentsStr = commandArguments.reduce((acc, [key, val]) => { | ||
if (acc === '' && key === 'url') { | ||
return `--${key}=${val}`; | ||
} | ||
return (acc += ` ${newLineSeparator} --${key}=${val}`); | ||
}, ''); | ||
Comment on lines
+45
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👍 |
||
|
||
switch (platform) { | ||
case 'linux-mac': | ||
return `sudo ./elastic-agent install ${commandArguments}`; | ||
return `sudo ./elastic-agent install ${commandArgumentsStr}`; | ||
case 'windows': | ||
return `.\\elastic-agent.exe install ${commandArguments}`; | ||
return `.\\elastic-agent.exe install ${commandArgumentsStr}`; | ||
case 'rpm-deb': | ||
return `sudo elastic-agent enroll ${commandArguments}`; | ||
return `sudo elastic-agent enroll ${commandArgumentsStr}`; | ||
default: | ||
return ''; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Much prefer this to the previous config name but is it worth aligning this with elasticsearch-js client for consistency?
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/basic-config.html
(We don't use
elasticsearch.ssl.trustedCertificateAuthorities
either but I don't know what Fleet conventions are)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field is named
ca_trusted_fingerprint
in libbeat and the agent, so I think we probably to keep that consistent here.