Skip to content
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] Support preconfigured output secrets #170259

Merged
merged 24 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dac8a85
add node-argon2
hop-dev Oct 25, 2023
d70b9dd
add hash to saved object mapping
hop-dev Oct 31, 2023
cf99bed
add hash to output type
hop-dev Oct 31, 2023
38d4e4a
use argon2 to diff preconfigured secrets
hop-dev Oct 31, 2023
f119d43
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Oct 31, 2023
9e3d696
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine Oct 31, 2023
65afd55
Merge branch 'main' into HEAD
jillguyonnet Nov 10, 2023
32d3d08
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine Nov 10, 2023
b8b5b7c
Configure argon2 with recommended params
jillguyonnet Nov 15, 2023
85aaaf2
Add and fix preconfigured output tests
jillguyonnet Nov 15, 2023
49fdb03
Add type to hash param
jillguyonnet Nov 16, 2023
3429e0f
Fix typo
jillguyonnet Nov 16, 2023
a1718ce
Merge branch 'main' into 166360-preconfigured-output-secrets
kibanamachine Nov 16, 2023
279f3f7
Fix and add unit tests
jillguyonnet Nov 21, 2023
99f10d9
Exclude hash from SO mappings
jillguyonnet Nov 21, 2023
aacc26d
Merge branch 'main' into 166360-preconfigured-output-secrets
kibanamachine Nov 21, 2023
aa387ae
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine Nov 21, 2023
93441a5
Merge branch 'main' into 166360-preconfigured-output-secrets
kibanamachine Nov 21, 2023
8509230
Add extra unit tests
jillguyonnet Nov 22, 2023
38e12f0
Remove SO mappings
jillguyonnet Nov 22, 2023
b2921ce
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine Nov 22, 2023
ce1b576
Merge branch 'main' into 166360-preconfigured-output-secrets
kibanamachine Nov 22, 2023
7baa692
Merge branch 'main' into 166360-preconfigured-output-secrets
kibanamachine Nov 22, 2023
7707de5
Improve log messages
jillguyonnet Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@
"ansi-regex": "^5.0.1",
"antlr4ts": "^0.5.0-alpha.3",
"archiver": "^5.3.1",
"argon2": "0.31.1",
"async": "^3.2.3",
"aws4": "^1.12.0",
"axios": "^1.6.0",
Expand Down
25 changes: 9 additions & 16 deletions x-pack/plugins/fleet/common/types/models/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ export type KafkaPartitionType = typeof kafkaPartitionType;
export type KafkaTopicWhenType = typeof kafkaTopicWhenType;
export type KafkaAcknowledgeReliabilityLevel = typeof kafkaAcknowledgeReliabilityLevel;
export type KafkaVerificationMode = typeof kafkaVerificationModes;

export type OutputSecret =
| string
| {
id: string;
hash?: string;
};
interface NewBaseOutput {
is_default: boolean;
is_default_monitoring: boolean;
Expand All @@ -45,11 +50,7 @@ interface NewBaseOutput {
allow_edit?: string[];
secrets?: {
ssl?: {
key?:
| string
| {
id: string;
};
key?: OutputSecret;
};
};
}
Expand Down Expand Up @@ -131,17 +132,9 @@ export interface KafkaOutput extends NewBaseOutput {
broker_timeout?: number;
required_acks?: ValueOf<KafkaAcknowledgeReliabilityLevel>;
secrets?: {
password?:
| string
| {
id: string;
};
password?: OutputSecret;
ssl?: {
key?:
| string
| {
id: string;
};
key?: OutputSecret;
};
};
}
14 changes: 12 additions & 2 deletions x-pack/plugins/fleet/server/services/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,12 @@ class OutputService {
soClient: SavedObjectsClientContract,
esClient: ElasticsearchClient,
output: NewOutput,
options?: { id?: string; fromPreconfiguration?: boolean; overwrite?: boolean }
options?: {
id?: string;
fromPreconfiguration?: boolean;
overwrite?: boolean;
secretHashes?: Record<string, any>;
}
): Promise<Output> {
const data: OutputSOAttributes = { ...omit(output, ['ssl', 'secrets']) };
if (output.type === outputType.RemoteElasticsearch) {
Expand Down Expand Up @@ -555,6 +560,7 @@ class OutputService {
const { output: outputWithSecrets } = await extractAndWriteOutputSecrets({
output,
esClient,
secretHashes: output.is_preconfigured ? options?.secretHashes : undefined,
});

if (outputWithSecrets.secrets) data.secrets = outputWithSecrets.secrets;
Expand Down Expand Up @@ -716,7 +722,10 @@ class OutputService {
esClient: ElasticsearchClient,
id: string,
data: Partial<Output>,
{ fromPreconfiguration = false }: { fromPreconfiguration: boolean } = {
{
fromPreconfiguration = false,
secretHashes,
}: { fromPreconfiguration: boolean; secretHashes?: Record<string, any> } = {
fromPreconfiguration: false,
}
) {
Expand Down Expand Up @@ -747,6 +756,7 @@ class OutputService {
oldOutput: originalOutput,
outputUpdate: data,
esClient,
secretHashes: data.is_preconfigured ? secretHashes : undefined,
});

updateData.secrets = secretsRes.outputUpdate.secrets;
Expand Down