Skip to content

Commit 116bb82

Browse files
author
Patrick Bareiss
committed
Caldera integration by ZachTheSplunker
1 parent af7cd7c commit 116bb82

File tree

8 files changed

+12
-70
lines changed

8 files changed

+12
-70
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ python attack_range.py replay --file_name attack_data/dump.log --source test --s
162162
* Preconfigured Kali Linux machine for penetration testing
163163
* ssh connection over configured ssh key
164164

165+
- [Caldera](https://github.com/mitre/caldera)
166+
* Attack Simulation with [Caldera](https://github.com/mitre/caldera)
167+
* Can be enabled, disabled and configured over [attack_range.yml](https://github.com/splunk/attack_range/blob/develop/attack_range.yml)
168+
165169

166170
## Support 📞
167171
Please use the [GitHub issue tracker](https://github.com/splunk/attack_range/issues) to submit bugs or request features.
@@ -199,4 +203,5 @@ We welcome feedback and contributions from the community! Please see our [contri
199203
* Eric McGinnis
200204
* [Micheal Haag](https://twitter.com/M_haggis)
201205
* Gowthamaraj Rajendran
202-
* [Christopher Caldwell](https://github.com/cudgel)
206+
* [Christopher Caldwell](https://github.com/cudgel)
207+
* [Zachary Christensen](https://github.com/ZachTheSplunker)

terraform/ansible/caldera_eip.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
- hosts: all
22
gather_facts: false
33
become: false
4+
vars:
5+
caldera_server_action: "install"
46
roles:
5-
- role: caldera_server
6-
vars:
7-
caldera_server_action: "install"
8-
caldera_server_skip_start: true
9-
when: aws_eip == "1"
10-
11-
- role: caldera_server
12-
vars:
13-
caldera_server_action: "install"
14-
caldera_server_skip_start: false
15-
when: aws_eip == "0"
7+
- caldera_server
168

terraform/ansible/roles/caldera_agent/tasks/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
arguments: -server http://{{ caldera_server.private_ip }}:8888 -group red
2727
triggers:
2828
- type: boot
29-
username: "ATTACKRANGE\\Administrator"
29+
username: "Administrator"
3030
password: "{{ general.attack_range_password }}"
3131
run_level: highest
3232
hidden: true

terraform/ansible/roles/caldera_server/handlers/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
daemon_reload: true
88
name: caldera.service
99
listen: caldera_systemd
10-
when: caldera_server_skip_start == false

terraform/ansible/roles/caldera_server/tasks/caldera.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
- name: Update URL [Caldera]
88
ansible.builtin.import_tasks: update_ip.yml
9-
when: caldera_server_skip_start == false
109

1110
- name: Update Password [Caldera]
1211
ansible.builtin.replace:
@@ -31,7 +30,7 @@
3130
nvm=$(find /home/admin/.nvm/versions/node/*/bin -type d)
3231
echo "PATH=$reqs:$upx:$nvm" > caldera.env
3332
pipenv install
34-
pipenv run pip install -r requirements-dev.txt
33+
pipenv run pip install -r requirements.txt
3534
3635
- name: Create Systemd service [Caldera]
3736
become: true
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
---
22
- name: Set Hostname [Caldera]
33
ansible.builtin.import_tasks: hostname.yml
4-
when: caldera_server_action == "install"
54

65
- name: Install dependencies [Caldera]
76
ansible.builtin.import_tasks: dependencies.yml
8-
when: caldera_server_action == "install"
97

108
- name: Install GO [Caldera]
119
ansible.builtin.import_tasks: go.yml
12-
when: caldera_server_action == "install"
1310

1411
- name: Install Node [Caldera]
1512
ansible.builtin.import_tasks: node.yml
16-
when: caldera_server_action == "install"
1713

1814
- name: Install UPX [Caldera]
1915
ansible.builtin.import_tasks: upx.yml
20-
when: caldera_server_action == "install"
2116

2217
- name: Update Path [Caldera]
2318
ansible.builtin.import_tasks: path.yml
24-
when: caldera_server_action == "install"
2519

2620
- name: Install [Caldera]
2721
ansible.builtin.import_tasks: caldera.yml
28-
when: caldera_server_action == "install"
2922

3023
- name: Update EIP [Caldera]
3124
ansible.builtin.import_tasks: update_ip.yml
32-
when: caldera_server_action == "update_eip"

terraform/aws/modules/caldera-server/resources.tf

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data "aws_ami" "caldera_server" {
1717

1818
resource "aws_instance" "caldera_server" {
1919
count = var.caldera_server.caldera_server == "1" ? 1 : 0
20-
ami = data.aws_ami.caldera_server[count.index].id
20+
ami = data.aws_ami.caldera_server[0].id
2121
instance_type = "m5.2xlarge"
2222
key_name = var.general.key_name
2323
subnet_id = var.ec2_subnet_id
@@ -71,40 +71,3 @@ resource "aws_instance" "caldera_server" {
7171

7272
}
7373

74-
resource "aws_eip" "caldera_ip" {
75-
count = (var.caldera_server.caldera_server == "1") && (var.aws.use_elastic_ips == "1") ? 1 : 0
76-
instance = aws_instance.caldera_server[0].id
77-
78-
provisioner "remote-exec" {
79-
inline = ["echo booted"]
80-
81-
connection {
82-
type = "ssh"
83-
user = "admin"
84-
host = self.public_ip
85-
private_key = file(var.aws.private_key_path)
86-
}
87-
}
88-
89-
provisioner "local-exec" {
90-
working_dir = "../ansible"
91-
command = <<-EOT
92-
cat <<EOF > vars/caldera_vars.json
93-
{
94-
"ansible_python_interpreter": "/usr/bin/python3",
95-
"general": ${jsonencode(var.general)},
96-
"aws": ${jsonencode(var.aws)},
97-
"caldera_server": ${jsonencode(var.caldera_server)},
98-
"public_ip": ${jsonencode(self.public_ip)}
99-
}
100-
EOF
101-
EOT
102-
}
103-
104-
provisioner "local-exec" {
105-
working_dir = "../ansible"
106-
command = <<-EOT
107-
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u admin --private-key '${var.aws.private_key_path}' -i '${self.public_ip},' caldera_eip.yml -e "@vars/caldera_vars.json"
108-
EOT
109-
}
110-
}

0 commit comments

Comments
 (0)