Collecter les données Microsoft Windows AD

Ce document contient les informations suivantes:

  • Architecture de déploiement et étapes d'installation, et toute configuration requise qui génère des journaux compatibles avec l'analyseur Chronicle pour les événements Microsoft Windows Active Directory. Pour en savoir plus sur l'ingestion de données Chronicle, consultez Ingestion de données dans Chronicle.
  • Informations sur la manière dont l'analyseur mappe les champs du journal d'origine avec les champs du modèle de données unifié Chronicle.

Les informations de ce document s'appliquent à l'analyseur doté du libellé d'ingestion WINDOWS_AD. L'étiquette d'ingestion identifie l'analyseur qui normalise les données de journaux brutes au format UDM structuré.

Avant de commencer

Ce schéma illustre les composants de base recommandés dans une architecture de déploiement pour collecter et envoyer des événements Microsoft Windows à Chronicle. Comparez ces informations à celles de votre environnement pour vous assurer que ces composants sont installés. Chaque déploiement client diffère de cette représentation et peut être plus complexe. Les éléments suivants sont obligatoires:

  • Tous les systèmes de l'architecture de déploiement sont configurés dans le fuseau horaire UTC.
  • Le script PowerShell est créé et configuré sur chaque serveur Microsoft Windows AD pour collecter les données USER_CONTEXT et ASSET_CONTEXT.
  • NXLog est installé sur chaque serveur Microsoft Windows AD pour envoyer des données au serveur central Microsoft Windows ou Linux.
  • Le redirecteur Chronicle est installé sur le serveur central Microsoft Windows ou Linux pour transférer les données des journaux vers Chronicle.

    Architecture de déploiement

Examiner les appareils et les versions compatibles

L'analyseur Chronicle est compatible avec les journaux des versions suivantes du serveur Microsoft Windows. Microsoft Windows Server est publié avec les éditions suivantes: Foundation, Essentials, Standard et Datacenter. Le schéma d'événement des journaux générés par chaque édition ne diffère pas.

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

L'analyseur Chronicle est compatible avec les journaux collectés par la communauté NXLog ou Enterprise Edition.

Examiner les types de journaux compatibles

L'analyseur Chronicle analyse et normalise les données extraites du contexte utilisateur et du contexte de l'élément. Elle est compatible avec les journaux générés en anglais et n'est pas compatible avec les journaux générés dans des langues autres que l'anglais.

Configurer les serveurs Microsoft Windows AD

Procédure de configuration des serveurs Microsoft Windows AD dans l'architecture de déploiement:

  1. Configurez tous les systèmes avec le fuseau horaire UTC.
  2. Sur chaque serveur Microsoft Windows Active Directory, créez et configurez un script PowerShell pour collecter les données des journaux dans un fichier de sortie. NXLog lit le fichier de sortie et envoie les données au serveur central Microsoft Windows ou Linux.
  3. Créez le script Powershell. Consultez l'exemple ci-dessous. Remplacez la valeur de $OUTPUT_FILENAME par l'emplacement où le fichier de sortie doit être écrit. Ce fichier sera lu par NXLog. Les données doivent être stockées au format JSON. Définissez l'encodage sur utf8. Utilisez le paramètre -Filter plutôt que -LDAPFilter lorsque vous appelez les cmdlets Get-ADUser et 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. Créez une tâche récurrente qui exécute le script pour récupérer et écrire des données dans le fichier de sortie.

    1. Ouvrez l'application Planificateur de tâches.
    2. Cliquez sur "Créer une tâche" dans le panneau de droite.
    3. Saisissez le nom et la description de la tâche.
    4. Cochez la case "Exécuter avec les droits les plus élevés" pour vous assurer que toutes les données sont récupérées.

      créer une tâche ;

    5. Dans l'onglet "Déclencheurs", indiquez à quel moment vous souhaitez répéter la tâche.

    6. Dans l'onglet "Action", ajoutez une action et indiquez le chemin d'accès au fichier dans lequel le script est stocké.

      Créer une programmation

  5. Installez l'agent NXLog sur chaque serveur Microsoft Windows Active Directory. Cette application transfère les journaux au serveur central Microsoft Windows ou Linux. Suivez la documentation NXLog.

  6. Créez un fichier de configuration pour chaque instance NXLog. Utilisez le module im_file de NXLog pour lire le fichier et analyser les lignes en champs. Utilisez le module om_tcp pour transférer des données vers le serveur central Microsoft Windows ou Linux.

    Voici un exemple de configuration NXLog. Remplacez les valeurs <hostname> et <port> par des informations sur le serveur Microsoft Windows ou Linux central de destination. Dans la section <Input in_adcontext> et la propriété File, ajoutez le chemin du fichier journal de sortie écrit par le script Powershell. Définissez toujours DirCheckInterval et PollInterval. Si elles ne sont pas définies, NXLog interroge les fichiers toutes les 1 seconde.

    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. Démarrez le service NXLog dans chaque système.

Configurer le serveur central Microsoft Windows ou Linux

Consultez la section Installer et configurer le redirecteur sous Linux ou Installer et configurer le redirecteur sous Microsoft Windows pour en savoir plus sur l'installation et la configuration du redirecteur.

  1. Configurez le système avec le fuseau horaire UTC.
  2. Installez le redirecteur Chronicle sur le serveur central Microsoft Windows ou Linux.
  3. Configurez le redirecteur Chronicle pour envoyer des journaux à Chronicle. Voici un exemple de configuration du système de transfert.

      - 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
    

Documentation de référence sur le mappage de champs: champs de journal de l'appareil avec champs UDM

Cette section explique comment l'analyseur mappe les champs de journal d'origine aux champs du modèle de données unifié.

Journaux de contexte utilisateur

Champ NXLog Champ UM
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

Journaux de contexte d'élément

Champ NXLog Champ 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