Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
winlogbeat [2025/03/28 13:29] jango |
winlogbeat [2025/04/16 11:34] (aktuell) jango |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
Winlogbeat ist ein Tool um [[Windows]] Eventlogs aufzubereiten und in einen [[Elasticsearch]]bzw. [[Opensearch]] | Winlogbeat ist ein Tool um [[Windows]] Eventlogs aufzubereiten und in einen [[Elasticsearch]]bzw. [[Opensearch]] | ||
- | * DC01 | + | < |
- | * AUDIT | + | # jq |
- | * GBI016 | + | |
- | * EX01 | + | |
- | + | ||
- | < | + | |
curl -X GET " | curl -X GET " | ||
+ | # jq | ||
+ | curl -X GET " | ||
- | curl -X GET " | + | # Liste alle Agents |
+ | curl -X GET " | ||
</ | </ | ||
<box red> | <box red> | ||
+ | |||
+ | =====Installation===== | ||
Im Installationsordner von Winlogbeat findet sich ein ps1 Script. | Im Installationsordner von Winlogbeat findet sich ein ps1 Script. | ||
Zeile 104: | Zeile 105: | ||
when.not.contains.tags: | when.not.contains.tags: | ||
- add_cloud_metadata: | - add_cloud_metadata: | ||
+ | </ | ||
+ | |||
+ | =====Windows Deployment===== | ||
+ | |||
+ | Not good | ||
+ | <code powershell> | ||
+ | #$servers = Get-ADComputer -Filter * | Where-Object { $_.Name -like " | ||
+ | |||
+ | $servers = @( | ||
+ | " | ||
+ | " | ||
+ | ) | ||
+ | |||
+ | foreach ($server in $servers) { | ||
+ | |||
+ | # If the service is running, stop it so we can overwrite files | ||
+ | $status = (Get-Service Winlogbeat -ComputerName $server).Status | ||
+ | if($status -like " | ||
+ | Write-Host " | ||
+ | $r = (Get-Service Winlogbeat -ComputerName $server).Stop() | ||
+ | } else { | ||
+ | Write-Host " | ||
+ | } | ||
+ | |||
+ | | ||
+ | |||
+ | Invoke-Command -ComputerName $server -ErrorAction Continue -ScriptBlock { | ||
+ | | ||
+ | # Copy new files | ||
+ | $source = " | ||
+ | $destination = " | ||
+ | $xcopyArgs = " | ||
+ | Start-Process -FilePath " | ||
+ | | ||
+ | $scriptPath = " | ||
+ | | ||
+ | if (Test-Path $scriptPath) { | ||
+ | | ||
+ | # Execute install script | ||
+ | powershell.exe -ExecutionPolicy Bypass -File $scriptPath | ||
+ | # Start service | ||
+ | Start-Service winlogbeat | ||
+ | # Set startup type to automatic | ||
+ | Set-Service winlogbeat -StartUpType Auto | ||
+ | # Check status | ||
+ | |||
+ | } else { | ||
+ | |||
+ | Write-Host " | ||
+ | |||
+ | } | ||
+ | |||
+ | $status = (Get-Service winlogbeat).Status | ||
+ | Write-Output " | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | Good | ||
+ | <code powershell> | ||
+ | # | ||
+ | # Last run stopped at vie-srv-admin01 (not finished) | ||
+ | # | ||
+ | |||
+ | <# | ||
+ | $servers = Get-ADComputer -Filter * -Properties * | Where-Object { | ||
+ | $_.Name -like " | ||
+ | -and $_.OperatingSystem -like " | ||
+ | -and $_.DistinguishedName -notlike " | ||
+ | } | Select-Object -ExpandProperty Name | ||
+ | #> | ||
+ | |||
+ | $servers = @( | ||
+ | " | ||
+ | ) | ||
+ | |||
+ | $logfile = " | ||
+ | $online = " | ||
+ | $offline = " | ||
+ | |||
+ | #$servers = @(" | ||
+ | |||
+ | foreach ($server in $servers) { | ||
+ | |||
+ | # If the service is running, stop it so we can overwrite files | ||
+ | | ||
+ | $status = (Get-Service -Name Winlogbeat -ComputerName $server).Status | ||
+ | if($status -like " | ||
+ | Write-Output " | ||
+ | $r = (Get-Service Winlogbeat -ComputerName $server).Stop() | ||
+ | Write-Output " | ||
+ | } else { | ||
+ | Write-Output " | ||
+ | } | ||
+ | | ||
+ | |||
+ | $session = New-PSSession -ComputerName $server | ||
+ | Copy-Item -Path " | ||
+ | |||
+ | try { | ||
+ | |||
+ | Invoke-Command -ComputerName $server -ErrorAction Stop -ScriptBlock { | ||
+ | | ||
+ | Param($srv) | ||
+ | |||
+ | #whoami | ||
+ | |||
+ | # Copy new files | ||
+ | <# | ||
+ | Write-Output " | ||
+ | $source = " | ||
+ | $destination = " | ||
+ | $xcopyArgs = " | ||
+ | | ||
+ | $output = cmd /c "xcopy `" | ||
+ | # | ||
+ | | ||
+ | Write-Output " | ||
+ | #> | ||
+ | |||
+ | $scriptPath = " | ||
+ | |||
+ | if (Test-Path $scriptPath) { | ||
+ | |||
+ | # Execute install script | ||
+ | powershell.exe -ExecutionPolicy Bypass -File $scriptPath | ||
+ | # Start service | ||
+ | Start-Service winlogbeat | ||
+ | # Set startup type to automatic | ||
+ | Set-Service winlogbeat -StartUpType Auto | ||
+ | # Check status | ||
+ | Write-Output " | ||
+ | |||
+ | } else { | ||
+ | |||
+ | Write-Output " | ||
+ | |||
+ | } | ||
+ | | ||
+ | |||
+ | $status = (Get-Service winlogbeat).Status | ||
+ | Write-Output " | ||
+ | |||
+ | # | ||
+ | |||
+ | } -ArgumentList $server | ||
+ | |||
+ | #$stat >> $online | ||
+ | |||
+ | | ||
+ | } catch { | ||
+ | | ||
+ | $connection = Test-Connection -ComputerName $server -Count 1 -Quiet | ||
+ | |||
+ | # Wenn der Server nicht erreichbar ist, schreibe es ins Log | ||
+ | if (-not $connection) { | ||
+ | Write-Output " | ||
+ | } else { | ||
+ | Write-Output " | ||
+ | } | ||
+ | |||
+ | } | ||
+ | | ||
+ | } | ||
</ | </ |