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

Implement Threat Intel Monitor Input and Triggers #1073

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

eirsep
Copy link
Member

@eirsep eirsep commented Jun 12, 2024

Description

Implement Threat Intel Monitor Input and Triggers using remote Monitor interface

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@eirsep eirsep changed the base branch from main to feature/threat_intel June 12, 2024 22:11
import org.opensearch.alerting.spi.RemoteMonitorRunner;
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse;

public class SampleRemoteDocLevelMonitorRunner extends RemoteMonitorRunner {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we change this class name?

public static final String REMOTE_DOC_LEVEL_MONITOR_ACTION_NAME = "cluster:admin/security_analytics/threatIntel/monitor/fanout";
public static final String THREAT_INTEL_MONITOR_TYPE = "ti_doc_level_monitor";

public static final String SAMPLE_REMOTE_DOC_LEVEL_MONITOR_RUNNER_INDEX = ".opensearch-alerting-sample-remote-doc-level-monitor";
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we remove this variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will follow up with the full impl
all this will change or be removed

import java.util.HashMap;
import java.util.Map;

public class TransportRemoteDocLevelMonitorFanOutAction extends HandledTransportAction<DocLevelMonitorFanOutRequest, DocLevelMonitorFanOutResponse> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we rename this to ThreatIntelMonitorFanout?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will follow up with the full impl
all this will change or be removed

Settings settings,
ActionFilters actionFilters
) {
super(SampleRemoteDocLevelMonitorRunner.REMOTE_DOC_LEVEL_MONITOR_ACTION_NAME, transportService, actionFilters, DocLevelMonitorFanOutRequest::new);
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we rename Action Name variable with Threat Intel context?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will follow up with the full impl
all this will change or be removed

RemoteDocLevelMonitorInput input = (RemoteDocLevelMonitorInput) monitor.getInputs().get(0);
BytesReference customInputSerialized = input.getInput();
StreamInput sin = StreamInput.wrap(customInputSerialized.toBytesRef().bytes);
ThreatIntelInput sampleRemoteDocLevelMonitorInput = new ThreatIntelInput(sin);
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we change variable name here sampleRemoteDocLevelMonitorInput?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will follow up with the full impl
all this will change or be removed

@@ -0,0 +1,97 @@
package org.opensearch.securityanalytics.threatIntel.model.monitor;
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this class be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will follow up with the full impl
all this will change or be removed

@eirsep eirsep merged commit 6766547 into opensearch-project:feature/threat_intel Jun 13, 2024
1 of 2 checks passed
IndexThreatIntelMonitorResponse response = getIndexThreatIntelMonitorResponse(r, user);
listener.onResponse(response);
}, e -> {
log.error("failed to creat threat intel monitor", e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: misspelled create

String index = docLevelMonitorInput.getIndices().get(0);


((Map<String, Object>) lastRunContext.get(index)).put("0", 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this putting 0 in the map?

AWSHurneyt pushed a commit to AWSHurneyt/security-analytics that referenced this pull request Jun 25, 2024
…#1073)

* wip index monitor still fails

* fix remote monitor setup in security-analytics

Signed-off-by: Subhobrata Dey <[email protected]>

* wip threat intel trigger

* add remote monitor triggers

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Subhobrata Dey <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Subhobrata Dey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants