Coletar dados do Microsoft Windows AD

Este documento inclui as seguintes informações:

  • Arquitetura de implantação e etapas de instalação, além de qualquer configuração necessária que produza registros com suporte do analisador do Chronicle para eventos do Microsoft Windows Active Directory. Para ter uma visão geral da ingestão de dados do Chronicle, consulte Ingestão de dados no Chronicle.
  • Informações sobre como o analisador mapeia campos no registro original para os campos do Chronicle Unified Data Model.

As informações neste documento se aplicam ao analisador com o rótulo de ingestão do WINDOWS_AD. O rótulo de ingestão identifica qual analisador normaliza os dados de registro brutos para o formato UDM estruturado.

Antes de começar

Este diagrama ilustra os componentes básicos recomendados em uma arquitetura de implantação para coletar e enviar eventos do Microsoft Windows ao Chronicle. Compare essas informações com seu ambiente para ter certeza de que esses componentes estão instalados. Cada implantação de cliente será diferente dessa representação e poderá ser mais complexa. Os seguintes itens são obrigatórios:

  • Todos os sistemas na arquitetura de implantação são configurados com o fuso horário UTC.
  • O script do PowerShell é criado e configurado em cada servidor do AD do Microsoft Windows para coletar dados de USER_CONTEXT e ASSET_CONTEXT.
  • O NXLog é instalado em cada servidor do Microsoft Windows AD para enviar dados ao servidor central do Microsoft Windows ou Linux.
  • O encaminhador do Chronicle está instalado no servidor central Microsoft Windows ou Linux para encaminhar dados de registro ao Chronicle.

    Arquitetura de implantação

Analisar dispositivos e versões compatíveis

O Analisador do Chronicle oferece suporte aos registros das versões do Microsoft Windows Server a seguir. O Microsoft Windows Server é lançado com as seguintes edições: Foundation, Essentials, Standard e Datacenter. O esquema de eventos dos registros gerados por cada edição não é diferente.

  • Microsoft Windows Server 2019
  • Microsoft Windows Server 2016
  • Microsoft Windows Server 2012

O analisador do Chronicle oferece suporte aos registros coletados pela NXLog Community ou Enterprise Edition.

Revise os tipos de registro compatíveis

O analisador do Chronicle analisa e normaliza os dados recuperados do Contexto do usuário e do Contexto do recurso. Ele oferece suporte a registros gerados com texto em inglês, mas não aos registros gerados em idiomas diferentes do inglês.

Configurar servidores do Microsoft Windows AD

Etapas para configurar os servidores do Microsoft Windows AD na arquitetura de implantação:

  1. Configurar todos os sistemas com o fuso horário UTC.
  2. Em cada servidor do Active Directory do Microsoft Windows, crie e configure um script do PowerShell para coletar dados de registro em um arquivo de saída. O NXLog lê o arquivo de saída e envia dados para o servidor Microsoft Windows ou Linux central.
  3. Crie o script do PowerShell. Confira o exemplo a seguir: Altere o valor de $OUTPUT_FILENAME para o local em que o arquivo de saída precisa ser gravado. Esse arquivo será lido pelo NXLog. Os dados precisam ser armazenados no formato JSON. Defina a codificação como utf8. Use o parâmetro -Filter, em vez do parâmetro -LDAPFilter, ao chamar os cmdlets Get-ADUser e Get-ADComputer.

    # Set the location where the log file will be written
    $OUTPUT_FILENAME="<Path_of_the_output_file>"
    
    If (Test-Path -Path $OUTPUT_FILENAME) { Remove-Item -path $OUTPUT_FILENAME -ErrorAction SilentlyContinue}
    
    # USER_CONTEXT: Gets all Active Directory users and their properties.
    Get-ADUser -Filter * -properties samAccountName | % { Get-ADUser $_.SamAccountName -properties * | ConvertTo-JSON -compress | Out-File -encoding utf8 $OUTPUT_FILENAME -Append }
    
    # ASSET_CONTEXT: Gets all Active Directory assets and their properties.
    Get-ADComputer -Filter * -properties samAccountName | % { Get-ADComputer $_.SamAccountName -properties * | ConvertTo-JSON -compress | Out-File -encoding utf8 $OUTPUT_FILENAME -Append }
    
  4. Crie uma tarefa recorrente que execute o script para buscar e gravar dados no arquivo de saída.

    1. Abra o aplicativo Agendador de Tarefas.
    2. Clique em "Criar tarefa" no painel direito.
    3. Digite o nome e a descrição da tarefa.
    4. Marque a caixa de seleção "Executar com privilégios mais altos" para garantir que todos os dados sejam recuperados.

      Criar uma tarefa

    5. Na guia "Gatilhos", defina quando você quer repetir a tarefa.

    6. Na guia "Ação", adicione uma nova ação e forneça o caminho do arquivo em que o script está armazenado.

      Criar uma programação

  5. Instale o agente NXLog em cada servidor do Microsoft Windows Active Directory. Esse aplicativo encaminha os registros para o servidor Microsoft Windows ou Linux central. Siga a documentação do NXLog.

  6. Crie um arquivo de configuração para cada instância do NXLog. Use o módulo im_file do NXLog para ler o arquivo e analisar as linhas em campos. Use o módulo om_tcp (em inglês) para encaminhar dados para o servidor Microsoft Windows ou Linux central.

    Confira um exemplo de configuração do NXLog. Substitua os valores <hostname> e <port> pelas informações sobre o Microsoft Windows ou Linux Server central de destino. Na seção <Input in_adcontext> e na propriedade File, adicione o caminho do arquivo de registro de saída gravado pelo script do PowerShell. Sempre defina DirCheckInterval e PollInterval. Se eles não estiverem definidos, o NXLog vai pesquisar os arquivos a cada 1 segundo.

    define ROOT C:\Program Files\nxlog
    define ADCONTEXT_OUTPUT_DESTINATION_ADDRESS <hostname>
    define ADCONTEXT_OUTPUT_DESTINATION_PORT <port>
    
    Moduledir   %ROOT%\modules
    CacheDir    %ROOT%\data
    Pidfile     %ROOT%\data\nxlog.pid
    SpoolDir    %ROOT%\data
    LogFile     %ROOT%\data\nxlog.log
    
    <Input in_adcontext>
        Module im_file
        File "<Path_of_the_output_file>"
        DirCheckInterval 3600
        PollInterval 3600
    </Input>
    
    <Output out_chronicle_adcontext>
        Module  om_tcp
        Host    %ADCONTEXT_OUTPUT_DESTINATION_ADDRESS%
        Port    %ADCONTEXT_OUTPUT_DESTINATION_PORT%
    </Output>
    
    <Route ad_context_to_chronicle>
        Path in_adcontext => out_chronicle_adcontext
    </Route>
    
  7. Inicie o serviço NXLog em cada sistema.

Configurar o servidor Microsoft Windows ou Linux central

Para mais informações sobre como instalar e configurar o encaminhador no Linux, consulte Como instalar e configurar o encaminhador no Linux ou Como instalar e configurar o encaminhador no Microsoft Windows.

  1. Configure o sistema com o fuso horário UTC.
  2. Instale o encaminhador Chronicle no servidor Microsoft Windows ou Linux central.
  3. Configurar o encaminhador do Chronicle para enviar registros ao Chronicle. Confira um exemplo de configuração de encaminhador.

      - syslog:
          common:
            enabled: true
            data_type: WINDOWS_AD
            batch_n_seconds: 10
            batch_n_bytes: 1048576
          tcp_address: 0.0.0.0:10518
          connection_timeout_sec: 60
    

Referência de mapeamento de campo: campos de registro do dispositivo para campos de UDM

Nesta seção, descrevemos como o analisador mapeia campos de registro originais para campos do modelo de dados unificado.

Registros de contexto do usuário

