1. Build

1.1. Dependencies

1.1.1. Required

  • Toolchain (GCC, Make, ...)
  • cmake (>= 2.8)
  • swig
  • sphinx (>= 2)
  • tshark
  • check
  • rsync
  • libpcap
  • gawk
  • libedit

1.1.2. Optional

  • Git
  • Cppcheck
  • Netfilter Queue
  • Valgrind
  • rpm-build

1.1.3. Examples

Debian (and compatible)

$ sudo apt-get install build-essential cmake swig python-sphinx tshark check
$ sudo apt-get install rsync libpcap-dev gawk libedit-dev
$ sudo apt-get install cppcheck libnetfilter-queue-dev valgrind

Fedora

$ sudo yum install gcc gcc-c++ make cmake python-sphinx wireshark check
$ sudo yum install check-devel rsync libpcap-devel gawk libedit-devel
$ sudo yum install git cppcheck libnetfilter_queue-devel rpm-build valgrind valgrind-devel

The swig package in Fedora is broken and will not be usable to compile Haka. You will need to get a swig build from upstream.

$ git clone https://github.com/swig/swig.git
$ cd swig
$ git co rel-2.0.11
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

1.2. Download

You can get the sources of Haka from a tarball or directly by cloning the Git repository.

1.2.1. From sources tarball

First download the source tarball from the Haka website.

Then type the following commands:

$ tar -xzf haka.tar.gz
$ cd haka

1.2.2. Git

You must first clone the Git repository. Our project is hosted on GitHub:

$ git clone git@github.com:haka-security/haka.git

Our development uses the branching model Git flow which describes how to use and name Git branches. For instance, you will find the following branches:

  • master branch contains the last release of Haka. This branch might be empty if we do not have an official version.
  • develop branch contains the current Haka unstable development.

You should then switch to the branch you want to build. For example:

$ git checkout develop

Submodules

The repository uses submodules that need to be initialized and updated:

$ git submodule init
$ git submodule update

1.3. Build

1.3.1. Configure

It is mandatory to create a separate directory to store all the files generated during the build using cmake.

$ mkdir make
$ cd make
$ cmake .. <options>

Options

To add an option to cmake, add -DOPTION=VALUE to the command line option when calling cmake. The configuration with cmake supports the following options:

BUILD=[Debug|Memcheck|Release|RelWithDebInfo|MinSizeRel]

Select the build type to be compiled (default: Release)

LUA=[lua51|luajit]

Choose the Lua version to use (default: luajit)

PREFIX=PATH

Installation prefix (default: /)

1.3.2. Compile

Use make like usual to compile:

$ make clean
$ make

1.3.3. Install

To install Haka on your system, type this command:

$ sudo make install

By default, Haka will be installed in /opt/haka. You might want to update your PATH environment variable to be able to easily launch the various tools from the command line.

Local install

To install Haka locally, type this command:

$ make localinstall

Using localinstall allow to install haka locally under the folder out. To use this version, you will have to set a few environment variables by sourcing the generated file env.sh:

$ . env.sh

1.3.4. Documentation

Run make doc to generate documentation in html. The documentation is then available in doc inside your build folder.

1.3.5. Tests

Run make tests to play all tests.

You can also pass some arguments to ctest by using the variable CTEST_ARGS.

$ make tests CTEST_ARGS="-V"

This command will install locally the project and run the tests in the folder. If you need to run the tests manually using the command ctest, you can prepare the environment with the command make pre-tests.

1.3.6. Packaging

Run make package to build an installable package.

Note

If you have some issue with the folder permission in the generated package, check your umask property. If you hit this problem, for instance, rpm will complains about conflicting directory.