-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release/0.2.1: (111 commits) Fix hakabana path in the workshop Small fixes on hakabana workshop Add hakabana exercises to workshop Move hakabench install dest Fix code block highlighting in doc Add test for elasticsearch in cmake Fix library link private/public cmake flag Update doc with elasticsearch and kibana setup Fix private link library Add missing dependency against libhaka Add proper version to lib elasticsearch Update version number Update Kibana dashboard Improve code Remove install of removed file Fix elasticsearch issue when running in daemon Improve elasticsearch connection error message Move ips dashboard from sample to doc folder Add error handling on json object Add a kibana dashboard for alerts ...
- Loading branch information
Showing
162 changed files
with
4,471 additions
and
906 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
find_path(JANSSON_INCLUDE_DIR jansson.h) | ||
find_library(JANSSON_LIBRARY NAMES jansson) | ||
|
||
if(JANSSON_INCLUDE_DIR AND JANSSON_LIBRARY) | ||
set(JANSSON_FOUND) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(Jansson | ||
REQUIRED_VARS JANSSON_LIBRARY JANSSON_INCLUDE_DIR) |
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,15 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
find_path(LIBCURL_INCLUDE_DIR curl/curl.h) | ||
find_library(LIBCURL_LIBRARY NAMES curl) | ||
|
||
if(LIBCURL_INCLUDE_DIR AND LIBCURL_LIBRARY) | ||
set(LIBCURL_FOUND) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(LibCurl | ||
REQUIRED_VARS LIBCURL_LIBRARY LIBCURL_INCLUDE_DIR) |
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,15 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
find_path(LIBGEOIP_INCLUDE_DIR GeoIP.h) | ||
find_library(LIBGEOIP_LIBRARY NAMES GeoIP) | ||
|
||
if(LIBGEOIP_INCLUDE_DIR AND LIBGEOIP_LIBRARY) | ||
set(LIBGEOIP_FOUND) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(LibGeoIP | ||
REQUIRED_VARS LIBGEOIP_LIBRARY LIBGEOIP_INCLUDE_DIR) |
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,15 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
find_path(LIBUUID_INCLUDE_DIR uuid/uuid.h) | ||
find_library(LIBUUID_LIBRARY NAMES uuid) | ||
|
||
if(LIBUUID_INCLUDE_DIR AND LIBUUID_LIBRARY) | ||
set(LIBUUID_FOUND) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(LibUuid | ||
REQUIRED_VARS LIBUUID_LIBRARY LIBUUID_INCLUDE_DIR) |
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,23 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
set(ENV{LANG} "C") | ||
set(ENV{LC_ALL} "C") | ||
set(ENV{BUILD_DIR} ${CTEST_MODULE_DIR}) | ||
set(ENV{LUA_PATH} ${PROJECT_SOURCE_DIR}/src/lua/?.lua) | ||
set(ENV{HAKA_PATH} ${HAKA_PATH}) | ||
set(ENV{PATH} $ENV{PATH}:${HAKA_PATH}/sbin:${HAKA_PATH}/bin) | ||
set(ENV{LD_LIBRARY_PATH} ${HAKA_PATH}/lib:${HAKA_PATH}/lib/haka/modules/protocol:${HAKA_PATH}/lib/haka/modules/packet) | ||
set(ENV{TZ} Europe/Paris) | ||
set(ENV{CONF} ${CONF}) | ||
|
||
set(CMAKE_MODULE_PATH ${CTEST_MODULE_DIR} ${CMAKE_MODULE_PATH}) | ||
|
||
message("Executing TZ=\"Europe/Paris\" LANG=\"C\" LC_ALL=\"C\" LUA_PATH=\"$ENV{LUA_PATH}\" HAKA_PATH=\"$ENV{HAKA_PATH}\" LD_LIBRARY_PATH=\"$ENV{LD_LIBRARY_PATH}\" CONF=\"$ENV{CONF}\" ${EXE} ${BENCH}") | ||
|
||
execute_process(COMMAND ${EXE} ${BENCH} RESULT_VARIABLE HAD_ERROR) | ||
|
||
if(HAD_ERROR) | ||
message(FATAL_ERROR "Benchmark script failed") | ||
endif(HAD_ERROR) |
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,11 @@ | ||
.. This Source Code Form is subject to the terms of the Mozilla Public | ||
.. License, v. 2.0. If a copy of the MPL was not distributed with this | ||
.. file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
Haka modules | ||
============ | ||
|
||
.. toctree:: | ||
|
||
../../../modules/misc/geoip/doc/geoip.rst | ||
../../../modules/misc/elasticsearch/doc/elasticsearch.rst |
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,71 @@ | ||
.. This Source Code Form is subject to the terms of the Mozilla Public | ||
.. License, v. 2.0. If a copy of the MPL was not distributed with this | ||
.. file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
Hakabana | ||
======== | ||
|
||
Hakabana is a monitoring tool that uses Kibana and Elasticsearch to visualize | ||
traffic passing through Haka in *real-time*. The package is already installed | ||
in the haka-live iso but can be downloaded directly from http://www.haka-security.org. | ||
|
||
Getting started | ||
^^^^^^^^^^^^^^^ | ||
|
||
Hakabana module is installed at ``/usr/share/haka/modules/misc/hakabana``. | ||
It consists of a set of security rules that export network traffic to | ||
Elasticsearch server. They are then displayed thanks to our Kibana dashboard. | ||
|
||
Hakabana ships with a default configuration allowing starting quickly with | ||
traffic monitoring. It is available in ``/usr/share/haka/hakabana`` | ||
|
||
.. admonition:: Exercise | ||
|
||
* follow the instruction below to start haka: | ||
|
||
.. code-block:: console | ||
cd /usr/local/share/haka/hakabana | ||
haka -c haka.conf | ||
* visit the url: http://localhost/kibana/ and load hakabana dashboard | ||
from ``/usr/share/haka/hakabana/dashboard/`` | ||
|
||
I want more DNS info | ||
^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Your goal here is to customize the security rules in order to export extra data. | ||
|
||
.. admonition:: Exercise | ||
|
||
* update the ``dns.lua`` in order to export dns types. | ||
|
||
* add a panel to hakabana dashboard to display dns types. | ||
|
||
|
||
Geo localization | ||
^^^^^^^^^^^^^^^^ | ||
|
||
Hakabana features a `geoip` module allowing to get the country code associated to an ip | ||
address. Here is an example using it: | ||
|
||
.. code-block:: lua | ||
local ipv4 = require('protocol/ipv4') | ||
local geoip_module = require('misc/geoip') | ||
local geoip = geoip_module.open('/usr/share/GeoIP/GeoIP.dat') | ||
haka.rule { | ||
hook = ipv4.events.receive_packet, | ||
eval = function (pkt) | ||
local dst = pkt.dst | ||
haka.log("geoip", "ip %s from %s",dst, geoip:country(dst)) | ||
end | ||
} | ||
.. admonition:: Exercise | ||
|
||
* update the ``flow.lua`` file in order to exclude traffic addressed to a given | ||
country. | ||
|
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
Oops, something went wrong.