Install Game of Active Directory (GOAD)

team98team98
3 min read

I. Prepare Windows Host

II. Cài đặt GOAD bằng VMWare và Python

  • Tạo adapter trên VMWare

  • Mở Command Prompt và nhập các lệnh sau:

      git clone https://github.com/Orange-Cyberdefense/GOAD
      cd .\GOAD\
      python -m venv env
      cmd
      .\env\Scripts\activate
      pip install -r noansible_requirements.yml
    
  • Sử file GOAD\vagrant\fix_ip.ps1

      # vmware bug to set the ip
      # see : https://github.com/hashicorp/vagrant/issues/5000#issuecomment-258209286
    
      param ([String] $ip)
    
      $subnet = $ip -replace "\.\d+$", ""
    
      $name = (Get-NetIPAddress -AddressFamily IPv4 `
         | Where-Object -FilterScript { ($_.IPAddress).StartsWith($subnet) } `
         ).InterfaceAlias
    
      if ($name) {
        Write-Host "Set IP address to $ip of interface $name"
        & netsh.exe int ip set address "$name" static $ip 255.255.255.0 "$subnet.1"
      }
    
  • Chạy tập lệnh cài đặt GOAD, ở đây mình cài thêm 2 extension là Exchange và một máy Windows 10:

      python goad.py -m vm -ip 192.168.0
    
      or
    
      python goad.py -m vm -ip 192.168.10 -e exchange -e ws01
    
  • Để xác minh rằng mọi thứ đều ổn, chúng ta có thể chạy lệnh check:

  • Sau khi xác minh rằng chúng ta có đủ dung lượng và mọi thứ đều chính xác, chúng ta có thể tiến hành thực hiện lệnh install:

  • Sửa file Vagrantfile

      config.winrm.transport = "plaintext"
      config.winrm.basic_auth_only = true
    

  • provision_lab

III. Một số lỗi xảy ra trong quá trình cài đặt

1. PROVISIONING: Warning: Authentication failure. Retrying...

  • Đến thư mục GOAD\workspace\0808da-goad-vmware\provider và thực hiện các lệnh sau:

      vagrant ssh PROVISIONING
    
  • Kết nối SSH tới PROVISIONING với password vagrant. Trong máy PROVISIONING thực hiện các lệnh sau:

      ssh-keygen -t ed25519
      cd .ssh
      cp id_ed25519.pub authorized_keys
      python3 -m http.server
    
      wsl -d ubuntu
      wget http://10.10.10.207:8000/id_ed25519
      mv id_ed25519 private_key
      exit
    

  • Copy file id_ed25519 từ máy PROVISIONING vào thư mục GOAD\workspace\0808da-goad-vmware\provider.vagrant\machines\PROVISIONING\vmware_desktop và đổi tên thành private_key

  • Sửa config SSH trong máy PROVISIONING

      sudo nano /etc/ssh/sshd_config
    
      PasswordAuthentication no
      PubkeyAuthentication yes
    
      sudo systemctl restart ssh
    

  • Kết nối thử thì thấy lỗi Load key ".\private_key": bad permissions

      icacls .\private_key /inheritance:r
      icacls .\private_key /grant:r "$($env:USERNAME):R"
      ssh -i .\private_key vagrant@192.168.10.3
    
  • Kết nối lại bằng private key

2. Max retries exceeded with url: /wsman

  • Lỗi này này xảy ra do các máy ảo được tạo ra chưa được config đúng IP, mình phải cấu hình thủ công.

  • Trên máy PROVISIONING

      sudo ip link set eth1 up 
      sudo nano /etc/netplan/01-netcfg.yaml
    
      network:
        version: 2
        ethernets:
          eth0:
            dhcp4: true
          eth1:
            dhcp4: false
            addresses: [192.168.10.3/24]
    

      sudo chmod 600 /etc/netplan/01-netcfg.yaml
      sudo netplan apply
      sudo reboot
    

  • Mở tất cả các máy ảo WIndows khác bằng VMWare với password vagrant rồi config lại IP theo file Vagrant

  • Khi cấu hình IP xong thì chạy lại lệnh install trong GOAD

  • Chúng ta chỉ còn lại phần dự phòng, chúng ta có thể chạy trực tiếp lệnh sau:

      provision_lab
    
      install_extension elk
      install_extension wazuh
      install_extension exchange
      install_extension ws01
    

Lỗi cài Exchange

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v15

Remove-Item -Recurse -Force "C:\Program Files\Microsoft\Exchange Server\V15"
Remove-Item -Recurse -Force "C:\ExchangeSetupLogs"
0
Subscribe to my newsletter

Read articles from team98 directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

team98
team98