<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Audit on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/audit/</link>
    <description>Recent content in Audit on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 12 Oct 2017 15:54:08 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/audit/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Monitor and audit Active Directory user and group management</title>
      <link>https://janikvonrotz.ch/2017/10/12/monitor-and-audit-active-directory-user-and-group-management/</link>
      <pubDate>Thu, 12 Oct 2017 15:54:08 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2017/10/12/monitor-and-audit-active-directory-user-and-group-management/</guid>
      <description>&lt;p&gt;Traceability is key when collaborating in the Active Directory (AD). Multiple admins changing and updating permissions and policies makes it difficult being compliant with the company&amp;rsquo;s policies. It is important to monitor mutations in the directory. By default audit policies are disabled for Domain Controllers (DC) and must be enabled explicitly. Enabling auditing for the DCs is quite easy, querying the logs for a specific event is a bit more difficult.&lt;/p&gt;&#xA;&lt;p&gt;In this guide you&amp;rsquo;ll learn how to enable auditing for a specific case and how to query the audit logs for a specific event.&lt;/p&gt;&#xA;&lt;p&gt;The  tutorial assumes that there is a:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Domain Controller.&lt;/li&gt;&#xA;&lt;li&gt;Group policies, security groups, users, &amp;hellip;&lt;/li&gt;&#xA;&lt;li&gt;Admins with DC access.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;enable-auditing&#34;&gt;Enable Auditing&lt;/h1&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start by have a look on the already enabled audit categories.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Log into the DC.&lt;/li&gt;&#xA;&lt;li&gt;Open PowerShell as admin.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;auditpol /get /category:*&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The command returns a list of audit categories and its status. These settings have been enabled by either the auditpol tool or via GPOs.&lt;/p&gt;&#xA;&lt;p&gt;In our scenario we would like to track management of users and groups, which is part of the &lt;strong&gt;Audit Account Management&lt;/strong&gt;. To enable this audit category create a new group policiy for the DC.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Open the GPO management console.&lt;/li&gt;&#xA;&lt;li&gt;Right-click the &lt;em&gt;Domain Controllers&lt;/em&gt; organizational unit.&lt;/li&gt;&#xA;&lt;li&gt;Create new GPO and open it in the GPO editor.&lt;/li&gt;&#xA;&lt;li&gt;Enable logging for subcategories: &lt;code&gt;Computer Configuration &amp;gt; Policies &amp;gt; Windows Settings &amp;gt; Security Settings &amp;gt; Local Policies &amp;gt; Security Options &amp;gt; Audit: Force audit policy subcategory settings...&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Increase the security log size to 4GB: &lt;code&gt;Computer Configuration &amp;gt; Windows Settings &amp;gt; Security Settings &amp;gt; Event Log &amp;gt; Maximum security log size: 4268032&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then navigate to &lt;code&gt;Computer Configuration &amp;gt; Windows Settings &amp;gt; Security Settings &amp;gt; Advanced Audit Policy Configuration &amp;gt; Account Management&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Enable the required audit categories.&lt;/li&gt;&#xA;&lt;li&gt;Make a &lt;code&gt;gpupdate /force&lt;/code&gt; on the DC.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;auditpol /get /Category:*&lt;/code&gt; and double-check whether the settings are correct.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you open the security event log on the DC there should be events logging account management mutations.&lt;/p&gt;&#xA;&lt;p&gt;Source: &lt;a href=&#34;https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/monitoring-active-directory-for-signs-of-compromise&#34;&gt;Microsoft Docs - Monitoring Active Directory for Signs of Compromise&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;query-audit-logs&#34;&gt;Query Audit Logs&lt;/h1&gt;&#xA;&lt;p&gt;As mentioned querying the event log is a bit more difficult. The event log viewer offers limited features for filtering events and searching by specific keywords. In contrast with PowerShell it is possible to filter and search the event log by any property and keyword.&lt;/p&gt;&#xA;&lt;p&gt;Here is a simple example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$LogName = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;security&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$StartTime = Get-Date(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2017-10-12 12:50&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$EndTime = Get-Date(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;2017-10-12 13:00&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$SearchKey = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;username&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Get-WinEvent -FilterHashtable @{LogName=$LogName; StartTime=$StartTime;EndTime=$EndTime} | Where-Object {$_.Message &lt;span style=&#34;color:#f92672&#34;&gt;-match&lt;/span&gt; $SearchKey} | select Id, TimeCreated, Message | Format-List&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Source: &lt;a href=&#34;https://blogs.technet.microsoft.com/heyscriptingguy/2015/10/20/filtering-event-log-events-with-powershell/&#34;&gt;Hey, Scripting Guy! Blog - Filtering Event Log Events with PowerShell&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
