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

[Security Solution][CTI] Add non-ECS Security Solution and CTI mappings (RAC) #101547

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export const esFieldTypeMap = {
float: t.number,
scaled_float: t.number,
unsigned_long: t.number,
nested: t.boolean,
flattened: t.record(t.string, t.array(t.string)),
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const esFieldTypeMap = {
float: t.number,
scaled_float: t.number,
unsigned_long: t.number,
nested: t.boolean,
flattened: t.record(t.string, t.array(t.string)),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const ctiFieldMap = {
'threat.indicator': {
type: 'nested',
array: false,
required: false,
},
'threat.indicator.as.number': {
type: 'long',
array: false,
required: false,
},
'threat.indicator.as.organization.name': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.confidence': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.dataset': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.description': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.domain': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.email.address': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.first_seen': {
type: 'date',
array: false,
required: false,
},
'threat.indicator.geo.city_name': {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are removing the as, geo, and most other nested fields from threat.indicator as per the current RFC.

If these mappings will be used in 7.14, the current implementation makes sense. If these aren't going to be in effect until 7.15, we should strive to use the fields as presented in the RFC.

type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.continent_name': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.country_iso_code': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.country_name': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.location': {
type: 'geo_point',
array: false,
required: false,
},
'threat.indicator.geo.name': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.region_iso_code': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.geo.region_name': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.ip': {
type: 'ip',
array: false,
required: false,
},
'threat.indicator.last_seen': {
type: 'date',
array: false,
required: false,
},
'threat.indicator.marking.tlp': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.matched.atomic': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.matched.field': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.matched.type': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.module': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.port': {
type: 'long',
array: false,
required: false,
},
'threat.indicator.provider': {
type: 'keyword',
array: false,
required: false,
},
'threat.indicator.scanner_stats': {
type: 'long',
array: false,
required: false,
},
'threat.indicator.sightings': {
type: 'long',
array: false,
required: false,
},
'threat.indicator.type': {
type: 'keyword',
array: false,
required: false,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { merge } from 'lodash';
import { ClusterPutComponentTemplateBody } from '../../../../../rule_registry/common/types';
import { mappingFromFieldMap } from '../../../../../rule_registry/common/mapping_from_field_map';
import { ctiFieldMap } from './cti_field_map';
import { securityFieldMap } from './security_field_map';

export const securityComponentTemplate: ClusterPutComponentTemplateBody = {
template: {
settings: {
number_of_shards: 1,
},
mappings: merge({}, mappingFromFieldMap(ctiFieldMap), mappingFromFieldMap(securityFieldMap)),
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const securityFieldMap = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity: what was the logic used to generate this list of fields?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered offline: these are all the fields in the existing signals index that were NOT either:

  1. part of ECS
  2. identified as past/current/future CTI fields.

'as.number': {
type: 'long',
array: false,
required: false,
},
'as.organization.name': {
type: 'keyword',
array: false,
required: false,
},
'code_signature.exists': {
type: 'boolean',
array: false,
required: false,
},
'code_signature.status': {
type: 'keyword',
array: false,
required: false,
},
'code_signature.subject_name': {
type: 'keyword',
array: false,
required: false,
},
'code_signature.trusted': {
type: 'boolean',
array: false,
required: false,
},
'code_signature.valid': {
type: 'boolean',
array: false,
required: false,
},
'geo.city_name': {
type: 'keyword',
array: false,
required: false,
},
'geo.continent_name': {
type: 'keyword',
array: false,
required: false,
},
'geo.country_iso_code': {
type: 'keyword',
array: false,
required: false,
},
'geo.country_name': {
type: 'keyword',
array: false,
required: false,
},
'geo.location': {
type: 'geo_point',
array: false,
required: false,
},
'geo.name': {
type: 'keyword',
array: false,
required: false,
},
'geo.region_iso_code': {
type: 'keyword',
array: false,
required: false,
},
'geo.region_name': {
type: 'keyword',
array: false,
required: false,
},
'hash.md5': {
type: 'keyword',
array: false,
required: false,
},
'hash.sha1': {
type: 'keyword',
array: false,
required: false,
},
'hash.sha256': {
type: 'keyword',
array: false,
required: false,
},
'hash.sha512': {
type: 'keyword',
array: false,
required: false,
},
'interface.alias': {
type: 'keyword',
array: false,
required: false,
},
'interface.id': {
type: 'keyword',
array: false,
required: false,
},
'interface.name': {
type: 'keyword',
array: false,
required: false,
},
'os.family': {
type: 'keyword',
array: false,
required: false,
},
'os.full': {
type: 'keyword',
array: false,
required: false,
},
'os.kernel': {
type: 'keyword',
array: false,
required: false,
},
'os.name': {
type: 'keyword',
array: false,
required: false,
},
'os.platform': {
type: 'keyword',
array: false,
required: false,
},
'os.version': {
type: 'keyword',
array: false,
required: false,
},
'pe.company': {
type: 'keyword',
array: false,
required: false,
},
'pe.description': {
type: 'keyword',
array: false,
required: false,
},
'pe.file_version': {
type: 'keyword',
array: false,
required: false,
},
'pe.original_file_name': {
type: 'keyword',
array: false,
required: false,
},
'pe.product': {
type: 'keyword',
array: false,
required: false,
},
'vlan.id': {
type: 'keyword',
array: false,
required: false,
},
'vlan.name': {
type: 'keyword',
array: false,
required: false,
},
};
10 changes: 2 additions & 8 deletions x-pack/plugins/security_solution/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import { PolicyWatcher } from './endpoint/lib/policy/license_watch';
import { securitySolutionTimelineEqlSearchStrategyProvider } from './search_strategy/timeline/eql';
import { parseExperimentalConfigValue } from '../common/experimental_features';
import { migrateArtifactsToFleet } from './endpoint/lib/artifacts/migrate_artifacts_to_fleet';
import { securityComponentTemplate } from './lib/detection_engine/assets/security_component_template';

export interface SetupPlugins {
alerting: AlertingSetup;
Expand Down Expand Up @@ -224,14 +225,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S

await ruleDataService.createOrUpdateComponentTemplate({
name: componentTemplateName,
body: {
template: {
settings: {
number_of_shards: 1,
},
mappings: {}, // TODO: Add mappings here via `mappingFromFieldMap()`
},
},
body: securityComponentTemplate,
});

await ruleDataService.createOrUpdateIndexTemplate({
Expand Down