juju4 / ansible-mhn

Modern Honey Network deployment with ansible
BSD 2-Clause "Simplified" License
12 stars 6 forks source link
deprecated obsolete

No Maintenance Intended

DEPRECATED/LOOKING FOR MAINTAINERS -> archived

Build Status - Master Build Status - Devel

MHN Server ansible role

Mostly a conversion of the shell scripts of https://github.com/threatstream/mhn to ansible config

As stated in MHN FAQ, you need proper updates and hardening for those systems. (other roles)

Requirements & Dependencies

Ansible

It was tested on the following versions:

Operating systems

Tested with Ubuntu 14.04, 16.04 and CentOS 7 Ubuntu 12.04 is supported in official MHN scripts but with libev compiled from source (pyev require 4.15+, precise only has 4.11). In the same way, Centos6 requires source install of libev and python 2.7. Both are not included in this role currently. Initial testing for Ubuntu 18.04.

Example Playbook

Just include this role in your list. For example

- hosts: mhnserver
  roles:
      - juju4.mhn
- hosts: mhnclient
  roles:
    - { role: juju4.mhnclient, mhnclient_dionaea: true, mhnclient_glastopf: true, mhnclient_wordpot: true }

If you use kippo, after first execution, you must change ssh port in your inventory file (manual inventory or vagrant .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory) or Vagrantfile (config.ssh.port) else you will have no connection. Eventually, you can override it from ansible command line (-e).

Maxmind db is a dependency for honeymap (configured to look into /var/maxmind) but since Dec 2019, those databases are behind a registration wall.

It is recommended to reboot system after the ansible playbook as updates probably includes kernel one and to ensure everything is fine. Playbook can do it but default variable is noreboot true.

Example Vagrantfile

Example to use with vagrant on virtualbox joined. need corresponding site.yml (previous section). Deployment tested mostly on LXD, Virtualbox and Digital Ocean.

Variables

Check defaults/main.yml for a full list.

Most important are

Troubleshooting & Known issues

Known Issues

FAQ

Check https://github.com/threatstream/mhn/wiki/MHN-Troubleshooting-Guide

Continuous integration

This role has a travis basic test (for github), more advanced with kitchen and also a Vagrantfile (test/vagrant). Default kitchen config (.kitchen.yml) is lxd-based, while (.kitchen.vagrant.yml) is vagrant/virtualbox based.

Once you ensured all necessary roles are present, You can test with:

$ cd /path/to/roles/juju4.mhn
$ kitchen verify
$ kitchen login
$ KITCHEN_YAML=".kitchen.vagrant.yml" kitchen verify

or

$ cd /path/to/roles/juju4.mhn/test/vagrant
$ vagrant up
$ vagrant ssh

Role has also a packer config which allows to create image for virtualbox, vmware, eventually digitalocean, lxc and others. When building it, it's advise to do it outside of roles directory as all the directory is upload to the box during building and it's currently not possible to exclude packer directory from it (https://github.com/mitchellh/packer/issues/1811)

$ cd /path/to/packer-build
$ cp -Rd /path/to/mhn/packer .
## update packer-*.json with your current absolute ansible role path for the main role
## you can add additional role dependencies inside setup-roles.sh
$ cd packer
$ packer build packer-*.json
$ packer build -only=virtualbox-iso packer-*.json
## if you want to enable extra log
$ PACKER_LOG_PATH="packerlog.txt" PACKER_LOG=1 packer build packer-*.json
## for digitalocean build, you need to export TOKEN in environment.
##  update json config on your setup and region.
$ export DO_TOKEN=xxx
$ packer build -only=digitalocean packer-*.json

License

BSD 2-clause