gp_csv: Add CSV generalization metadata
authorGarming Sam <garming@catalyst.net.nz>
Tue, 29 May 2018 21:43:53 +0000 (09:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 16 Aug 2018 21:42:21 +0000 (23:42 +0200)
There are user identifiers and ACLs which may be stored in the audit CSV.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/gp_parse/gp_csv.py

index 4c7e7cfa5d5177599c604dd12039880eb456fbcd..b19f84c56f7d076d50e254844df20ec5879c7a87 100644 (file)
@@ -56,10 +56,18 @@ class GPAuditCsvParser(GPParser):
 
             for line in self.lines:
                 child = SubElement(root, 'Row')
-                for e in [line[x] for x in self.header]:
+                for e, title in [(line[x], x) for x in self.header]:
                     value = SubElement(child, 'Value')
                     value.text = e
 
+                    # Metadata for generalization
+                    if title == 'Policy Target' and e != '':
+                        value.attrib['user_id'] = 'TRUE'
+                    if (title == 'Setting Value' and e != '' and
+                        (line['Subcategory'] == 'RegistryGlobalSacl' or
+                         line['Subcategory'] == 'FileGlobalSacl')):
+                        value.attrib['acl'] = 'TRUE'
+
             self.write_pretty_xml(root, f)