Hardcode caldera config settings

This commit is contained in:
Chris Long
2019-03-27 11:20:27 +07:00
parent ffc487f56e
commit 7c25cd1e00
7 changed files with 105 additions and 5 deletions

View File

@@ -17,11 +17,10 @@ If (-not (Test-Path 'C:\Program Files\cagent\cagent.exe')) {
# GitHub requires TLS 1.2 as of 2/1/2018
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile('https://github.com/mitre/caldera-agent/releases/download/v0.1.0/cagent.exe', $cagentPath)
# Ignore SSL warning for conf file download
# https://stackoverflow.com/questions/34331206/ignore-ssl-warning-with-powershell-downloadstring
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ;(New-Object System.Net.WebClient).DownloadFile('https://logger:8888/conf.yml', $cagentConfPath)
# Copy hardocded Caldera config from the Vagrant resources folder
Copy-Item "C:\vagrant\resources\caldera\conf.yml" $cagentConfPath -Force
If (-not (Test-Path "$cagentConfPath" )) {
Write-Host "Caldera Agent configuration failed. Unable to retrieve config from logger"
Write-Host "Caldera Agent configuration failed. Unable to retrieve config from resources folder."
}
Start-Process -FilePath $cagentPath -ArgumentList '--startup', 'auto', 'install' -Wait
Start-Process -FilePath $cagentPath -ArgumentList 'start' -Wait