-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom fleet policy UX for new integration (cloud defend v1) (#147300)
## Summary New Kibana plugin created for an integration called "Cloud defend for containers" which will have a corresponding agent service which can proactively block and alert on executable creation or modification in a running container. This plugin is purely in place to configure the fleet policy UX around this new integration. For now we have added a yaml editor as a custom input to our integration. The monaco-yaml libary was added to allow support for JSON schema validation support for yaml. Integration PR is up, and a work in progress: (waiting on some content for the doc page) elastic/integrations#4680 ### Screenshot  ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) Co-authored-by: Karl Godard <karlgodard@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
7a6eac8
commit 0b19cfa
Showing
34 changed files
with
918 additions
and
6 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"prefix": "cloudDefend", | ||
"paths": { | ||
"cloudDefend": "." | ||
}, | ||
"translations": ["translations/ja-JP.json"] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Cloud Defend (for containers) | ||
|
||
This plugin currently only exists to provide custom fleet policy UX for a set of new BPF LSM features. The first feature being container "drift prevention". | ||
|
||
Drift prevention is a way to block when executables are created or modified. Our agent service detects these events, and applies a set of selectors and responses configured to either block, alert or both. | ||
|
||
## Example configuration | ||
``` | ||
selectors: | ||
# default selector (user can modify or remove if they want) | ||
- name: default | ||
operation: [createExecutable, modifyExecutable, execMemFd] | ||
# example custom selector | ||
- name: nginxOnly | ||
containerImageName: | ||
- nginx | ||
# example selector used for exclude | ||
- name: excludeCustomNginxBuild | ||
containerImageTag: | ||
- staging | ||
# responses are evaluated from top to bottom | ||
# only the first response with a match will run its actions | ||
responses: | ||
- match: [nginxOnly] | ||
exclude: [excludeCustomNginxBuild] | ||
actions: [alert, block] | ||
# default response | ||
# delete this if no default response needed | ||
- match: [default] | ||
actions: [alert] | ||
``` | ||
|
||
--- | ||
|
||
## Development | ||
|
||
## pre commit checks | ||
|
||
``` | ||
node scripts/type_check.js --project x-pack/plugins/cloud_defend/tsconfig.json | ||
yarn test:jest x-pack/plugins/cloud_defend | ||
``` | ||
|
||
See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment. |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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 PLUGIN_ID = 'cloudDefend'; | ||
export const PLUGIN_NAME = 'cloudDefend'; | ||
export const INTEGRATION_PACKAGE_NAME = 'cloud_defend'; | ||
export const INPUT_CONTROL = 'cloud_defend/control'; | ||
export const ALERTS_DATASET = 'cloud_defend.alerts'; |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../../..', | ||
roots: ['<rootDir>/x-pack/plugins/cloud_defend'], | ||
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/cloud_defend', | ||
coverageReporters: ['text', 'html'], | ||
collectCoverageFrom: [ | ||
'<rootDir>/x-pack/plugins/cloud_defend/{common,public,server}/**/*.{ts,tsx}', | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": "cloudDefend", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"owner": { | ||
"name": "Cloud Native Integrations", | ||
"githubTeam": "sec-cloudnative-integrations" | ||
}, | ||
"description": "Defend for Containers", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": ["fleet", "kibanaReact"], | ||
"optionalPlugins": [] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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 { NewPackagePolicy } from '@kbn/fleet-plugin/public'; | ||
|
||
export function getInputFromPolicy(policy: NewPackagePolicy, inputId: string) { | ||
return policy.inputs.find((input) => input.type === inputId); | ||
} |
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/cloud_defend/public/components/config_yaml_view/__mocks__/resizeobserver.js
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
class ResizeObserver { | ||
observe() { | ||
// do nothing | ||
} | ||
unobserve() { | ||
// do nothing | ||
} | ||
disconnect() { | ||
// do nothing | ||
} | ||
} | ||
|
||
window.ResizeObserver = ResizeObserver; | ||
export default ResizeObserver; |
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/cloud_defend/public/components/config_yaml_view/__mocks__/worker.js
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
class Worker { | ||
constructor(stringUrl) { | ||
this.url = stringUrl; | ||
this.onmessage = () => {}; | ||
} | ||
|
||
postMessage(msg) { | ||
this.onmessage(msg); | ||
} | ||
|
||
terminate() {} | ||
} | ||
|
||
window.Worker = Worker; | ||
export default Worker; |
Oops, something went wrong.