You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ce...@apache.org on 2016/02/16 18:10:18 UTC
[2/5] incubator-metron git commit: METRON-35 Implement threat
intelligence message enrichment closes apache/incubator-metron#22
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/geo/GeoMysqlAdapterTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/geo/GeoMysqlAdapterTest.java b/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/geo/GeoMysqlAdapterTest.java
index f5b6a24..9a0fe2a 100644
--- a/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/geo/GeoMysqlAdapterTest.java
+++ b/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/geo/GeoMysqlAdapterTest.java
@@ -20,8 +20,8 @@ import java.net.URL;
import java.util.Properties;
import org.apache.metron.enrichment.adapters.jdbc.JdbcAdapter;
-import org.apache.metron.enrichment.adapters.jdbc.JdbcConfig;
import org.apache.metron.enrichment.adapters.jdbc.MySqlConfig;
+import org.apache.metron.enrichment.interfaces.EnrichmentAdapter;
import org.json.simple.JSONObject;
import org.apache.metron.test.AbstractSchemaTest;
@@ -133,7 +133,7 @@ public class GeoMysqlAdapterTest extends AbstractSchemaTest {
}
/**
- * Test method for {@link org.apache.metron.enrichment.adapters.geo.GeoAdapter#initializeAdapter()}.
+ * Test method for {@link EnrichmentAdapter#initializeAdapter()}.
*/
public void testInitializeAdapter() {
if(skipTests(this.getMode())){
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/whois/WhoisHBaseAdapterTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/whois/WhoisHBaseAdapterTest.java b/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/whois/WhoisHBaseAdapterTest.java
index 1c687e2..1779663 100644
--- a/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/whois/WhoisHBaseAdapterTest.java
+++ b/metron-streaming/Metron-EnrichmentAdapters/src/test/java/org/apache/metron/enrichment/adapters/whois/WhoisHBaseAdapterTest.java
@@ -21,6 +21,7 @@ package org.apache.metron.enrichment.adapters.whois;
import java.net.InetAddress;
import java.util.Properties;
+import org.apache.metron.enrichment.interfaces.EnrichmentAdapter;
import org.json.simple.JSONObject;
import org.apache.metron.test.AbstractTestContext;
@@ -115,7 +116,7 @@ public class WhoisHBaseAdapterTest extends AbstractTestContext {
}
/**
- * Test method for {@link org.apache.metron.enrichment.adapters.whois.WhoisHBaseAdapter#initializeAdapter()}.
+ * Test method for {@link EnrichmentAdapter#initializeAdapter()}.
*/
public void testInitializeAdapter() {
if(skipTests(this.getMode())){
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Indexing/pom.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Indexing/pom.xml b/metron-streaming/Metron-Indexing/pom.xml
index 3b11cad..abb42c9 100644
--- a/metron-streaming/Metron-Indexing/pom.xml
+++ b/metron-streaming/Metron-Indexing/pom.xml
@@ -10,88 +10,112 @@
the specific language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Streaming</artifactId>
- <version>0.6BETA</version>
- </parent>
- <artifactId>Metron-Indexing</artifactId>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <elastic.search.version>1.3.1</elastic.search.version>
- <http.client.version>4.3.4</http.client.version>
- <jsonsimple.version>1.1.1</jsonsimple.version>
- </properties>
- <dependencies>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Streaming</artifactId>
+ <version>0.6BETA</version>
+ </parent>
+ <artifactId>Metron-Indexing</artifactId>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <elastic.search.version>1.3.1</elastic.search.version>
+ <http.client.version>4.3.4</http.client.version>
+ <jsonsimple.version>1.1.1</jsonsimple.version>
+ </properties>
+ <dependencies>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Common</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-core</artifactId>
- <version>${global_storm_version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <artifactId>servlet-api</artifactId>
- <groupId>javax.servlet</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.elasticsearch</groupId>
- <artifactId>elasticsearch</artifactId>
- <version>${elastic.search.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${http.client.version}</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>${jsonsimple.version}</version>
- </dependency>
-
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>1.9</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Common</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-core</artifactId>
+ <version>${global_storm_version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${global_hbase_version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ <version>${elastic.search.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${http.client.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>${jsonsimple.version}</version>
+ </dependency>
- </dependencies>
-<reporting>
- <plugins>
- <!-- Normally, dependency report takes time, skip it -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.7</version>
-
- <configuration>
- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>emma-maven-plugin</artifactId>
- <version>1.0-alpha-3</version>
- <inherited>true</inherited>
- </plugin>
- </plugins>
- </reporting>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.9</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ </dependency>
+
+ </dependencies>
+ <reporting>
+ <plugins>
+ <!-- Normally, dependency report takes time, skip it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.7</version>
+
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <inherited>true</inherited>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-MessageParsers/pom.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-MessageParsers/pom.xml b/metron-streaming/Metron-MessageParsers/pom.xml
index 4de84a2..a297d67 100644
--- a/metron-streaming/Metron-MessageParsers/pom.xml
+++ b/metron-streaming/Metron-MessageParsers/pom.xml
@@ -38,6 +38,16 @@
<artifactId>storm-core</artifactId>
<version>${global_storm_version}</version>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-MessageParsers/src/main/java/org/apache/metron/bolt/TelemetryParserBolt.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-MessageParsers/src/main/java/org/apache/metron/bolt/TelemetryParserBolt.java b/metron-streaming/Metron-MessageParsers/src/main/java/org/apache/metron/bolt/TelemetryParserBolt.java
index 067e4b4..ebbe245 100644
--- a/metron-streaming/Metron-MessageParsers/src/main/java/org/apache/metron/bolt/TelemetryParserBolt.java
+++ b/metron-streaming/Metron-MessageParsers/src/main/java/org/apache/metron/bolt/TelemetryParserBolt.java
@@ -1,10 +1,9 @@
package org.apache.metron.bolt;
import backtype.storm.task.TopologyContext;
-import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;
-import org.apache.metron.domain.Enrichment;
+import org.apache.metron.enrichment.EnrichmentSplitterBolt;
import org.apache.metron.filters.GenericMessageFilter;
import org.apache.metron.helpers.topology.ErrorGenerator;
import org.apache.metron.parser.interfaces.MessageFilter;
@@ -15,15 +14,13 @@ import org.slf4j.LoggerFactory;
import java.util.*;
-public class TelemetryParserBolt extends
- SplitBolt<JSONObject> {
+public class TelemetryParserBolt extends EnrichmentSplitterBolt {
protected static final Logger LOG = LoggerFactory
.getLogger(TelemetryParserBolt.class);
protected MessageParser<JSONObject> parser;
protected MessageFilter<JSONObject> filter = new GenericMessageFilter();
- protected List<Enrichment> enrichments = new ArrayList<>();
/**
* @param parser The parser class for parsing the incoming raw message byte
@@ -46,17 +43,11 @@ public class TelemetryParserBolt extends
return this;
}
- /**
- * @param enrichments A class for sending tuples to enrichment bolt
- * @return Instance of this class
- */
- public TelemetryParserBolt withEnrichments(List<Enrichment> enrichments) {
- this.enrichments = enrichments;
- return this;
- }
+
@Override
public void prepare(Map map, TopologyContext topologyContext) {
+ super.prepare(map, topologyContext);
LOG.info("[Metron] Preparing TelemetryParser Bolt...");
if (this.parser == null) {
throw new IllegalStateException("MessageParser must be specified");
@@ -64,19 +55,7 @@ public class TelemetryParserBolt extends
parser.init();
}
- @Override
- public String getKey(Tuple tuple, JSONObject message) {
- return UUID.randomUUID().toString();
- }
- @Override
- public Set<String> getStreamIds() {
- Set<String> streamIds = new HashSet<>();
- for(Enrichment enrichment: enrichments) {
- streamIds.add(enrichment.getName());
- }
- return streamIds;
- }
@Override
public List<JSONObject> generateMessages(Tuple tuple) {
@@ -108,30 +87,5 @@ public class TelemetryParserBolt extends
return filteredMessages;
}
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, JSONObject> splitMessage(JSONObject message) {
- Map<String, JSONObject> streamMessageMap = new HashMap<>();
- for (Enrichment enrichment : enrichments) {
- List<String> fields = enrichment.getFields();
- if (fields != null && fields.size() > 0) {
- JSONObject enrichmentObject = new JSONObject();
- for (String field : fields) {
- enrichmentObject.put(field, message.get(field));
- }
- streamMessageMap.put(enrichment.getName(), enrichmentObject);
- }
- }
- return streamMessageMap;
- }
-
- @Override
- public void declareOther(OutputFieldsDeclarer declarer) {
- }
-
- @Override
- public void emitOther(Tuple tuple, List<JSONObject> messages) {
-
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Pcap_Service/src/main/resources/hbase-site.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/main/resources/hbase-site.xml b/metron-streaming/Metron-Pcap_Service/src/main/resources/hbase-site.xml
deleted file mode 100644
index 5c3c819..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/main/resources/hbase-site.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<!--Tue Apr 1 18:16:39 2014-->
- <configuration>
- <property>
- <name>hbase.tmp.dir</name>
- <value>/disk/h/hbase</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.chunkpool.maxsize</name>
- <value>0.5</value>
- </property>
- <property>
- <name>hbase.regionserver.codecs</name>
- <value>lzo,gz,snappy</value>
- </property>
- <property>
- <name>hbase.hstore.flush.retries.number</name>
- <value>120</value>
- </property>
- <property>
- <name>hbase.client.keyvalue.maxsize</name>
- <value>10485760</value>
- </property>
- <property>
- <name>hbase.rootdir</name>
- <value>hdfs://nn1:8020/apps/hbase/data</value>
- </property>
- <property>
- <name>hbase.defaults.for.version.skip</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.client.scanner.caching</name>
- <value>100</value>
- </property>
- <property>
- <name>hbase.superuser</name>
- <value>hbase</value>
- </property>
- <property>
- <name>hfile.block.cache.size</name>
- <value>0.40</value>
- </property>
- <property>
- <name>hbase.regionserver.checksum.verify</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.enabled</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.max.filesize</name>
- <value>107374182400</value>
- </property>
- <property>
- <name>hbase.cluster.distributed</name>
- <value>true</value>
- </property>
- <property>
- <name>zookeeper.session.timeout</name>
- <value>30000</value>
- </property>
- <property>
- <name>zookeeper.znode.parent</name>
- <value>/hbase-unsecure</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.lowerLimit</name>
- <value>0.38</value>
- </property>
- <property>
- <name>hbase.regionserver.handler.count</name>
- <value>240</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.chunksize</name>
- <value>8388608</value>
- </property>
- <property>
- <name>hbase.zookeeper.quorum</name>
- <value>zkpr1,zkpr2,zkpr3</value>
- </property>
- <property>
- <name>hbase.zookeeper.useMulti</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.majorcompaction</name>
- <value>86400000</value>
- </property>
- <property>
- <name>hbase.hstore.blockingStoreFiles</name>
- <value>200</value>
- </property>
- <property>
- <name>hbase.zookeeper.property.clientPort</name>
- <value>2181</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.flush.size</name>
- <value>134217728</value>
- </property>
- <property>
- <name>hbase.security.authorization</name>
- <value>false</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.upperLimit</name>
- <value>0.4</value>
- </property>
- <property>
- <name>hbase.hstore.compactionThreshold</name>
- <value>4</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.block.multiplier</name>
- <value>8</value>
- </property>
- <property>
- <name>hbase.security.authentication</name>
- <value>simple</value>
- </property>
- <property>
- <name>dfs.client.read.shortcircuit</name>
- <value>true</value>
- </property>
- </configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/pom.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/pom.xml b/metron-streaming/Metron-Topologies/pom.xml
index 4c5c4ab..27f54a3 100644
--- a/metron-streaming/Metron-Topologies/pom.xml
+++ b/metron-streaming/Metron-Topologies/pom.xml
@@ -10,184 +10,264 @@
the specific language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Streaming</artifactId>
- <version>0.6BETA</version>
- </parent>
- <artifactId>Metron-Topologies</artifactId>
- <description>Metron Topologies</description>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Streaming</artifactId>
+ <version>0.6BETA</version>
+ </parent>
+ <artifactId>Metron-Topologies</artifactId>
+ <description>Metron Topologies</description>
- <properties>
- <storm.hdfs.version>0.9.1.2.1.1.0-385</storm.hdfs.version>
- <cli.version>20040117.000000</cli.version>
- <commons.config.version>1.10</commons.config.version>
- </properties>
- <repositories>
- <repository>
- <id>github-snapshots</id>
- <url>http://oss.sonatype.org/content/repositories/snapshots/</url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Common</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Alerts</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-EnrichmentAdapters</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-MessageParsers</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.metron</groupId>
- <artifactId>Metron-Indexing</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
+ <properties>
+ <storm.hdfs.version>0.9.1.2.1.1.0-385</storm.hdfs.version>
+ <cli.version>20040117.000000</cli.version>
+ <commons.config.version>1.10</commons.config.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>github-snapshots</id>
+ <url>http://oss.sonatype.org/content/repositories/snapshots/</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${global_hbase_guava_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Common</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Alerts</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-EnrichmentAdapters</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-MessageParsers</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.metron</groupId>
+ <artifactId>Metron-Indexing</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-client</artifactId>
+ <version>${global_hbase_version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ <version>${global_hadoop_version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${global_hadoop_version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka_2.9.2</artifactId>
+ <version>${global_kafka_version}</version>
+ <exclusions>
+ <!--exclusion> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId>
+ </exclusion -->
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-core</artifactId>
+ <version>${global_storm_version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-kafka</artifactId>
+ <version>${global_storm_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>flux-core</artifactId>
+ <version>${global_flux_version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm</artifactId>
+ <version>${global_storm_version}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <version>${global_hadoop_version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- <version>${global_hadoop_version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.kafka</groupId>
- <artifactId>kafka_2.9.2</artifactId>
- <version>${global_kafka_version}</version>
- <exclusions>
- <!--exclusion> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId>
- </exclusion -->
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-core</artifactId>
- <version>${global_storm_version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-kafka</artifactId>
- <version>${global_storm_version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>flux-core</artifactId>
- <version>${global_flux_version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm</artifactId>
- <version>${global_storm_version}</version>
- <type>pom</type>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.github.ptgoetz</groupId>
- <artifactId>storm-hbase</artifactId>
- <version>0.1.2</version>
- </dependency>
- <!-- dependency> <groupId>com.github.ptgoetz</groupId> <artifactId>storm-hdfs</artifactId>
- <version>0.1.2</version> </dependency -->
- <dependency>
- <groupId>com.github.sheetaldolas</groupId>
- <artifactId>storm-hdfs</artifactId>
- <version>0.0.7-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.storm</groupId>
- <artifactId>storm-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>com.github.ptgoetz</groupId>
+ <artifactId>storm-hbase</artifactId>
+ <version>0.1.2</version>
+ </dependency>
+ <!-- dependency> <groupId>com.github.ptgoetz</groupId> <artifactId>storm-hdfs</artifactId>
+ <version>0.1.2</version> </dependency -->
+ <dependency>
+ <groupId>com.github.sheetaldolas</groupId>
+ <artifactId>storm-hdfs</artifactId>
+ <version>0.0.7-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <plugins>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.4</version>
- <configuration>
- <createDependencyReducedPom>true</createDependencyReducedPom>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <excludes>
- <exclude>storm:storm-core:*</exclude>
- <exclude>storm:storm-lib:*</exclude>
- <exclude>*slf4j*</exclude>
- </excludes>
- </artifactSet>
+ <plugin>
+ <!-- Separates the unit tests from the integration tests. -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <!-- Skip the default running of this plug-in (or everything is run twice...see below) -->
+ <argLine>-Xmx2048m -XX:MaxPermSize=256m</argLine>
+ <skip>true</skip>
+ <!-- Show 100% of the lines from the stack trace (doesn't work) -->
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ <executions>
+ <execution>
+ <id>unit-tests</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <!-- Never skip running the tests when the test phase is invoked -->
+ <skip>false</skip>
+ <includes>
+ <!-- Include unit tests within integration-test phase. -->
+ <include>**/*Test.java</include>
+ </includes>
+ <excludes>
+ <!-- Exclude integration tests within (unit) test phase. -->
+ <exclude>**/*IntegrationTest.java</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <!-- Never skip running the tests when the integration-test phase is invoked -->
+ <skip>false</skip>
+ <includes>
+ <!-- Include integration tests within integration-test phase. -->
+ <include>**/*IntegrationTest.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.4</version>
+ <configuration>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <excludes>
+ <exclude>storm:storm-core:*</exclude>
+ <exclude>storm:storm-lib:*</exclude>
+ <exclude>*slf4j*</exclude>
+ </excludes>
+ </artifactSet>
+ <!--relocations>
+ <relocation>
+ <pattern>com.google.common</pattern>
+ <shadedPattern>org.apache.metron.guava.common</shadedPattern>
+ </relocation>
+ </relocations-->
- <transformers>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
- <resource>.yaml</resource>
- </transformer>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass></mainClass>
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <transformers>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
+ <resource>.yaml</resource>
+ </transformer>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass></mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/env/config.properties
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/env/config.properties b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/env/config.properties
index 142f8f8..ddbbe25 100644
--- a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/env/config.properties
+++ b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/env/config.properties
@@ -71,12 +71,18 @@ bolt.hdfs.compression.codec.class=org.apache.hadoop.io.compress.SnappyCodec
##### HBase #####
bolt.hbase.table.name=pcap_test
-bolt.hbase.table.fields=t:pcap
-bolt.hbase.table.key.tuple.field.name=pcap_id
+bolt.hbase.table.fields=t:value
+bolt.hbase.table.key.tuple.field.name=key
bolt.hbase.table.timestamp.tuple.field.name=timestamp
bolt.hbase.enable.batching=false
bolt.hbase.write.buffer.size.in.bytes=2000000
bolt.hbase.durability=SKIP_WAL
bolt.hbase.partitioner.region.info.refresh.interval.mins=60
+##### Threat Intel #####
+
+threat.intel.tracker.table=
+threat.intel.tracker.cf=
+threat.intel.ip.table=
+threat.intel.ip.cf=
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/hbase-site.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/hbase-site.xml b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/hbase-site.xml
deleted file mode 100644
index 5c3c819..0000000
--- a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/etc/hbase-site.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<!--Tue Apr 1 18:16:39 2014-->
- <configuration>
- <property>
- <name>hbase.tmp.dir</name>
- <value>/disk/h/hbase</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.chunkpool.maxsize</name>
- <value>0.5</value>
- </property>
- <property>
- <name>hbase.regionserver.codecs</name>
- <value>lzo,gz,snappy</value>
- </property>
- <property>
- <name>hbase.hstore.flush.retries.number</name>
- <value>120</value>
- </property>
- <property>
- <name>hbase.client.keyvalue.maxsize</name>
- <value>10485760</value>
- </property>
- <property>
- <name>hbase.rootdir</name>
- <value>hdfs://nn1:8020/apps/hbase/data</value>
- </property>
- <property>
- <name>hbase.defaults.for.version.skip</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.client.scanner.caching</name>
- <value>100</value>
- </property>
- <property>
- <name>hbase.superuser</name>
- <value>hbase</value>
- </property>
- <property>
- <name>hfile.block.cache.size</name>
- <value>0.40</value>
- </property>
- <property>
- <name>hbase.regionserver.checksum.verify</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.enabled</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.max.filesize</name>
- <value>107374182400</value>
- </property>
- <property>
- <name>hbase.cluster.distributed</name>
- <value>true</value>
- </property>
- <property>
- <name>zookeeper.session.timeout</name>
- <value>30000</value>
- </property>
- <property>
- <name>zookeeper.znode.parent</name>
- <value>/hbase-unsecure</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.lowerLimit</name>
- <value>0.38</value>
- </property>
- <property>
- <name>hbase.regionserver.handler.count</name>
- <value>240</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.chunksize</name>
- <value>8388608</value>
- </property>
- <property>
- <name>hbase.zookeeper.quorum</name>
- <value>zkpr1,zkpr2,zkpr3</value>
- </property>
- <property>
- <name>hbase.zookeeper.useMulti</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.majorcompaction</name>
- <value>86400000</value>
- </property>
- <property>
- <name>hbase.hstore.blockingStoreFiles</name>
- <value>200</value>
- </property>
- <property>
- <name>hbase.zookeeper.property.clientPort</name>
- <value>2181</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.flush.size</name>
- <value>134217728</value>
- </property>
- <property>
- <name>hbase.security.authorization</name>
- <value>false</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.upperLimit</name>
- <value>0.4</value>
- </property>
- <property>
- <name>hbase.hstore.compactionThreshold</name>
- <value>4</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.block.multiplier</name>
- <value>8</value>
- </property>
- <property>
- <name>hbase.security.authentication</name>
- <value>simple</value>
- </property>
- <property>
- <name>dfs.client.read.shortcircuit</name>
- <value>true</value>
- </property>
- </configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/local.yaml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/local.yaml b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/local.yaml
index 08c332a..3f19d6d 100644
--- a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/local.yaml
+++ b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/local.yaml
@@ -3,11 +3,53 @@ config:
topology.workers: 1
components:
+# Parser
- id: "parser"
className: "org.apache.metron.parsing.parsers.PcapParser"
configMethods:
- name: "withTsPrecision"
args: ["MICRO"]
+# Threat Intel
+ - id: "ipThreatIntelConfig"
+ className: "org.apache.metron.threatintel.ThreatIntelConfig"
+ configMethods:
+ - name: "withProviderImpl"
+ args:
+ - "${hbase.provider.impl}"
+ - name: "withTrackerHBaseTable"
+ args:
+ - "${threat.intel.tracker.table}"
+ - name: "withTrackerHBaseCF"
+ args:
+ - "${threat.intel.tracker.cf}"
+ - name: "withHBaseTable"
+ args:
+ - "${threat.intel.ip.table}"
+ - name: "withHBaseCF"
+ args:
+ - "${threat.intel.ip.cf}"
+ - id: "ipThreatIntelAdapter"
+ className: "org.apache.metron.threatintel.ThreatIntelAdapter"
+ configMethods:
+ - name: "withConfig"
+ args:
+ - ref: "ipThreatIntelConfig"
+ - id: "ipThreatIntelEnrichment"
+ className: "org.apache.metron.domain.Enrichment"
+ properties:
+ - name: "name"
+ value: "ip"
+ - name: "fields"
+ value: ["message/ip_src_addr", "message/ip_dst_addr"]
+ - name: "adapter"
+ ref: "ipThreatIntelAdapter"
+ - id: "threatIntels"
+ className: "java.util.ArrayList"
+ configMethods:
+ - name: "add"
+ args:
+ - ref: "ipThreatIntelEnrichment"
+# Enrichment
- id: "geoEnrichmentAdapter"
className: "org.apache.metron.integration.util.mock.MockGeoAdapter"
- id: "geoEnrichment"
@@ -41,6 +83,7 @@ components:
- name: "add"
args:
- ref: "hostEnrichment"
+#indexing
- id: "indexAdapter"
className: "org.apache.metron.indexing.adapters.ESTimedRotatingAdapter"
- id: "metricConfig"
@@ -102,6 +145,7 @@ components:
args:
- "org.apache.metron.metrics.TelemetryIndexingBolt.fails"
- "${org.apache.metron.metrics.TelemetryIndexingBolt.fails}"
+#hbase bolt
- id: "hbaseConfig"
className: "org.apache.metron.hbase.TupleTableConfig"
configMethods:
@@ -120,6 +164,9 @@ components:
- name: "withBatch"
args:
- ${bolt.hbase.enable.batching}
+ - name: "withConnectorImpl"
+ args:
+ - "${hbase.provider.impl}"
spouts:
- id: "testingSpout"
className: "org.apache.metron.test.spouts.GenericInternalTestSpout"
@@ -134,17 +181,12 @@ spouts:
- name: "withRepeating"
args:
- ${testing.repeating}
-
bolts:
- id: "hbaseBolt"
className: "org.apache.metron.hbase.HBaseBolt"
constructorArgs:
- ref: "hbaseConfig"
- "${kafka.zk}"
- configMethods:
- - name: "withConnector"
- args:
- - "${hbase.connector.impl}"
- id: "parserBolt"
className: "org.apache.metron.bolt.PcapParserBolt"
configMethods:
@@ -214,6 +256,37 @@ bolts:
- name: "withMetricConfiguration"
args:
- ref: "metricConfig"
+# Threat Intel Bolts
+ - id: "threatIntelSplitBolt"
+ className: "org.apache.metron.enrichment.EnrichmentSplitterBolt"
+ configMethods:
+ - name: "withEnrichments"
+ args:
+ - ref: "threatIntels"
+ - id: "ipThreatIntelBolt"
+ className: "org.apache.metron.enrichment.bolt.GenericEnrichmentBolt"
+ configMethods:
+ - name: "withEnrichment"
+ args:
+ - ref: "ipThreatIntelEnrichment"
+ - name: "withMaxCacheSize"
+ args: [10000]
+ - name: "withMaxTimeRetain"
+ args: [10]
+ - id: "threatIntelJoinBolt"
+ className: "org.apache.metron.enrichment.bolt.EnrichmentJoinBolt"
+ configMethods:
+ - name: "withEnrichments"
+ args:
+ - ref: "threatIntels"
+ - name: "withType"
+ args:
+ - "alerts"
+ - name: "withMaxCacheSize"
+ args: [10000]
+ - name: "withMaxTimeRetain"
+ args: [10]
+# Enrichment Bolts
- id: "geoEnrichmentBolt"
className: "org.apache.metron.enrichment.bolt.GenericEnrichmentBolt"
configMethods:
@@ -246,11 +319,13 @@ bolts:
args: [10]
streams:
+#parser
- name: "spout -> parser"
from: "testingSpout"
to: "parserBolt"
grouping:
type: SHUFFLE
+#hbase
- name: "parser -> hbase"
from: "parserBolt"
to: "hbaseBolt"
@@ -258,6 +333,7 @@ streams:
streamId: "raw"
type: FIELDS
args: ["key"]
+#enrichment
- name: "parser -> host"
from: "parserBolt"
to: "hostEnrichmentBolt"
@@ -293,13 +369,47 @@ streams:
streamId: "host"
type: FIELDS
args: ["key"]
- - name: "join -> indexing"
+
+#threat intel
+ - name: "enrichmentJoin -> threatSplit"
from: "joinBolt"
+ to: "threatIntelSplitBolt"
+ grouping:
+ streamId: "message"
+ type: FIELDS
+ args: ["key"]
+
+ - name: "threatSplit -> ip"
+ from: "threatIntelSplitBolt"
+ to: "ipThreatIntelBolt"
+ grouping:
+ streamId: "ip"
+ type: FIELDS
+ args: ["key"]
+
+ - name: "ip -> join"
+ from: "ipThreatIntelBolt"
+ to: "threatIntelJoinBolt"
+ grouping:
+ streamId: "ip"
+ type: FIELDS
+ args: ["key"]
+ - name: "threatIntelSplit -> threatIntelJoin"
+ from: "threatIntelSplitBolt"
+ to: "threatIntelJoinBolt"
+ grouping:
+ streamId: "message"
+ type: FIELDS
+ args: ["key"]
+#indexing
+ - name: "threatIntelJoin -> indexing"
+ from: "threatIntelJoinBolt"
to: "indexingBolt"
grouping:
streamId: "message"
type: FIELDS
args: ["key"]
+#errors
- name: "parser -> errors"
from: "parserBolt"
to: "errorIndexingBolt"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/remote.yaml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/remote.yaml b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/remote.yaml
index 39cb8dd..cc9cd29 100644
--- a/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/remote.yaml
+++ b/metron-streaming/Metron-Topologies/src/main/resources/Metron_Configs/topologies/pcap/remote.yaml
@@ -8,34 +8,73 @@ components:
configMethods:
- name: "withTsPrecision"
args: ["MICRO"]
- - id: "jdbcConfig"
- className: "org.apache.metron.enrichment.adapters.jdbc.MySqlConfig"
- properties:
- - name: "host"
- value: "${mysql.ip}"
- - name: "port"
- value: ${mysql.port}
- - name: "username"
- value: "${mysql.username}"
- - name: "password"
- value: "${mysql.password}"
- - name: "table"
- value: "GEO"
- - id: "geoEnrichmentAdapter"
- className: "org.apache.metron.enrichment.adapters.geo.GeoAdapter"
+
+# Threat Intel
+ - id: "ipThreatIntelConfig"
+ className: "org.apache.metron.threatintel.ThreatIntelConfig"
+ configMethods:
+ - name: "withTrackerHBaseTable"
+ args:
+ - "${threat.intel.tracker.table}"
+ - name: "withTrackerHBaseCF"
+ args:
+ - "${threat.intel.tracker.cf}"
+ - name: "withHBaseTable"
+ args:
+ - "${threat.intel.ip.table}"
+ - name: "withHBaseCF"
+ args:
+ - "${threat.intel.ip.cf}"
+ - id: "ipThreatIntelAdapter"
+ className: "org.apache.metron.threatintel.ThreatIntelAdapter"
configMethods:
- - name: "withJdbcConfig"
+ - name: "withConfig"
args:
- - ref: "jdbcConfig"
- - id: "geoEnrichment"
+ - ref: "ipThreatIntelConfig"
+ - id: "ipThreatIntelEnrichment"
className: "org.apache.metron.domain.Enrichment"
properties:
- - name: "name"
- value: "geo"
- - name: "fields"
- value: ["ip_src_addr", "ip_dst_addr"]
- - name: "adapter"
- ref: "geoEnrichmentAdapter"
+ - name: "name"
+ value: "ip"
+ - name: "fields"
+ value: ["message/ip_src_addr", "message/ip_dst_addr"]
+ - name: "adapter"
+ ref: "ipThreatIntelAdapter"
+ - id: "threatIntels"
+ className: "java.util.ArrayList"
+ configMethods:
+ - name: "add"
+ args:
+ - ref: "ipThreatIntelEnrichment"
+#Enrichment
+# - id: "jdbcConfig"
+# className: "org.apache.metron.enrichment.adapters.jdbc.MySqlConfig"
+# properties:
+# - name: "host"
+# value: "${mysql.ip}"
+# - name: "port"
+# value: ${mysql.port}
+# - name: "username"
+# value: "${mysql.username}"
+# - name: "password"
+# value: "${mysql.password}"
+# - name: "table"
+# value: "GEO"
+# - id: "geoEnrichmentAdapter"
+# className: "org.apache.metron.enrichment.adapters.geo.GeoAdapter"
+# configMethods:
+# - name: "withJdbcConfig"
+# args:
+# - ref: "jdbcConfig"
+# - id: "geoEnrichment"
+# className: "org.apache.metron.domain.Enrichment"
+# properties:
+# - name: "name"
+# value: "geo"
+# - name: "fields"
+# value: ["ip_src_addr", "ip_dst_addr"]
+# - name: "adapter"
+# ref: "geoEnrichmentAdapter"
- id: "hostEnrichmentAdapter"
className: "org.apache.metron.enrichment.adapters.host.HostFromJSONListAdapter"
constructorArgs:
@@ -52,9 +91,9 @@ components:
- id: "enrichments"
className: "java.util.ArrayList"
configMethods:
- - name: "add"
- args:
- - ref: "geoEnrichment"
+# - name: "add"
+# args:
+# - ref: "geoEnrichment"
- name: "add"
args:
- ref: "hostEnrichment"
@@ -238,16 +277,46 @@ bolts:
- name: "withMetricConfiguration"
args:
- ref: "metricConfig"
- - id: "geoEnrichmentBolt"
+ # Threat Intel Bolts
+ - id: "threatIntelSplitBolt"
+ className: "org.apache.metron.enrichment.EnrichmentSplitterBolt"
+ configMethods:
+ - name: "withEnrichments"
+ args:
+ - ref: "threatIntels"
+ - id: "ipThreatIntelBolt"
className: "org.apache.metron.enrichment.bolt.GenericEnrichmentBolt"
configMethods:
- name: "withEnrichment"
args:
- - ref: "geoEnrichment"
+ - ref: "ipThreatIntelEnrichment"
- name: "withMaxCacheSize"
args: [10000]
- name: "withMaxTimeRetain"
args: [10]
+ - id: "threatIntelJoinBolt"
+ className: "org.apache.metron.enrichment.bolt.EnrichmentJoinBolt"
+ configMethods:
+ - name: "withEnrichments"
+ args:
+ - ref: "threatIntels"
+ - name: "withType"
+ args:
+ - "alerts"
+ - name: "withMaxCacheSize"
+ args: [10000]
+ - name: "withMaxTimeRetain"
+ args: [10]
+# - id: "geoEnrichmentBolt"
+# className: "org.apache.metron.enrichment.bolt.GenericEnrichmentBolt"
+# configMethods:
+# - name: "withEnrichment"
+# args:
+# - ref: "geoEnrichment"
+# - name: "withMaxCacheSize"
+# args: [10000]
+# - name: "withMaxTimeRetain"
+# args: [10]
- id: "hostEnrichmentBolt"
className: "org.apache.metron.enrichment.bolt.GenericEnrichmentBolt"
configMethods:
@@ -289,13 +358,13 @@ streams:
streamId: "host"
type: FIELDS
args: ["key"]
- - name: "parser -> geo"
- from: "parserBolt"
- to: "geoEnrichmentBolt"
- grouping:
- streamId: "geo"
- type: FIELDS
- args: ["key"]
+# - name: "parser -> geo"
+# from: "parserBolt"
+# to: "geoEnrichmentBolt"
+# grouping:
+# streamId: "geo"
+# type: FIELDS
+# args: ["key"]
- name: "parser -> join"
from: "parserBolt"
to: "joinBolt"
@@ -303,13 +372,13 @@ streams:
streamId: "message"
type: FIELDS
args: ["key"]
- - name: "geo -> join"
- from: "geoEnrichmentBolt"
- to: "joinBolt"
- grouping:
- streamId: "geo"
- type: FIELDS
- args: ["key"]
+# - name: "geo -> join"
+# from: "geoEnrichmentBolt"
+# to: "joinBolt"
+# grouping:
+# streamId: "geo"
+# type: FIELDS
+# args: ["key"]
- name: "host -> join"
from: "hostEnrichmentBolt"
to: "joinBolt"
@@ -317,13 +386,46 @@ streams:
streamId: "host"
type: FIELDS
args: ["key"]
- - name: "join -> indexing"
+#threat intel
+ - name: "enrichmentJoin -> threatSplit"
from: "joinBolt"
+ to: "threatIntelSplitBolt"
+ grouping:
+ streamId: "message"
+ type: FIELDS
+ args: ["key"]
+
+ - name: "threatSplit -> ip"
+ from: "threatIntelSplitBolt"
+ to: "ipThreatIntelBolt"
+ grouping:
+ streamId: "ip"
+ type: FIELDS
+ args: ["key"]
+
+ - name: "ip -> join"
+ from: "ipThreatIntelBolt"
+ to: "threatIntelJoinBolt"
+ grouping:
+ streamId: "ip"
+ type: FIELDS
+ args: ["key"]
+ - name: "threatIntelSplit -> threatIntelJoin"
+ from: "threatIntelSplitBolt"
+ to: "threatIntelJoinBolt"
+ grouping:
+ streamId: "message"
+ type: FIELDS
+ args: ["key"]
+#indexing
+ - name: "threatIntelJoin -> indexing"
+ from: "threatIntelJoinBolt"
to: "indexingBolt"
grouping:
streamId: "message"
type: FIELDS
args: ["key"]
+#errors
- name: "parser -> errors"
from: "parserBolt"
to: "errorIndexingBolt"
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/main/resources/hbase-site.xml
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/main/resources/hbase-site.xml b/metron-streaming/Metron-Topologies/src/main/resources/hbase-site.xml
deleted file mode 100644
index 8d812a9..0000000
--- a/metron-streaming/Metron-Topologies/src/main/resources/hbase-site.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<!--Tue Apr 1 18:16:39 2014-->
- <configuration>
- <property>
- <name>hbase.tmp.dir</name>
- <value>/disk/h/hbase</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.chunkpool.maxsize</name>
- <value>0.5</value>
- </property>
- <property>
- <name>hbase.regionserver.codecs</name>
- <value>lzo,gz,snappy</value>
- </property>
- <property>
- <name>hbase.hstore.flush.retries.number</name>
- <value>120</value>
- </property>
- <property>
- <name>hbase.client.keyvalue.maxsize</name>
- <value>10485760</value>
- </property>
- <property>
- <name>hbase.rootdir</name>
- <value>hdfs://nn1:8020/apps/hbase/data</value>
- </property>
- <property>
- <name>hbase.defaults.for.version.skip</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.client.scanner.caching</name>
- <value>100</value>
- </property>
- <property>
- <name>hbase.superuser</name>
- <value>hbase</value>
- </property>
- <property>
- <name>hfile.block.cache.size</name>
- <value>0.40</value>
- </property>
- <property>
- <name>hbase.regionserver.checksum.verify</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.enabled</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.max.filesize</name>
- <value>107374182400</value>
- </property>
- <property>
- <name>hbase.cluster.distributed</name>
- <value>true</value>
- </property>
- <property>
- <name>zookeeper.session.timeout</name>
- <value>30000</value>
- </property>
- <property>
- <name>zookeeper.znode.parent</name>
- <value>/hbase-unsecure</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.lowerLimit</name>
- <value>0.38</value>
- </property>
- <property>
- <name>hbase.regionserver.handler.count</name>
- <value>240</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.mslab.chunksize</name>
- <value>8388608</value>
- </property>
- <property>
- <name>hbase.zookeeper.quorum</name>
- <value>zkpr1,zkpr2,zkpr3</value>
- </property>
- <property>
- <name>hbase.zookeeper.useMulti</name>
- <value>true</value>
- </property>
- <property>
- <name>hbase.hregion.majorcompaction</name>
- <value>86400000</value>
- </property>
- <property>
- <name>hbase.hstore.blockingStoreFiles</name>
- <value>200</value>
- </property>
- <property>
- <name>hbase.zookeeper.property.clientPort</name>
- <value>2181</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.flush.size</name>
- <value>134217728</value>
- </property>
- <property>
- <name>hbase.security.authorization</name>
- <value>false</value>
- </property>
- <property>
- <name>hbase.regionserver.global.memstore.upperLimit</name>
- <value>0.4</value>
- </property>
- <property>
- <name>hbase.hstore.compactionThreshold</name>
- <value>4</value>
- </property>
- <property>
- <name>hbase.hregion.memstore.block.multiplier</name>
- <value>8</value>
- </property>
- <property>
- <name>hbase.security.authentication</name>
- <value>simple</value>
- </property>
- <property>
- <name>dfs.client.read.shortcircuit</name>
- <value>true</value>
- </property>
- <property>
- <name>dfs.domain.socket.path</name>
- <value>/var/run/hdfs/dn_socket</value>
- </property>
- </configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/pcap/PcapIntegrationTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/pcap/PcapIntegrationTest.java b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/pcap/PcapIntegrationTest.java
index fd8a143..5be45b4 100644
--- a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/pcap/PcapIntegrationTest.java
+++ b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/pcap/PcapIntegrationTest.java
@@ -13,9 +13,12 @@ import org.apache.metron.integration.util.integration.Processor;
import org.apache.metron.integration.util.integration.ReadinessState;
import org.apache.metron.integration.util.integration.components.ElasticSearchComponent;
import org.apache.metron.integration.util.integration.components.FluxTopologyComponent;
-import org.apache.metron.integration.util.mock.MockHBaseConnector;
+import org.apache.metron.integration.util.mock.MockHTable;
+import org.apache.metron.integration.util.threatintel.ThreatIntelHelper;
import org.apache.metron.parsing.parsers.PcapParser;
import org.apache.metron.test.converters.HexStringConverter;
+import org.apache.metron.threatintel.ThreatIntelKey;
+import org.apache.metron.threatintel.ThreatIntelResults;
import org.json.simple.JSONObject;
import org.junit.Assert;
import org.junit.Test;
@@ -55,6 +58,9 @@ public class PcapIntegrationTest {
.withHttpPort(9211)
.withIndexDir(new File(targetDir + "/elasticsearch"))
.build();
+ final String cf = "cf";
+ final String trackerHBaseTable = "tracker";
+ final String ipThreatIntelTable = "ip_threat_intel";
Properties topologyProperties = new Properties() {{
setProperty("input.path", "src/main/resources/");
setProperty("es.port", "9300");
@@ -87,19 +93,30 @@ public class PcapIntegrationTest {
setProperty("bolt.hbase.write.buffer.size.in.bytes", "2000000");
setProperty("bolt.hbase.durability", "SKIP_WAL");
setProperty("bolt.hbase.partitioner.region.info.refresh.interval.mins","60");
- setProperty("hbase.connector.impl","org.apache.metron.integration.util.mock.MockHBaseConnector");
+ setProperty("hbase.provider.impl","" + MockHTable.Provider.class.getName());
+ setProperty("threat.intel.tracker.table", trackerHBaseTable);
+ setProperty("threat.intel.tracker.cf", cf);
+ setProperty("threat.intel.ip.table", ipThreatIntelTable);
+ setProperty("threat.intel.ip.cf", cf);
setProperty("org.apache.metron.enrichment.host.known_hosts", "[{\"ip\":\"10.1.128.236\", \"local\":\"YES\", \"type\":\"webserver\", \"asset_value\" : \"important\"}," +
"{\"ip\":\"10.1.128.237\", \"local\":\"UNKNOWN\", \"type\":\"unknown\", \"asset_value\" : \"important\"}," +
"{\"ip\":\"10.60.10.254\", \"local\":\"YES\", \"type\":\"printer\", \"asset_value\" : \"important\"}," +
"{\"ip\":\"10.0.2.15\", \"local\":\"YES\", " +
"\"type\":\"printer\", \"asset_value\" : \"important\"}]");
}};
+ //create MockHBaseTables
+ final MockHTable trackerTable = (MockHTable)MockHTable.Provider.addToCache(trackerHBaseTable, cf);
+ final MockHTable ipTable = (MockHTable)MockHTable.Provider.addToCache(ipThreatIntelTable, cf);
+ ThreatIntelHelper.INSTANCE.load(ipTable, cf, new ArrayList<ThreatIntelResults>(){{
+ add(new ThreatIntelResults(new ThreatIntelKey("10.0.2.3"), new HashMap<String, String>()));
+ }}, 0L);
+ final MockHTable pcapTable = (MockHTable) MockHTable.Provider.addToCache("pcap_test", "t");
FluxTopologyComponent fluxComponent = new FluxTopologyComponent.Builder()
.withTopologyLocation(new File(topologiesDir + "/pcap/local.yaml"))
.withTopologyName("pcap")
.withTopologyProperties(topologyProperties)
.build();
-
+ //UnitTestHelper.verboseLogging();
ComponentRunner runner = new ComponentRunner.Builder()
.withComponent("elasticsearch", esComponent)
.withComponent("storm", fluxComponent)
@@ -120,7 +137,7 @@ public class PcapIntegrationTest {
} catch (IOException e) {
throw new IllegalStateException("Unable to retrieve indexed documents.", e);
}
- if(docs.size() < expectedPcapIds.size() && MockHBaseConnector.getPuts().size() < expectedPcapIds.size()) {
+ if(docs.size() < expectedPcapIds.size() && pcapTable.getPutLog().size() < expectedPcapIds.size()) {
return ReadinessState.NOT_READY;
}
else {
@@ -137,19 +154,33 @@ public class PcapIntegrationTest {
}
});
- Assert.assertEquals(expectedPcapIds.size(), MockHBaseConnector.getPuts().size());
+ Assert.assertEquals(expectedPcapIds.size(), pcapTable.getPutLog().size());
UnitTestHelper.assertSetEqual("PCap IDs from Index"
- , new HashSet<String>(expectedPcapIds)
+ , new HashSet<>(expectedPcapIds)
, convertToSet(Iterables.transform(docs, DOC_TO_PCAP_ID))
);
UnitTestHelper.assertSetEqual("PCap IDs from HBase"
- , new HashSet<String>(expectedPcapIds)
- , convertToSet(Iterables.transform(MockHBaseConnector.getPuts(), RK_TO_PCAP_ID))
+ , new HashSet<>(expectedPcapIds)
+ , convertToSet(Iterables.transform(pcapTable.getPutLog(), RK_TO_PCAP_ID))
);
- Iterable<JSONObject> packetsFromHBase = Iterables.transform
- (MockHBaseConnector.getPuts(), PUT_TO_PCAP);
+ Iterable<JSONObject> packetsFromHBase = Iterables.transform(pcapTable.getPutLog(), PUT_TO_PCAP);
Assert.assertEquals(expectedPcapIds.size(), Iterables.size(packetsFromHBase));
- MockHBaseConnector.clear();
+
+ List<Map<String, Object>> allDocs= runner.getComponent("elasticsearch", ElasticSearchComponent.class).getAllIndexedDocs(index, null);
+ boolean hasThreat = false;
+ for(Map<String, Object> d : allDocs) {
+ Map<String, Object> message = (Map<String, Object>) d.get("message");
+ Set<String> ips = new HashSet<>(Arrays.asList((String)message.get("ip_dst_addr"), (String)message.get("ip_src_addr")));
+ if(ips.contains("10.0.2.3")) {
+ hasThreat = true;
+ Map<String, Object> alerts = (Map<String, Object>) ((Map<String, Object>) d.get("alerts")).get("ip");
+ Assert.assertTrue( ((Map<String,Object>)alerts.get("ip_dst_addr")).size() > 0
+ || ((Map<String,Object>)alerts.get("ip_src_addr")).size() > 0
+ );
+ }
+ }
+ Assert.assertTrue(hasThreat);
+ MockHTable.Provider.clear();
runner.stop();
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/ComponentRunner.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/ComponentRunner.java b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/ComponentRunner.java
index d931df8..60aaf70 100644
--- a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/ComponentRunner.java
+++ b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/ComponentRunner.java
@@ -84,7 +84,7 @@ public class ComponentRunner {
}
public <T> T process(Processor<T> successState) {
- return process(successState, 3, 30000, 120000);
+ return process(successState, 5, 30000, 120000);
}
public <T> T process(Processor<T> successState, int numRetries, long timeBetweenAttempts, long maxTimeMs) {
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/components/ElasticSearchComponent.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/components/ElasticSearchComponent.java b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/components/ElasticSearchComponent.java
index ff6339f..2e45f06 100644
--- a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/components/ElasticSearchComponent.java
+++ b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/integration/components/ElasticSearchComponent.java
@@ -132,6 +132,9 @@ public class ElasticSearchComponent implements InMemoryComponent {
}
public List<Map<String, Object>> getAllIndexedDocs(String index) throws IOException {
+ return getAllIndexedDocs(index, "message");
+ }
+ public List<Map<String, Object>> getAllIndexedDocs(String index, String subMessage) throws IOException {
getClient().admin().indices().refresh(new RefreshRequest());
SearchResponse response = getClient().prepareSearch(index)
.setTypes("pcap_doc")
@@ -141,7 +144,13 @@ public class ElasticSearchComponent implements InMemoryComponent {
.execute().actionGet();
List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>();
for (SearchHit hit : response.getHits()) {
- Object o = hit.getSource().get("message");
+ Object o = null;
+ if(subMessage == null) {
+ o = hit.getSource();
+ }
+ else {
+ o = hit.getSource().get(subMessage);
+ }
ret.add((Map<String, Object>)(o));
}
return ret;
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/1ddfd12c/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/mock/MockGeoAdapter.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/mock/MockGeoAdapter.java b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/mock/MockGeoAdapter.java
index e571a22..cbe46b1 100644
--- a/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/mock/MockGeoAdapter.java
+++ b/metron-streaming/Metron-Topologies/src/test/java/org/apache/metron/integration/util/mock/MockGeoAdapter.java
@@ -8,6 +8,11 @@ import java.io.Serializable;
public class MockGeoAdapter implements EnrichmentAdapter<String>,
Serializable {
+ @Override
+ public void logAccess(String value) {
+
+ }
+
public JSONObject enrich(String metadata) {
JSONObject enriched = new JSONObject();
enriched.put("locID", "1");