Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
14e973d
[Fleet] Install security_rule assets as saved objects
rw-access Mar 31, 2021
a386384
Add security-rule to update_assets.ts
rw-access Mar 31, 2021
f75b1a6
Update UUIDs for security_rule asset
rw-access Mar 31, 2021
82706cc
Change .type to match the saved object type not the asset type
rw-access Apr 1, 2021
53e11a6
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 1, 2021
5fe071a
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 1, 2021
e6b276e
Add saved object mapping for security-rule
rw-access Apr 2, 2021
bc2344d
Make SO non-hidden
rw-access Apr 5, 2021
e549480
Merge remote-tracking branch 'origin/master' into fleet-install-secur…
rw-access Apr 5, 2021
f16ebb5
Merge remote-tracking branch 'origin/master' into fleet-install-secur…
rw-access Apr 6, 2021
ef4794d
Fix SO mapping for security-rule
rw-access Apr 6, 2021
ce125b5
Make security-rule a non-hidden asset
rw-access Apr 6, 2021
c7b49e0
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 7, 2021
4f0cfba
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 7, 2021
bca5044
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 7, 2021
6e392fc
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 7, 2021
638677e
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 8, 2021
3d23655
Merge branch 'master' into fleet-install-security-rule-asset
kibanamachine Apr 8, 2021
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 @@ -31,6 +31,7 @@ describe('Fleet - packageToPackagePolicy', () => {
map: [],
lens: [],
ml_module: [],
security_rule: [],
},
elasticsearch: {
ingest_pipeline: [],
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum KibanaAssetType {
indexPattern = 'index_pattern',
map = 'map',
lens = 'lens',
securityRule = 'security_rule',
mlModule = 'ml_module',
}

Expand All @@ -64,6 +65,7 @@ export enum KibanaSavedObjectType {
map = 'map',
lens = 'lens',
mlModule = 'ml-module',
securityRule = 'security-rule',
}

export enum ElasticsearchAssetType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const AssetTitleMap: Record<AssetType, string> = {
map: 'Map',
data_stream_ilm_policy: 'Data Stream ILM Policy',
lens: 'Lens',
security_rule: 'Security Rule',
ml_module: 'ML Module',
};

Expand All @@ -48,6 +49,7 @@ export const AssetIcons: Record<KibanaAssetType, IconType> = {
visualization: 'visualizeApp',
map: 'emsApp',
lens: 'lensApp',
security_rule: 'securityApp',
ml_module: 'mlApp',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const KibanaSavedObjectTypeMapping: Record<KibanaAssetType, KibanaSavedObjectTyp
[KibanaAssetType.visualization]: KibanaSavedObjectType.visualization,
[KibanaAssetType.lens]: KibanaSavedObjectType.lens,
[KibanaAssetType.mlModule]: KibanaSavedObjectType.mlModule,
[KibanaAssetType.securityRule]: KibanaSavedObjectType.securityRule,
};

// Define how each asset type will be installed
Expand All @@ -55,6 +56,7 @@ const AssetInstallers: Record<
[KibanaAssetType.visualization]: installKibanaSavedObjects,
[KibanaAssetType.lens]: installKibanaSavedObjects,
[KibanaAssetType.mlModule]: installKibanaSavedObjects,
[KibanaAssetType.securityRule]: installKibanaSavedObjects,
};

export async function getKibanaAsset(key: string): Promise<ArchiveAsset> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const tests = [
name: 'coredns',
version: '1.0.1',
},
// Non existant dataset
// Non existent dataset
dataset: 'foo',
filter: (path: string) => {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,27 @@ export const type: SavedObjectsType = {
namespaceType: 'single',
mappings: ruleStatusSavedObjectMappings,
};

export const ruleAssetSavedObjectType = 'security-rule';
Copy link
Copy Markdown
Contributor Author

@rw-access rw-access Apr 2, 2021

Choose a reason for hiding this comment

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

@FrankHassanabad is this change okay?
for some reason, it doesn't look like fleet hasn't yet recognized this saved object when running tests (at least locally)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be ok. Don't see anything weird here.


export const ruleAssetSavedObjectMappings: SavedObjectsType['mappings'] = {
dynamic: false,
properties: {
name: {
type: 'keyword',
},
rule_id: {
type: 'keyword',
},
version: {
type: 'long',
},
},
};

export const ruleAssetType: SavedObjectsType = {
name: ruleAssetSavedObjectType,
hidden: false,
namespaceType: 'agnostic',
mappings: ruleAssetSavedObjectMappings,
};
6 changes: 5 additions & 1 deletion x-pack/plugins/security_solution/server/saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import { CoreSetup } from '../../../../src/core/server';

import { noteType, pinnedEventType, timelineType } from './lib/timeline/saved_object_mappings';
import { type as ruleStatusType } from './lib/detection_engine/rules/saved_object_mappings';
import {
type as ruleStatusType,
ruleAssetType,
} from './lib/detection_engine/rules/saved_object_mappings';
import { type as ruleActionsType } from './lib/detection_engine/rule_actions/saved_object_mappings';
import { type as signalsMigrationType } from './lib/detection_engine/migrations/saved_objects';
import {
Expand All @@ -21,6 +24,7 @@ const types = [
pinnedEventType,
ruleActionsType,
ruleStatusType,
ruleAssetType,
timelineType,
exceptionsArtifactType,
manifestType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ const expectAssetsInstalled = ({
id: 'sample_ml_module',
});
expect(resMlModule.id).equal('sample_ml_module');
const resSecurityRule = await kibanaServer.savedObjects.get({
type: 'security-rule',
id: 'sample_security_rule',
});
expect(resSecurityRule.id).equal('sample_security_rule');
Comment thread
rw-access marked this conversation as resolved.
const resIndexPattern = await kibanaServer.savedObjects.get({
type: 'index-pattern',
id: 'test-*',
Expand Down Expand Up @@ -472,6 +477,10 @@ const expectAssetsInstalled = ({
id: 'sample_search',
type: 'search',
},
{
id: 'sample_security_rule',
type: 'security-rule',
},
{
id: 'sample_visualization',
type: 'visualization',
Expand Down Expand Up @@ -537,6 +546,7 @@ const expectAssetsInstalled = ({
{ id: 'e21b59b5-eb76-5ab0-bef2-1c8e379e6197', type: 'epm-packages-assets' },
{ id: '4c758d70-ecf1-56b3-b704-6d8374841b34', type: 'epm-packages-assets' },
{ id: 'e786cbd9-0f3b-5a0b-82a6-db25145ebf58', type: 'epm-packages-assets' },
{ id: 'd8b175c3-0d42-5ec7-90c1-d1e4b307a4c2', type: 'epm-packages-assets' },
{ id: '53c94591-aa33-591d-8200-cd524c2a0561', type: 'epm-packages-assets' },
{ id: 'b658d2d4-752e-54b8-afc2-4c76155c1466', type: 'epm-packages-assets' },
],
Expand Down
5 changes: 5 additions & 0 deletions x-pack/test/fleet_api_integration/apis/epm/update_assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ export default function (providerContext: FtrProviderContext) {
id: 'sample_lens',
type: 'lens',
},
{
id: 'sample_security_rule',
type: 'security-rule',
},
{
id: 'sample_ml_module',
type: 'ml-module',
Expand Down Expand Up @@ -350,6 +354,7 @@ export default function (providerContext: FtrProviderContext) {
{ id: '7f4c5aca-b4f5-5f0a-95af-051da37513fc', type: 'epm-packages-assets' },
{ id: '4281a436-45a8-54ab-9724-fda6849f789d', type: 'epm-packages-assets' },
{ id: '2e56f08b-1d06-55ed-abee-4708e1ccf0aa', type: 'epm-packages-assets' },
{ id: '4035007b-9c33-5227-9803-2de8a17523b5', type: 'epm-packages-assets' },
{ id: 'c7bf1a39-e057-58a0-afde-fb4b48751d8c', type: 'epm-packages-assets' },
{ id: '8c665f28-a439-5f43-b5fd-8fda7b576735', type: 'epm-packages-assets' },
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"attributes": {
"author": [
"Elastic"
],
"description": "Identifies a suspicious parent child process relationship with cmd.exe descending from svchost.exe",
"from": "now-9m",
"index": [
"winlogbeat-*",
"logs-endpoint.events.*",
"logs-windows.*"
],
"language": "kuery",
"license": "Elastic License v2",
"name": "Svchost spawning Cmd",
"query": "event.category:process and event.type:(start or process_started) and process.parent.name:svchost.exe and process.name:cmd.exe",
"risk_score": 21,
"rule_id": "sample_security_rule",
"severity": "low",
"tags": [
"Elastic",
"Host",
"Windows",
"Threat Detection",
"Execution"
],
"threat": [
{
"framework": "MITRE ATT\u0026CK",
"tactic": {
"id": "TA0002",
"name": "Execution",
"reference": "https://attack.mitre.org/tactics/TA0002/"
},
"technique": [
{
"id": "T1059",
"name": "Command and Scripting Interpreter",
"reference": "https://attack.mitre.org/techniques/T1059/"
}
]
}
],
"timestamp_override": "event.ingested",
"type": "query",
"version": 7
},
"id": "sample_security_rule",
"type": "security-rule"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"attributes": {
"author": [
"Elastic"
],
"description": "Identifies a suspicious parent child process relationship with cmd.exe descending from svchost.exe",
"from": "now-9m",
"index": [
"winlogbeat-*",
"logs-endpoint.events.*",
"logs-windows.*"
],
"language": "kuery",
"license": "Elastic License v2",
"name": "Svchost spawning Cmd",
"query": "event.category:process and event.type:(start or process_started) and process.parent.name:svchost.exe and process.name:cmd.exe",
"risk_score": 21,
"rule_id": "sample_security_rule",
"severity": "low",
"tags": [
"Elastic",
"Host",
"Windows",
"Threat Detection",
"Execution"
],
"threat": [
{
"framework": "MITRE ATT\u0026CK",
"tactic": {
"id": "TA0002",
"name": "Execution",
"reference": "https://attack.mitre.org/tactics/TA0002/"
},
"technique": [
{
"id": "T1059",
"name": "Command and Scripting Interpreter",
"reference": "https://attack.mitre.org/techniques/T1059/"
}
]
}
],
"timestamp_override": "event.ingested",
"type": "query",
"version": 7
},
"id": "sample_security_rule",
"type": "security-rule"
}