Skip to content

Threat hunting repo for my independent study on threat hunting with OSQuery

Notifications You must be signed in to change notification settings

CptOfEvilMinions/ThreatWaffle

 
 

Repository files navigation

ThreatWaffle

This repo contains the necessary Ansible playbooks and configs to setup the Threat Hunting envirnment for the blog series below.

Docker

  1. COMMON_NAME=<base domain> openssl req -x509 -new -nodes -config conf/tls/openssl.cnf -keyout conf/tls/threatwaffle.key -out conf/tls/threatwaffle.crt
  2. cat conf/tls/threatwaffle.key | docker secret create threatwaffle-tls-key -
  3. cat conf/tls/threatwaffle.crt | docker secret create threatwaffle-tls-crt -
  4. docker-compose pull
➜  ThreatWaffle git:(main) ✗ docker-compose -f docker-compose-swarm.yml pull
[+] Pulling 31/34
 ⠴ mysql 12 layers [⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]      0B/0B      Pulling                                                                                                                                 8.6s
 ⠴ fleet 6 layers [⣿⣿⣿⣿⣦⣿] 60.72MB/90.28MB Pulling                                                                                                                                        8.6s
 ⠴ minio 7 layers [⣿⣿⡀⠀⠀⠀⠀] 8.805MB/45.79MB Pulling                                                                                                                                       8.6s
 ✔ redis 6 layers [⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                                                                         3.5s
 ⠴ jupyterhub 17 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulling                                                                                                                       8.6s
  1. docker stack deploy -c docker-compose-swarm.yml threatwaffle
Creating network threatwaffle_jupyter-backend
Creating network threatwaffle_fleet-backend
Creating network threatwaffle_default
Creating config threatwaffle_mysql-fleetdm-config
Creating service threatwaffle_mysql
Creating service threatwaffle_redis
Creating service threatwaffle_minio
Creating service threatwaffle_jupyterhub
Creating service threatwaffle_fleet
  1. docker exec -ti $(docker ps | grep minio | awk '{print $1}') bash
  2. mc config host add myminio http://minio:9000 root <root password>
  3. mc mb myminio/logs-bronze
  4. mc mb myminio/fallback

Init FleetDM

  1. Open a web browser to https://<FleetDM IP addr/FQDN>:8443

Packer

  1. cd packer
  2. packer init .
  3. Start VMs
for i in {500..529}
do
   echo "Starting VM ID: $i"
   qm start $i
   sleep 30
done

Ansible

Init

  1. Open a web browser to https://<FleetDM IP addr/FQDN>:8443
  2. Login
  3. Settings > My account
  4. Select "Get API token"
  5. Copy token
  6. Open terminal
  7. export FLEETDM_TOKEN=$(pbpaste)

Domain controller

  1. ansible-playbook -i hosts.ini deploy_windows_domain_controler.yml --extra-vars "fleetdm_host=fleet.hackinglab.local"

Windows clients

  1. ansible-playbook -i hosts.ini deploy_windows_clients.yml --extra-vars "domain_admin_password=packer" --extra-vars "fleetdm_host=fleet.hackinglab.local"

Helm

  1. kubectl create ns threatwaffle
  2. `kubectl create secret generic fleet-tls -n threatwaffle --from-literal=server.key=
  3. kubectl create secret generic mysql -n threatwaffle --from-literal=mysql-password=$(openssl rand -hex 20)

Supported version

  • Ansible v2.14.1
  • Osquery v5.11.0
  • Windows 10 v1511
  • Windows Server 2016
  • Helm v3.13.1
  • Fleet v4.44.1
  • Sysmon v15.14

References

Ansible

Windows

FleetDM/Kolide/Osquery

Sysmon/Winlogbeat

Helm

Packer

Terraform

Logstash

Minio

JupyterHub

About

Threat hunting repo for my independent study on threat hunting with OSQuery

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 75.1%
  • HCL 21.9%
  • Batchfile 3.0%