# Расширенное логирование Windows Server 2012 с помощью Winlogbeat и перенаправление событий на ELK - *1. Скачиваем и распаковываем Winlogbeat, папку перемещаем на C:/Winlogbeat* - *2. Редактируем файл winlogbeat.yml и указываем адрес до ELK, куда хотим отправлять наши события. В нашем случае это 192.168.2.250:5044 (порт logstash).* Строка должна принять следующий вид: ``` output.logstash: hosts: ["192.168.2.250:5044"] ``` Кроме этого, в winlogbeat.yml следует указать те event_id, которые нужно отправить на ELK, чтобы не не засорять его всеми возможными событиями Windows. Формат строки: ``` winlogbeat.event_logs: - name Application (присваиваем имя события) - ignore_older: 72h (указываем период) - event_id: 1000, 1002 (номера event_id) ``` Готовый пример нашего файла winlogbeat.yml с актуальными событиями: ``` winlogbeat.event_logs: - name: Application ignore_older: 72h event_id: 1000, 1002 - name: Security - name: ForwardedEvents - name: System event_id: 7045, 7040, 1056, 12, 13, 7036, 7009 - name: Microsoft-Windows-Bits-Client/Operational event_id: 3, 4, 59, 60 - name: Microsoft-Windows-TerminalServicesRDPClient/Operational event_id: 1102 - name: Microsoft-Windows-RemoteDesktopServicesRdpCoreTS/Operational event_id: 131, 98 - name: Microsoft-Windows-Windows Firewall With Advanced Security/Firewall event_id: 2003, 2004, 2005, 2006, 2032, 2033 - name: Microsoft-Windows-Sysmon/Operational - name: Autoruns - name: Microsoft-Windows-WMI-Activity/Operational event_id: 5858 output.logstash: hosts: ["192.168.2.250:5044"] ``` - *3. Устанавливаем сервис Winlogbeat. Файл install-service-winlogbeat, Run with PowerShell, подтверждаем установку.* - *4. Проверяем и запускаем Winlogbeat.* Команда run -> services.msc -> служба winlogbeat -> правой кнопкой мыши -> Start. - *5. Устанавливаем необходимый часовый пояс и синхронизируем время на DC с помощью скрипта.* ``` net stop w32time w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org w32tm /config /reliable:yes net start w32time ``` 6. Открываем **Server Manager** -> **Tools** -> **Group Policy Management** -> Выбираем свой домен -> **Create a GPO in this domain and Ling it here...** -> Создаем новую групповую политику 7. Перед настройкой **GPO** во вкладке **Details**, строка **GPO Status** выставляем **All settings Disabled** 8. Правой кнопкой мыши по нашему **GPO** -> **Edit. Computer Configuration** -> **Policies** -> **Windows Settings** -> **Security Settings** -> **Advanced Audit Policy Configuration** -> **Audit Policies** 9. **Account Logon** -> **Audit Credential Validations** -> **Edit** -> **Configure the Following audit events: Failure** 10. **Account Management** -> **Audit Security Group Management** -> **Configure the following audit events: Success** + **Failure. Audit user account management properties** -> **Configure the following audit events: Success + Failure.** 11. **Detailed Tracking** -> **Audit process creation** -> **Configure the following audit events: Success + Failure.** **Audit Process termination** -> **Configure the following audit events: Success + Failure** 12. **DC Access** -> **Active Directory Service Access Properties** -> **Configure the following audit events: Success** **+ Failure.** **Active Directory Service Changes** -> **Configure the following audit events: Success + Failure** 13. **Logon/Logoff** -> **Audit Logoff** -> **Configure the following audit events: Success** + **Failure. Audit Logon** - **Configure the following audit events: Success + Failure.** **Audit account lockout** -> **Configure the following audit events: Success + Failure.** 14. **Object Access** -> **Audit registry** -> **Configure the following audit events: Success + Failure.** **Audit SAM** -> **Configure the following audit events: Success + Failure.** 15. **Privelege Use** -> **Audit Non Sensetive Privelege use** -> **Configure the following audit events: Success. Audit other privelege use** -> **Configure the following audit events: Success.** *В идеале, все настройки Audit Policies должны быть включены, но это будет тратить огромное количество ресурсов, поэтому здесь были отображены только те, которые понадобится под наши цели.* 16. **GPO** во вкладке **Details**, строка **GPO Status** выставляем **Enabled** 17. **cmd** -> **gpupdate /force** 18. Смотрим наши групповые политики. **cmd** -> **gpresult /R** 19. Теперь с помощью Event Manager мы можем просматривать события по нашим политикам.