Skip to content

Commit

Permalink
Revert "[Fleet] Support preconfigured output secrets (elastic#170259)"
Browse files Browse the repository at this point in the history
This reverts commit 1f7a527.
  • Loading branch information
mistic committed Nov 23, 2023
1 parent e7c793e commit 78f7b80
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 512 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@
"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: 16 additions & 9 deletions x-pack/plugins/fleet/common/types/models/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ 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 @@ -50,7 +45,11 @@ interface NewBaseOutput {
allow_edit?: string[];
secrets?: {
ssl?: {
key?: OutputSecret;
key?:
| string
| {
id: string;
};
};
};
}
Expand Down Expand Up @@ -132,9 +131,17 @@ export interface KafkaOutput extends NewBaseOutput {
broker_timeout?: number;
required_acks?: ValueOf<KafkaAcknowledgeReliabilityLevel>;
secrets?: {
password?: OutputSecret;
password?:
| string
| {
id: string;
};
ssl?: {
key?: OutputSecret;
key?:
| string
| {
id: string;
};
};
};
}
14 changes: 2 additions & 12 deletions x-pack/plugins/fleet/server/services/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,7 @@ class OutputService {
soClient: SavedObjectsClientContract,
esClient: ElasticsearchClient,
output: NewOutput,
options?: {
id?: string;
fromPreconfiguration?: boolean;
overwrite?: boolean;
secretHashes?: Record<string, any>;
}
options?: { id?: string; fromPreconfiguration?: boolean; overwrite?: boolean }
): Promise<Output> {
const data: OutputSOAttributes = { ...omit(output, ['ssl', 'secrets']) };
if (output.type === outputType.RemoteElasticsearch) {
Expand Down Expand Up @@ -560,7 +555,6 @@ 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 @@ -722,10 +716,7 @@ class OutputService {
esClient: ElasticsearchClient,
id: string,
data: Partial<Output>,
{
fromPreconfiguration = false,
secretHashes,
}: { fromPreconfiguration: boolean; secretHashes?: Record<string, any> } = {
{ fromPreconfiguration = false }: { fromPreconfiguration: boolean } = {
fromPreconfiguration: false,
}
) {
Expand Down Expand Up @@ -756,7 +747,6 @@ class OutputService {
oldOutput: originalOutput,
outputUpdate: data,
esClient,
secretHashes: data.is_preconfigured ? secretHashes : undefined,
});

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

0 comments on commit 78f7b80

Please sign in to comment.