{"id":190,"date":"2020-08-25T18:06:40","date_gmt":"2020-08-25T22:06:40","guid":{"rendered":"https:\/\/secognition.com\/?p=190"},"modified":"2021-09-06T08:28:22","modified_gmt":"2021-09-06T13:28:22","slug":"zeek-ids-installation-on-raspberry-pi-part-2","status":"publish","type":"post","link":"https:\/\/secognition.com\/?p=190","title":{"rendered":"Zeek IDS Installation on Raspberry PI Part 2"},"content":{"rendered":"<p>Updated 09-06-2021<\/p>\n<p>Welcome back!<\/p>\n<p>In the last episode &#8211; our intrepid adventurers setup a Raspberry Pi and got Zeek IDS, downloaded, compiled and running in a very basic way&#8230;.<\/p>\n<p>But what about some more advanced functions? What can this small box filled with power do more than report packets traversing switches and routers?<\/p>\n<p><strong>Changing the log file format for better ingestion<\/strong><\/p>\n<p>The best way for external software to ingest your zeek logs is to convert them to JSON format. In the original config, Zeek creates human readable text tables for each kind of log file created in \/usr\/local\/zeek\/logs\/current such as:<\/p>\n<pre class=\"code\"> cat capture_loss.log\r\n#separator \\x09\r\n#set_separator  ,\r\n#empty_field    (empty)\r\n#unset_field    -\r\n#path   capture_loss\r\n#open   2019-08-31-02-04-06\r\n#fields ts      ts_delta        peer    gaps    acks    percent_lost\r\n#types  time    interval        string  count   count   double\r\n1567213446.308621       900.000053      zeek    0       0       0.0<\/pre>\n<p>This is great for people to read but less so for machines. To convert these tables into JSON format:<\/p>\n<ul>\n<li>Edit \/usr\/local\/zeek\/share\/zeek\/site\/local.zeek;<\/li>\n<li>Add the following to the end of the file;<\/li>\n<\/ul>\n<pre class=\"code\">#JSON Output\r\n@load policy\/tuning\/json-logs.zeek<\/pre>\n<ul>\n<li>Save and close the site file;<\/li>\n<li>From the command-line restart zeek as the configuration has changed.<\/li>\n<\/ul>\n<pre class=\"code\">zeekctl deploy<\/pre>\n<p>Check to make sure your logs are now in JSON format.<\/p>\n<pre class=\"code\"> cat \/usr\/local\/zeek\/logs\/current\/packet_filter.log\r\n{\"ts\":1567213927.478291,\"node\":\"zeek\",\"filter\":\"ip or not ip\",\"init\":true,\"success\":true}<\/pre>\n<p>This will help if you want to run scripts against the logs or export to a SIEM-type system.<\/p>\n<p><strong>Adding Intelligence from a Threat Feed &amp; Automating the updates for the feeds.<br \/>\n<\/strong><\/p>\n<p>I used to have the setup for criticalstack\/intelstack.com &#8211; but it&#8217;s gone the way of the dodo.\u00a0 In another post I recommend a new threat feed provided by Critical Path security, easier to update through Git.\u00a0 Click <a href=\"https:\/\/secognition.com\/?p=217\">here<\/a> for the install instructions.<\/p>\n<p><strong>Testing the Threat Intel Feeds<\/strong><\/p>\n<p>A new log file will be created when using the intel threat feeds: intel.log.<\/p>\n<p>To test the creation of this log file you can attempt to browse to a tor exit node (if you added a TOR nodes feed) or some other site that could be part of the feeds you&#8217;ve added.<\/p>\n<p>For this example, I&#8217;ve got <strong>35.225.94.95<\/strong> that came in on my external address. If you browse to it in a browser or use curl from the command line it will trigger a log to generate a intel.log file.<\/p>\n<pre class=\"code\">cat intel.log\r\n{\"ts\":1630934593.891459,\"uid\":\"C0VM2b1tdQrrVzLYRi\",\"id.orig_h\":\"35.225.94.95\",\"id.orig_p\":47322,\"id.resp_h\":\"10.255.30.30\",\"id.resp_p\":443,\"seen.indicator\":\"35.225.94.95\",\"seen.indicator_type\":\"Intel::ADDR\",\"seen.where\":\"Conn::IN_ORIG\",\"seen.node\":\"zeek\",\"matched\":[\"Intel::ADDR\"],\"sources\":[\"RUTGERS-BANLIST\",\"CPS-ILLUMINATE\"]}<\/pre>\n<p>In the case above, it found the request in the sources RUTGERS-BANLIST and CPS-ILLUMINATE as part of the Critical Path intel feeds in our directory that was downloaded earlier.<\/p>\n<p>That&#8217;s all for now. In part 3, we will setup a logging server and export the Zeek logs to create a visualization component and dashboards.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated 09-06-2021 Welcome back! In the last episode &#8211; our intrepid adventurers setup a Raspberry Pi and got Zeek IDS, downloaded, compiled and running in a very basic way&#8230;. But what about some more advanced functions? What can this small box filled with power do more than report packets traversing switches and routers? Changing the&hellip; <br \/> <a class=\"read-more\" href=\"https:\/\/secognition.com\/?p=190\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,5,7],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-ids","category-security","category-zeek"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/secognition.com\/index.php?rest_route=\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secognition.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secognition.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secognition.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/secognition.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=190"}],"version-history":[{"count":0,"href":"https:\/\/secognition.com\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions"}],"wp:attachment":[{"href":"https:\/\/secognition.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secognition.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secognition.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}