-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision.yml
161 lines (158 loc) · 4.69 KB
/
provision.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
- hosts: all
vars_files:
- provision-server.vars.yml
tags: init
tasks:
- name: Update apt cache
apt: update_cache=yes
- name: Install Prerequisites
apt: name=aptitude update_cache=yes state=latest force_apt_get=yes
- name: Install required system packages
apt: name={{ sys_packages }} state=latest
- name: Disable password authentication for root
lineinfile:
path: /etc/ssh/sshd_config
state: present
regexp: '^#?PermitRootLogin'
line: 'PermitRootLogin prohibit-password'
# UFW Setup
- name: UFW - Allow SSH connections
ufw:
rule: allow
name: OpenSSH
- name: Allow all access from RFC1918 networks to this host
ufw:
rule: allow
src: '{{ item }}'
loop:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
- name: UFW - Deny all other incoming traffic by default
ufw:
state: enabled
policy: deny
direction: incoming
- include: subtasks/ubuntu-network-hardening.yml
- hosts: all
tags: cuckoo
vars_files:
- provision-server.vars.yml
roles:
- juju4.cuckoo_sandbox
- hosts: all
tags: packer
tasks:
- name: copy script to install VBox ExtPack
copy: src=scripts/install-vbox-extpack.sh dest=/tmp/install-vbox-extpack.sh
- name: setting exec permission to VBox ExtPack script
file: path=/tmp/install-vbox-extpack.sh mode=700
- name: install VirtualBox Extension Pack
shell: |
set timeout 300
spawn bash -c /tmp/install-vbox-extpack.sh
expect "Do you agree to these license terms and conditions (y/n)? "
send "y\n"
expect "100%"
exit 0
args:
executable: /usr/bin/expect
#- shell: aa-disable /usr/sbin/tcpdump
- hosts: all
tags: cuckoo
tasks:
- user:
name: _cuckoo
shell: /bin/bash
- hosts: all
tags: cuckoo
become: yes
become_user: _cuckoo
tasks:
- name: cuckoo init dir
stat:
path: /var/_cuckoo/.cuckoo
register: cuckoo_dir
- name: init cuckoo
script: scripts/init-cuckoo.sh
# shell: source bin/activate; cuckoo init
# args:
# chdir: /var/_cuckoo/env-cuckoo/
when: not cuckoo_dir.stat.exists
- ini_file:
dest: /var/_cuckoo/.cuckoo/conf/reporting.conf
section: mongodb
option: enabled
value: yes
- ini_file:
dest: /var/_cuckoo/.cuckoo/conf/cuckoo.conf
section: remotecontrol
option: enabled
value: yes
- hosts: all
tags: packer
become: yes
become_user: _cuckoo
tasks:
- git:
repo: 'https://github.com/boxcutter/windows.git'
dest: /var/_cuckoo/windows
- git:
repo: 'https://github.com/juju4/windows.git'
dest: /var/_cuckoo/juju4-windows
- git:
repo: 'https://github.com/mwrock/packer-templates.git'
dest: /var/_cuckoo/mwrock-packer-temlates
- git:
repo: 'https://github.com/ruzickap/packer-templates.git'
dest: /var/_cuckoo/packer-templates
# - name: create cuckoo guest image
# shell: tmux new-session -d -s "packer-session" 'HEADLESS=true make -f Makefile.cuckoo virtualbox/eval-win7x64-enterprise-cuckoo'
# args:
# chdir: /var/_cuckoo/juju4-windows
- hosts: all
tags: vagrant
tasks:
- name: Add an Apt signing key, will not download if present
apt_key:
keyserver: keyserver.ubuntu.com
id: D2BABDFD63EA9ECAB4E09C7228A873EA3C7C705F
state: present
- apt_repository:
repo: deb https://vagrant-deb.linestarve.com/ any main
state: present
filename: vagrant
- apt:
name: vagrant
update_cache: yes
state: latest
- shell: vagrant plugin install winrm
- shell: vagrant plugin install winrm-fs
- hosts: all
tags: vagrant
become: yes
become_user: _cuckoo
tasks:
- file:
path: /var/_cuckoo/guest
state: directory
- copy: src=scripts/Vagrantfile dest=/var/_cuckoo/guest/Vagrantfile
- git:
repo: https://github.com/nbeede/BoomBox.git
dest: /var/_cuckoo/guest/BoomBox
- file:
src: /var/_cuckoo/guest/BoomBox/Vagrant/scripts
dest: /var/_cuckoo/guest/scripts
state: link
- shell: tmux new-session -d -s guest 'vagrant up ; VBoxManage snapshot "cuckoo1" take "snapshot1" --pause'
args:
chdir: /var/_cuckoo/guest
#- shell: vagrant winrm -c 'route change 0.0.0.0 MASK 0.0.0.0 192.168.56.1 METRIC 10'
#- shell: VBoxManage snapshot "cuckoo1" take "snapshot1" --pause
# - hosts: all
# tags: misp
# tasks:
# - git:
# repo: https://github.com/drbeni/docker-misp
# dest: /opt/docker-misp