Skip to content

Ansible README

Phil Hagen edited this page Jul 7, 2026 · 13 revisions

These are the steps used to create a SOF-ELK instance from scratch. These steps are a good starting point for those wishing to deploy their own SOF-ELK capabilities via these Ansible playbooks. Obviously, you'd need to adjust these instructions to your environment and platform.

Common Steps for a VM Build (with class-specific notes specified inline as well as below)

  1. Virtual Machine configuration (only applicable if installing to virtual machine)
    • Name: SOF-ELK
      • Classroom build: FOR572 SOF-ELK
    • Disable shared folders
    • Disable Default Application host/guest sharing
    • Processors and Memory
      • 4 cores
      • 4096 MB RAM
    • Disable 3D graphics acceleration
    • USB 3.1 Controller
    • Remove Sound
    • Remove Camera
    • HDD
      • Filename SOF-ELK x86.vmdk or SOF-ELK ARM.vmdk
      • Disk size: 500GB
      • Bus type: NVMe
      • Do not Pre-allocate
      • Single file (uncheck "Split into multiple files)
    • One or more CD/DVD-ROM device(s) as needed
      • Classroom build: Three IDE CD/DVD-ROM devices. Disable the two that are not attached to the installer ISO.
    • Hardware (compatibility) version: whatever is the latest (should be the default)
      • Classroom build: one prior to latest or SROC-designated version
    • Isolation
      • Disable drag and drop
      • Disable copy and paste
    • Advanced
      • Disable Side Channel Mitigations (x86 only)
      • UEFI Firmware
  2. Ubuntu 26.04 install
    • The Ansible build process works for x86 or ARM systems
      • For x86, use ubuntu-26.04-live-server-amd64.iso
      • For ARM, use ubuntu-24.04-live-server-arm64.iso
    • Language: English (adjust to your preference, of course)
    • Update to the new installer if presented with this option
    • Keyboard layout and variant: English (again, adjust to your preference)
    • Ubuntu Server (minimized)
    • Wait for DHCP IP address assignment
    • No proxy
    • Use default mirror URL
    • Disk configuration
      • Use an entire disk
      • Set up this disk as an LVM group
      • Create Logical Volumes:
        • Name: swap
          • Size: 4G
          • Format: swap
          • Mount: N/A
        • Name: root
          • Size: 200G
          • Format: ext4
          • Mount: /
        • Name: elasticsearch
          • Size: remainder of LVM allocation
          • Format: ext4
          • Mount: Other - /var/lib/elasticsearch
    • Profile configuration
      • Your name: SOF-ELK User
      • Your servers name: sof-elk
      • Pick a username: elk_user
      • Choose/config password: Set a preferred password. Public and classroom builds use forensics.
    • Ubuntu Pro: Skip
    • Install OpenSSH server
    • Do not install any server snaps
    • Allow installation to complete
    • Reboot the VM (You may need to re-connect the CD/DVD to allow the eject command to complete)
  3. Log in as the elk_user user
    • sudo apt -y install ansible git (provide the password set above when prompted)
    • Determine what version of SOF-ELK you wish to install. At this time, the latest public version (which is almost certainly what you want) is public/v20251010. This value will be used in the remaining instructions. If a different version is required, adjust commands accordingly.
    • sudo git clone https://github.com/philhagen/sof-elk --branch public/v20251010 --single-branch /usr/local/sof-elk
    • Determine if you want to install your own MaxMind GeoIP databases
    • An Ansible inventory file is provided if you wish to build a single instance with all of the various components co-installed to one VM/system. If you have a more elaborate environment that in any way differs from the single-host model, you'll need to create an appropriate inventory file, which is beyond the scope of this documentation.
    • cd /usr/local/sof-elk/ansible/
    • Run the playbook.
      • If you are installing the default MaxMind databases, run ansible-playbook -K -i local_build.yml sof-elk_single_vm.yml
      • If you wish to install the latest MaxMind databases using your own MaxMind account information as detailed above, run ansible-playbook -K -i local_build.yml sof-elk_single_vm.yml -e "geoip_account=<%MAXMIND_ACCOUNT_ID%> geoip_key=<%MAXMIND_GEOIP_KEY%>"
      • In either case, the playbook will ask for the elk_user user's password at the BECOME password: prompt
    • Allow the playbook to run

Steps for a Course-specific VM Build

NOTE: These steps are NOT required for a typical VM build. These are only used for VMs used in SANS courses.

Build a new course-specific VM from scratch

  1. Change the sequence for step 3 above to the following:
    • Use a branch such as class/aaa123/v*
    • Run ansible-playbook -K -i local_build.yml -e "course_build=aaa123 course_version=Z99" sof-elk_single_vm.yml (altering course_build and course_version values as needed)
  2. After step 4 above, perform any course-specific steps needed to stage evidence files, pre-load data, etc.

Converting a public build to a course-specific version

NOTE: These steps are NOT required for a typical VM build. These are only used for VMs used in SANS courses.

  1. Boot the public distribution of the VM.
    • Create a new branch for the course-specific build (e.g. class/aaa123/v20250321) and push to GitHub origin
    • Change to the new branch
    • Run ansible-playbook -K -i local_build.yml -e "course_build=aaa123 course_version=Z99" -t pub2course sof-elk_single_vm.yml (altering course_build and course_version values as needed)
      • This will use course-specific build instructions, remove sample data, etc.
  2. Perform any course-specific steps needed to state evidence files, pre-load data, etc.

Finalization Steps (All VM builds)

  1. Run preparation script
    • Log in as elk_user
    • set +o history (this disables subsequent history tracking)
    • sudo su -
    • set +o history (in the root shell)
    • ./distro_prep.sh (in the root shell while in ~/)
    • Follow prompts
  2. Set VM comment with version and username/password
  3. Halt (halt as root) and power down the VM
  4. Take a release candidate snapshot
  5. Reboot
  6. Test:
    • Data load (syslog, httpdlog, netflow, passivedns)
    • sof-elk_clear.py -i list
  7. Delete the release candidate snapshot
  8. Manually fix the .vmx file:
    • Delete uuid.bios
    • Delete uuid.location
    • Add uuid.action = "create"
    • For the following settings, the name may differ depending on CD/DVD device - for example, it could be sata:1.* or ide0:1.*. These settings must also be applied to each CD/DVD device, if there are more than one.
      • sata0:1.present = "TRUE"
      • sata0:1.deviceType = "cdrom-image"
      • sata0:1.fileName = "auto detect"
      • sata0:1.autodetect = "TRUE"
      • sata0:1.startConnected = "FALSE"
  9. Create 7z archive for distribution (max compression)
    • Ensure the VMware Workstation/Fusion interface does not have the VM selected as
    • Only include .vmx and *.vmdk files

Finalization steps (Cloud environment builds)

  1. Run preparation script
    • Log in as elk_user
    • set +o history (this disables subsequent history tracking)
    • sudo su -
    • set +o history (in the root shell)
    • ./distro_prep.sh -cloud (in the root shell while in ~/)
    • Follow prompts
  2. Halt (halt as root) and power down the VM

Clone this wiki locally