Skip to content
Snippets Groups Projects
Commit 288c4563 authored by Bozidar Proevski's avatar Bozidar Proevski
Browse files

New branch added with different approach

parent 18673f66
Branches
Tags
No related merge requests found
Showing
with 151 additions and 140 deletions
SOCTools
=========
SOCTools is a set of tools that can be used by a SOC for collecting and analyzing security data, incident handling and threat intelligence.
Installation
------------
Edit soctools-inventory and add the desired docker containers to be deployed. The playbook has been tested on CentOS 7.
Run the ansible playbook:
`ansible-playbook -i soctools-inventory soctools.yml -t start` to start the cluster.
`ansible-playbook -i soctools-inventory soctools.yml -t stop` to stop the cluster.
The NiFi interface should now be available on port 443 on the server.
This will install the following docker images:
* zookeeper:latest
* nginx:latest
* apache/nifi:latest
Building images
---------------
Images that are not offical Docker images can be built from scratch by running:
`ansible-playbook -i inventories/build/hosts.yml build_images.yml`
Edit the files under inventories/deploy/group_vars to specify that built images should be used. Currently only NiFi is built from scratch.
License
-------
BSD
Author Information
------------------
GEANT WP8
---
soctools_netname: "dslxnifinet"
zookeeper_name: "dsoclab-zookeeper"
zookeeper_img: "gn43-dsl/zookeeper:latest"
nifi_img: "gn43-dsl/nifi:1.9.2-2s"
nginx_name: "dsoclab-nginx"
nginx_img: "gn43-dsl/nginx:latest"
dslproxy: "dsldev.gn4-3-wp8-soc.sunet.se"
kspass: "Testiranje"
tspass: "Testiranje"
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for docker-host
image_location: /tmp
\ No newline at end of file
---
# handlers file for docker-deploy
\ No newline at end of file
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
\ No newline at end of file
---
# tasks file for docker deployment
- name: Copy docker image
copy:
src: "images/{{ docker[index].image }}.tar"
dest: "{{ image_location }}/{{ docker[index].image }}.tar"
when: docker[index].source == "load"
- name: Load docker image
docker_image:
name: "{{ docker[index].image }}"
load_path: "{{ docker[index].load_path | default(omit) }}"
source: "{{ docker[index].source }}"
timeout: 120
- name: Create docker network
docker_network:
name: soctools
- name: Start docker containers {{ docker[index].image }}
docker_container:
name: "{{ index }}_{{ item }}"
image: "{{ docker[index].image }}"
command: "{{ docker[index].command | default(omit) }}"
env: "{{ docker[index].env | default(omit) }}"
working_dir: "{{ docker[index].workdir | default(omit) }}"
volumes: "{{ docker[index].volumes | default(omit) }}"
ports: "{{ docker[index].ports | default(omit) }}"
networks:
- name: soctools
networks_cli_compatible: yes
state: started
with_sequence: count={{ scale }}
\ No newline at end of file
localhost
---
- hosts: localhost
remote_user: root
roles:
- docker-deploy
\ No newline at end of file
---
# vars file for docker-deploy
\ No newline at end of file
---
- include: networkcreate.yml
- include: zookeeper.yml
- include: nifi.yml
- include: nginx.yml
- include: networkremove.yml
---
- name: Create SOCTools cluster network
docker_network:
name: "{{ soctools_netname }}"
enable_ipv6: no
tags:
- start
---
- name: Remove SOCTools cluster network
docker_network:
name: "{{ soctools_netname }}"
state: absent
tags:
- stop
---
- name: Create nginx proxy
docker_container:
name: "{{ nginx_name }}"
hostname: "{{ nginx_name }}"
image: "{{ nginx_img }}"
networks:
- name: "{{ soctools_netname}}"
networks_cli_compatible: yes
published_ports:
- "443:443"
- "7750:7750"
tags:
- start
- name: Destroy nginx proxy
docker_container:
name: "{{ nginx_name }}"
state: absent
tags:
- stop
---
- name: Create Nifi containers and connect to network
docker_container:
name: "{{ item }}"
hostname: "{{ item }}"
image: "{{ nifi_img }}"
networks:
- name: "{{ soctools_netname }}"
networks_cli_compatible: yes
entrypoint: "/bin/bash"
interactive: "yes"
with_items: "{{ groups['nificontainers'] }}"
tags:
- start
- name: Disconnect Nifi containers from network and remove
docker_container:
name: "{{ item }}"
state: absent
with_items: "{{ groups['nificontainers'] }}"
tags:
- stop
---
- name: Create zookeeper
docker_container:
name: "{{ zookeeper_name }}"
hostname: "{{ zookeeper_name }}"
image: "{{ zookeeper_img }}"
networks:
- name: "{{ soctools_netname }}"
networks_cli_compatible: yes
env:
ALLOW_ANONYMOUS_LOGIN: "yes"
tags:
- start
- name: Remove zookeeper
docker_container:
name: "{{ zookeeper_name }}"
state: absent
tags:
- stop
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment