Commit 28ff3554 authored by Côme Chilliet's avatar Côme Chilliet

feat(audit) Add author IP to audit events

issue #6010
parent 8fbfd3ff
......@@ -35,7 +35,7 @@ class auditEvent extends simplePlugin
'ou' => get_ou('auditRDN'),
'mainAttr' => FALSE,
]],
'plSearchAttrs' => ['fdAuditAction','fdAuditAuthorDN','fdAuditObjectType',
'plSearchAttrs' => ['fdAuditAction','fdAuditAuthorDN','fdAuditAuthorIP','fdAuditObjectType',
'fdAuditObject','fdAuditAttributes','fdAuditResult'],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
......@@ -54,12 +54,13 @@ class auditEvent extends simplePlugin
_('Time'), _('Date and time this event happened'),
'fdAuditDateTime', TRUE
),
new DisplayLDAPAttribute(_('Action'), _('Action type'), 'fdAuditAction', TRUE),
new ObjectLinkAttribute(_('Author'), _('Action author'), 'fdAuditAuthorDN', TRUE, 'user'),
new DisplayLDAPAttribute(_('Object type'), _('Object type'), 'fdAuditObjectType', TRUE),
new DisplayLDAPAttribute(_('Object'), _('Target object'), 'fdAuditObject', TRUE),
new DisplayLDAPArrayAttribute(_('Attributes'), _('Target attributes'), 'fdAuditAttributes', FALSE),
new DisplayLDAPAttribute(_('Result'), _('Result or error'), 'fdAuditResult', FALSE),
new DisplayLDAPAttribute(_('Action'), _('Action type'), 'fdAuditAction', TRUE),
new ObjectLinkAttribute(_('Author'), _('Action author'), 'fdAuditAuthorDN', TRUE, 'user'),
new DisplayLDAPAttribute(_('Author IP'), _('Action author IP address'), 'fdAuditAuthorIP', FALSE),
new DisplayLDAPAttribute(_('Object type'), _('Object type'), 'fdAuditObjectType', TRUE),
new DisplayLDAPAttribute(_('Object'), _('Target object'), 'fdAuditObject', TRUE),
new DisplayLDAPArrayAttribute(_('Attributes'), _('Target attributes'), 'fdAuditAttributes', FALSE),
new DisplayLDAPAttribute(_('Result'), _('Result or error'), 'fdAuditResult', FALSE),
]
],
];
......@@ -68,7 +69,8 @@ class auditEvent extends simplePlugin
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE, $attributesInfo = NULL)
{
parent::__construct($dn, $object, $parent, $mainTab, $attributesInfo);
$this->fdAuditId = random_int(0, PHP_INT_MAX);
$this->fdAuditId = random_int(0, PHP_INT_MAX);
$this->fdAuditAuthorIP = ($_SERVER['REMOTE_ADDR'] ?? '');
}
function compute_dn (): string
......
......@@ -29,6 +29,7 @@ class auditManagement extends management
['ObjectTypeColumn', []],
['LdapGeneralizedTimeColumn', ['attributes' => 'fdAuditDateTime', 'label' => 'Time']],
['LinkColumn', ['attributes' => 'fdAuditAuthorDN', 'label' => 'Author']],
['LinkColumn', ['attributes' => 'fdAuditAuthorIP', 'label' => 'IP']],
['LinkColumn', ['attributes' => 'fdAuditAction', 'label' => 'Action']],
['LinkColumn', ['attributes' => 'fdAuditObjectType', 'label' => 'Type']],
['LinkColumn', ['attributes' => 'fdAuditObject', 'label' => 'Target']],
......
......@@ -57,9 +57,16 @@ attributetype ( 1.3.6.1.4.1.38414.60.1.8 NAME 'fdAuditId'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.60.1.9 NAME 'fdAuditAuthorIP'
DESC 'FusionDirectory - audit event author IP address'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
# Object Class
objectclass (1.3.6.1.4.1.38414.60.2.1 NAME 'fdAuditEvent'
DESC 'FusionDirectory - audit event'
MUST ( fdAuditDateTime $ fdAuditAction $ fdAuditAuthorDN $ fdAuditObject $ fdAuditObjectType )
MAY ( fdAuditAttributes $ fdAuditResult $ fdAuditId ) )
MAY ( fdAuditAttributes $ fdAuditResult $ fdAuditId $ fdAuditAuthorIP ) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment