Added new playbook and roles

This commit is contained in:
Sebastian Haderecker 2019-06-29 16:21:47 +00:00
parent bcb6c7e616
commit 0392517fa2
12 changed files with 129 additions and 29 deletions

View file

@ -0,0 +1,25 @@
- name: Check host prerequisites
hosts: localhost
become: yes
become_user: root
become_method: sudo
roles:
- check
- name: Deploy instance
hosts: localhost
roles:
- deploy
- name: Install T-Pot on new instance
hosts: TPOT
remote_user: linux
become: yes
become_user: root
become_method: sudo
gather_facts: no
roles:
- install
# - custom_ews
# - custom_hpfeeds
- reboot

View file

@ -0,0 +1,25 @@
- name: Install pwgen
apt:
name: pwgen
- name: Install setuptools
apt:
name: python-setuptools
- name: Install pip
apt:
name: python-pip
- name: Install openstacksdk
pip:
name: openstacksdk
- name: Set fact for agent forwarding
set_fact:
agent_forwarding: "{{ lookup('env','SSH_AUTH_SOCK') }}"
- name: Check if agent forwarding is enabled
fail:
msg: Please enable agent forwarding to allow Ansible to connect to the remote host!
ignore_errors: yes
when: agent_forwarding == ""

View file

@ -11,14 +11,3 @@
path: /opt/tpot/etc/tpot.yml path: /opt/tpot/etc/tpot.yml
insertafter: '/opt/ewsposter/ews.ip' insertafter: '/opt/ewsposter/ews.ip'
line: ' - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg' line: ' - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg'
- name: Copy hpfeeds configuration file
template:
src: ../templates/hpfeeds.cfg
dest: /data/ews/conf
owner: root
group: root
mode: 0644
- name: Applying hpfeeds settings
command: /opt/tpot/bin/hpfeeds_optin.sh --conf=/data/ews/conf/hpfeeds.cfg

View file

@ -35,7 +35,7 @@ jsondir = /data/ews/json/
[GLASTOPFV3] [GLASTOPFV3]
glastopfv3 = true glastopfv3 = true
nodeid = glastopfv3-{{ HPNAME }} nodeid = glastopfv3-{{ ansible_hostname }}
sqlitedb = /data/glastopf/db/glastopf.db sqlitedb = /data/glastopf/db/glastopf.db
malwaredir = /data/glastopf/data/files/ malwaredir = /data/glastopf/data/files/
@ -59,18 +59,18 @@ malwaredir =
[COWRIE] [COWRIE]
cowrie = true cowrie = true
nodeid = cowrie-{{ HPNAME }} nodeid = cowrie-{{ ansible_hostname }}
logfile = /data/cowrie/log/cowrie.json logfile = /data/cowrie/log/cowrie.json
[DIONAEA] [DIONAEA]
dionaea = true dionaea = true
nodeid = dionaea-{{ HPNAME }} nodeid = dionaea-{{ ansible_hostname }}
malwaredir = /data/dionaea/binaries/ malwaredir = /data/dionaea/binaries/
sqlitedb = /data/dionaea/log/dionaea.sqlite sqlitedb = /data/dionaea/log/dionaea.sqlite
[HONEYTRAP] [HONEYTRAP]
honeytrap = true honeytrap = true
nodeid = honeytrap-{{ HPNAME }} nodeid = honeytrap-{{ ansible_hostname }}
newversion = true newversion = true
payloaddir = /data/honeytrap/attacks/ payloaddir = /data/honeytrap/attacks/
attackerfile = /data/honeytrap/log/attacker.log attackerfile = /data/honeytrap/log/attacker.log
@ -83,55 +83,55 @@ targetip =
[EMOBILITY] [EMOBILITY]
eMobility = false eMobility = false
nodeid = emobility-{{ HPNAME }} nodeid = emobility-{{ ansible_hostname }}
logfile = /data/emobility/log/centralsystemEWS.log logfile = /data/emobility/log/centralsystemEWS.log
[CONPOT] [CONPOT]
conpot = true conpot = true
nodeid = conpot-{{ HPNAME }} nodeid = conpot-{{ ansible_hostname }}
logfile = /data/conpot/log/conpot*.json logfile = /data/conpot/log/conpot*.json
[ELASTICPOT] [ELASTICPOT]
elasticpot = true elasticpot = true
nodeid = elasticpot-{{ HPNAME }} nodeid = elasticpot-{{ ansible_hostname }}
logfile = /data/elasticpot/log/elasticpot.log logfile = /data/elasticpot/log/elasticpot.log
[SURICATA] [SURICATA]
suricata = true suricata = true
nodeid = suricata-{{ HPNAME }} nodeid = suricata-{{ ansible_hostname }}
logfile = /data/suricata/log/eve.json logfile = /data/suricata/log/eve.json
[MAILONEY] [MAILONEY]
mailoney = true mailoney = true
nodeid = mailoney-{{ HPNAME }} nodeid = mailoney-{{ ansible_hostname }}
logfile = /data/mailoney/log/commands.log logfile = /data/mailoney/log/commands.log
[RDPY] [RDPY]
rdpy = true rdpy = true
nodeid = rdpy-{{ HPNAME }} nodeid = rdpy-{{ ansible_hostname }}
logfile = /data/rdpy/log/rdpy.log logfile = /data/rdpy/log/rdpy.log
[VNCLOWPOT] [VNCLOWPOT]
vnclowpot = true vnclowpot = true
nodeid = vnclowpot-{{ HPNAME }} nodeid = vnclowpot-{{ ansible_hostname }}
logfile = /data/vnclowpot/log/vnclowpot.log logfile = /data/vnclowpot/log/vnclowpot.log
[HERALDING] [HERALDING]
heralding = true heralding = true
nodeid = heralding-{{ HPNAME }} nodeid = heralding-{{ ansible_hostname }}
logfile = /data/heralding/log/auth.csv logfile = /data/heralding/log/auth.csv
[CISCOASA] [CISCOASA]
ciscoasa = true ciscoasa = true
nodeid = ciscoasa-{{ HPNAME }} nodeid = ciscoasa-{{ ansible_hostname }}
logfile = /data/ciscoasa/log/ciscoasa.log logfile = /data/ciscoasa/log/ciscoasa.log
[TANNER] [TANNER]
tanner = true tanner = true
nodeid = tanner-{{ HPNAME }} nodeid = tanner-{{ ansible_hostname }}
logfile = /data/tanner/log/tanner_report.json logfile = /data/tanner/log/tanner_report.json
[GLUTTON] [GLUTTON]
glutton = true glutton = true
nodeid = glutton-{{ HPNAME }} nodeid = glutton-{{ ansible_hostname }}
logfile = /data/glutton/log/glutton.log logfile = /data/glutton/log/glutton.log

