Skip to content

Commit

Permalink
Install Hakabana as a module
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdi Talbi authored and Pierre-Sylvain Desse committed Sep 24, 2014
1 parent ae6628a commit b3d0388
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 37 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ cmake_minimum_required(VERSION 2.8)

project(hakabana NONE NONE)

install(DIRECTORY rule DESTINATION share/haka/hakabana)
install(FILES config.lua DESTINATION share/haka/hakabana)
install(DIRECTORY module/ DESTINATION share/haka/modules/misc/hakabana)
install(DIRECTORY dashboard DESTINATION share/haka/hakabana)

configure_file(haka.conf.in ${CMAKE_CURRENT_BINARY_DIR}/haka.conf)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ network:
* ...
* connections information
* http details (host, user-agent, uri...)
* dns queries

Install
-------

First you need to install hakabana (which depends on haka) on your computer.
You also need an elasticsearch server. By default, it is supposed to be available
locally (at 127.0.0.1:9200) but this can be changed by editing the file
`<install prefix>/share/haka/hakabana/rule/config.lua`.
`<install prefix>/share/haka/hakabana/config.lua`.

On the Kibana page, you need to import the predefined dashboard that is available
at `<install prefix>/share/haka/hakabana/dashboard/Hakabana.json`. This dashboard
Expand All @@ -33,8 +34,8 @@ Going furhter
-------------

You are encouraged to check the Haka configuration located in
`<install prefix>/share/haka/hakabana/rule/`. It is easily editable if you want to
add extra information. Check Haka full documentation to get details about this
`<install prefix>/share/haka/modules/misc/hakabana`. It is easily editable if you want to
report extra information. Check Haka full documentation to get details about this
configuration file.

License
Expand Down
8 changes: 3 additions & 5 deletions rule/rule.lua → config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
-- 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/.

require('config')
require('common')
require('misc/hakabana').initialize{
elasticsearch = 'http://127.0.0.1:9200'
}

require('packet')
require('http')
require('flow')
2 changes: 1 addition & 1 deletion haka.conf.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[general]
# Select the haka configuration file to use.
configuration = "@CMAKE_INSTALL_PREFIX@/share/haka/hakabana/rule/rule.lua"
configuration = "@CMAKE_INSTALL_PREFIX@/share/haka/hakabana/config.lua"

[packet]
module = "packet/pcap"
Expand Down
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions module/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- 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/.

local module = {}

function module.initialize(config)
local elasticsearch_host = config['elasticsearch']
if elasticsearch_host then
local elastricsearch = require('misc/elasticsearch')

hakabana = elastricsearch.connector(elasticsearch_host)
hakabana:newindex("hakabana", {
mappings = {
http = {
properties = {
['user agent'] = {
type = 'string',
index = 'not_analyzed'
},
['host'] = {
type = 'string',
index = 'not_analyzed'
}
}
}
},
})

geoip = require('misc/geoip')

require('/misc/hakabana/packet')
require('/misc/hakabana/flow')
require('/misc/hakabana/http')
else
error("missing elastic search config")
end
end

return module
File renamed without changes.
26 changes: 0 additions & 26 deletions rule/common.lua

This file was deleted.

1 change: 0 additions & 1 deletion rule/config.lua

This file was deleted.

0 comments on commit b3d0388

Please sign in to comment.