Campo NXLog Campo UDM
GivenName entity.entity.user.first_name
Surname entity.entity.user.last_name
SamAccountName entity.entity.user.userid
SID.Value entity.entity.user.windows_sid
ObjectClass If the value is user,
entity.metadata.entity_type is set to USER
ObjectGuid If the ObjectGuid log field value is not empty, then the ObjectGuid log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the objectGUID log field value is not empty, then the objectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the ObjectGUID log field value is not empty, then the ObjectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
objectGUID If the ObjectGuid log field value is not empty, then the ObjectGuid log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the objectGUID log field value is not empty, then the objectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the ObjectGUID log field value is not empty, then the ObjectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
ObjectGUID If the ObjectGuid log field value is not empty, then the ObjectGuid log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the objectGUID log field value is not empty, then the objectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
Else, If the ObjectGUID log field value is not empty, then the ObjectGUID log field is mapped to the entity.entity.user.product_object_id UDM field.
AccountExpirationDate entity.entity.user.account_expiration_time
badPwdCount entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
CanonicalName entity.entity.administrative_domain
City entity.entity.user.personal_address.city
Company entity.entity.user.company_name
Country entity.entity.user.personal_address.country_or_region
Department entity.entity.user.department
Description entity.metadata.description
DisplayName entity.entity.user.user_display_name
EmailAddress entity.entity.user.email_addresses
EmployeeID entity.entity.user.employee_id
HomeDirectory entity.entity.file.full_path
HomePage entity.entity.url
HomePhone entity.entity.user.phone_numbers
LastBadPasswordAttempt entity.entity.user.last_bad_password_attempt_time
lastLogoff entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
lastLogon entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
LastLogonDate entity.entity.user.last_login_time
Manager Values for GUID, SAMAccountname, SID all mapped to different UDM fields:
- SID is stored in manager.windows_sid
- Distinguished name (i.e. value in first CN) is stored in manager.user_display_name
- GUID,SamAccountName is stored in manager.userid
MemberOf The following fields in the first occurrence of CN are set:
entity.relations.entity.group.group_display_name
entity.relations.entity_type set to GROUP
entity.relations.relationship set t0 MEMBER
entity.relations.direction set to UNIDIRECTIONAL
MobilePhone entity.entity.user.phone_numbers
Office entity.entity.user.office_address.name
PasswordExpired entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
PasswordLastSet entity.entity.user.last_password_change_time
PasswordNeverExpires entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
PasswordNotRequired entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
PrimaryGroup Following fields are set:
- entity.relations.entity.group.group_display_name
- entity.relations.entity_type set to GROUP
- entity.relations.relationship set to MEMBER
- entity.relations.direction set to UNIDIRECTIONAL
ServicePrincipalNames entity.entity.user.attribute.label.key and entity.entity.user.attribute.label.value
State entity.entity.user.personal_address.state
StreetAddress entity.entity.user.personal_address.name
Title entity.entity.user.title
whenCreated entity.user.attribute.creation_time
AccountLockoutTime entity.entity.user.account_lockout_time

Registros de contexto de recursos

Campo NXLog Campo UDM
DNSHostName entity.entity.asset.hostname
SamAccountName entity.entity.asset.asset_id
SID.Value entity.entity.user.windows_sid
ObjectClass If the value is computer, entity.metadata.entity_type set to ASSET
ObjectGuid If the ObjectGuid log field value is not empty, then the ObjectGuid log field is mapped to the entity.entity.asset.product_object_id UDM field.
Else, If the ObjectGUID log field value is not empty, then the ObjectGUID log field is mapped to the entity.entity.asset.product_object_id UDM field.
ObjectGUID If the ObjectGuid log field value is not empty, then the ObjectGuid log field is mapped to the entity.entity.asset.product_object_id UDM field.
Else, If the ObjectGUID log field value is not empty, then the ObjectGUID log field is mapped to the entity.entity.asset.product_object_id UDM field.
AccountExpirationDate entity.entity.user.account_expiration_time
badPwdCount entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
CanonicalName entity.entity.administrative_domain
countryCode entity.entity.asset.location.country_or_region
Description entity.entity.metadata.description
HomePage entity.entity.url
IPv4Address entity.entity.asset.ip
IPv6Address entity.entity.asset.ip
LastBadPasswordAttempt entity.entity.user.last_bad_password_attempt_time
lastLogoff entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
lastLogon entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
LastLogonDate entity.entity.user.last_login_time
Location entity.entity.asset.location.name
ManagedBy The following fields are set:

entity.entity.user.user_display_name
entity.relations.entity_type set to USER
entity.relations.relationship set to ADMINISTERS
entity.relations.direction set to UNIDIRECTIONAL
ObjectCategory entity.entity.asset.category
OperatingSystem If the name contains Windows, entity.entity.asset.platform_software.platform field is set to WINDOWS.
OperatingSystemServicePack entity.entity.asset.platform_software.platform_patch_level
OperatingSystemVersion The field entity.entity.asset.platform_software.platform_version is set to %{OperatingSystem} - %{OperatingSystemVersion}
PasswordExpired entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
PasswordLastSet entity.entity.user.last_password_change_time
PasswordNeverExpires entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
PasswordNotRequired entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
PrimaryGroup The following fields are set:
- entity.relations.entity.group.group_display_name
- entity.relations.entity_type set to GROUP
- entity.relations.relationship set to MEMBER
- entity.relations.direction set to UNIDIRECTIONAL
ServicePrincipalNames entity.entity.asset.attribute.label.key and entity.entity.asset.attribute.label.value
whenChanged entity.entity.asset.attribute.last_update_time
whenCreated entity.entity.asset.attribute.creation_time
AccountLockoutTime entity.entity.user.account_lockout_time