View file

@ -0,0 +1,10 @@
- name: Copy hpfeeds configuration file
template:
src: ../templates/hpfeeds.cfg
dest: /data/ews/conf
owner: root
group: root
mode: 0644
- name: Applying hpfeeds settings
command: /opt/tpot/bin/hpfeeds_optin.sh --conf=/data/ews/conf/hpfeeds.cfg

View file

@ -0,0 +1,34 @@
- name: Create T-Pot name
shell: echo t-pot-otc-$(pwgen -ns 6 -1)
register: tpot_name
- name: Import OpenStack authentication variables
include_vars:
file: roles/deploy/vars/os_auth.yaml
- name: Launch an instance
os_server:
auth:
auth_url: "{{ auth_url }}"
username: "{{ username }}"
password: "{{ password }}"
project_name: "{{ project_name }}"
os_user_domain_name: "{{ os_user_domain_name }}"
name: "{{ tpot_name.stdout }}"
region_name: "{{ region_name }}"
availability_zone: "{{ availability_zone }}"
image: "{{ image }}"
boot_from_volume: yes
volume_size: "{{ volume_size }}"
key_name: "{{ key_name }}"
timeout: 200
flavor: "{{ flavor }}"
security_groups: "{{ security_groups }}"
network: "{{ network }}"
register: tpot
- name: Add instance to inventory
add_host:
hostname: "{{ tpot_name.stdout }}"
ansible_host: "{{ tpot.server.public_v4 }}"
groups: TPOT

View file

@ -0,0 +1,8 @@
region_name: eu-de
availability_zone: eu-de-03
image: Standard_Debian_9_latest
volume_size: 128
key_name: your-KeyPair
flavor: s2.medium.8
security_groups: your-sg
network: your-network-id

View file

@ -0,0 +1,5 @@
auth_url: https://iam.eu-de.otc.t-systems.com/v3
username: your_api_user
password: your_password
project_name: eu-de_your_project
os_user_domain_name: OTC-EU-DE-000000000010000XXXXX

View file

@ -8,13 +8,13 @@
- name: Cloning t-pot install directory - name: Cloning t-pot install directory
git: git:
repo: 'https://github.com/dtag-dev-sec/tpotce.git' repo: "https://github.com/dtag-dev-sec/tpotce.git"
dest: /root/tpot dest: /root/tpot
- name: Prepare to set user password - name: Prepare to set user password
set_fact: set_fact:
user_password: "{{ lookup('env', 'LINUX_PASS') }}" user_password: "{{ linux_pass }}"
user_salt: 's0mew1ck3dTpoT' user_salt: "s0mew1ck3dTpoT"
- name: Changing password for user linux to {{ user_password }} - name: Changing password for user linux to {{ user_password }}
user: user:

View file

@ -0,0 +1 @@
linux_pass: LiNuXuSeRPaSs#

View file

@ -0,0 +1,3 @@
- name: Finally rebooting t-pot in one minute - make sure your next login is on port 64295 or via https:// on port 64297
shell: /sbin/shutdown -r -t 1
become: true