Enable Audit after an upgrade
Step-by-step guide to adding the Audit configuration to a Control installation upgraded from 1.3.0 or earlier.
A new Control installation comes with Audit already configured. An upgrade replaces the Control software but keeps your existing configuration, so the configuration files that enable Audit are not added. This page describes what to add so that Audit works after you upgrade from Control 1.3.0 or earlier.
What a new installation includes
Section titled “What a new installation includes”Control 1.4.0 and later adds three module files to config/modules/. An upgraded installation does not have them:
| File | Module | Purpose |
|---|---|---|
jdbc.json |
JdbcClient |
The database where audit events are stored. The default is an embedded HSQLDB database. |
audit.json |
Audit |
Collects audit events from Flows, Schedules and API calls, and serves the audit UI and REST API at /control/audit. |
shell.json |
Control |
Hosts the Control web application, with the tabs Launchpad and Audit. |
Only users with the auditor role can see and use Audit.
Prerequisites
Section titled “Prerequisites”- Control has been upgraded to 1.4.0 or later.
- You can edit the configuration directory of the installation,
<installation path>/config. The installation path depends on the operating system and how Control was installed. For containers, this is the directory you mount to/opt/fortified/servers/control-server/config. See Container. - Your
config/config.jsonincludes all files inconfig/modules/, for example"modules": "@include:modules/*.json". If your installation lists its modules in another way, add the new modules there instead. - For LDAP enrichment (step 3): an
LdapClientmodule is already configured for the directory that your pipes write to.
Configuration
Section titled “Configuration”-
Add a database for the audit trail.
Create
config/modules/jdbc.json. The example below matches a new installation and stores the audit trail in an embedded HSQLDB database indata/auditdb, relative to the installation directory:{"name": "JdbcClient","config": {"jdbc": {"url": "jdbc:hsqldb:file:data/auditdb","username": "SA","password": ""},"migrations": {"locations": ["classpath:db/migration/audit"],"schemas": ["AUDIT"]}}}migrationscreates and updates the audit tables in theAUDITschema when Control starts. Keeplocationsexactly as shown.If the installation already has a
JdbcClientmodule, for example for your own pipes, do not add a second default instance. Addmigrationsto the existing module instead, or give the new module its ownnameand refer to it fromjdbc.destinationinaudit.json(step 2). -
Add the Audit module.
Create
config/modules/audit.json:{"name": "Audit","config": {"http_listener": "default","http_context": "/control","context_path": "/audit","jdbc": {"schema": "AUDIT"},"requires_any_role": ["auditor"]}}Property Why it is needed http_listenerUse the same HTTP listener as the Forms module. If your Forms module uses http_portinstead, set the samehttp_porthere.http_contextMust be /control, the same as Forms. The audit UI then shares the Control login session, and users do not have to log in again.context_pathServes the audit UI at /control/auditand the REST API at/control/audit/api.jdbc.schemaMust match the schema in migrations.schemasinjdbc.json.requires_any_roleOnly users with the auditorrole get access to the UI and the REST API. Without this property, anyone who can reach the URL can read the audit trail.All properties are described in Audit.
-
Optional: show names instead of LDAP DNs.
Without enrichment, the audit trail shows LDAP changes with DNs and attribute names. To show names, and to attribute group membership changes to the person who was added or removed rather than to the group, add
enrichmenttoaudit.json:{"name": "Audit","config": {"http_listener": "default","http_context": "/control","context_path": "/audit","jdbc": {"schema": "AUDIT"},"enrichment": {"ldap": {"object_types": {"user": {"display_name_attributes": ["displayName", "cn"]},"group": {"display_name_attributes": ["displayName", "cn"],"reference_attributes": {"member": {"value_object_type": "user","identity_bearing": true}}}}}},"requires_any_role": ["auditor"]}}The names under
object_typesmust beuserandgroup, which are the object types that the LDAP valves report. Changedisplay_name_attributesto match your directory. The first attribute that has a value is used. Enrichment reads from the sameLdapClientdestination that made the change. -
Add the Control application with the Audit tab.
Create
config/modules/shell.json:{"name": "Control","config": {"http_listener": "default","http_context": "/control","tabs": [{"id": "launchpad","label": "Launchpad","order": 0,"default": true,"public": true},{"id": "audit","label": "Audit","order": 1,"requires_any_role": ["auditor"]}]}}Use the same
http_listener(orhttp_port) andhttp_contextas inaudit.json. Keep the tab'srequires_any_rolethe same as the Audit module'srequires_any_role, so that the tab is shown only to users who can open it. -
Give the
auditorrole to the users who need it.Control reads roles from the login and stores them in the session, the same way as for role-based access to Flows. Make sure your identity provider or authenticator sends the role
auditorto users who should have access to Audit, for example HR, support or auditors.If you want to use a role you already have instead, such as
admin, changerequires_any_rolein bothaudit.jsonandshell.json. To give access without any role, see Turn off the role requirement. -
Restart Control.
The audit tables are created at startup. Events are recorded from that point. Changes made before the upgrade are not in the audit trail.
Turn off the role requirement
Section titled “Turn off the role requirement”By default, only users with the auditor role can use Audit. If every logged-in user should have access, for example in a test environment, remove the role requirement.
-
Remove the role requirement from the Audit module.
In
config/modules/audit.json, delete therequires_any_roleline (andrequires_all_roles, if present):{"name": "Audit","config": {"http_listener": "default","http_context": "/control","context_path": "/audit","jdbc": {"schema": "AUDIT"}}} -
Remove the role requirement from the Audit tab.
In
config/modules/shell.json, deleterequires_any_rolefrom theaudittab:{"id": "audit","label": "Audit","order": 1}Every logged-in user now sees the Audit tab. Users who are not logged in do not see it, unless you also add
"public": trueto the tab. Do not addpublicunless Audit should be available without login. -
Restart Control.
To turn the role requirement back on, add requires_any_role again in both files, with the same roles in each.
Test the configuration
Section titled “Test the configuration”- Check
server.logfor errors from theJdbcClientandAuditmodules at startup, for example a failed database connection or migration. - Run a Flow, a Schedule or an API call that makes a change, for example an LDAP update.
- Log in to Control with a user who has the
auditorrole. The tabs Launchpad and Audit are shown. - Open the Audit tab, or go to
https://<host>/control/audit. The change from step 2 is listed. - Log in with a user who does not have the
auditorrole. The Audit tab is not shown, and/control/auditreturns403 Forbidden.
Troubleshooting
Section titled “Troubleshooting”- The Audit tab is not shown. Check that the user has the role in
requires_any_roleinshell.json, and thatshell.jsonis included byconfig.json. /control/auditreturns403. The user is logged in but does not have a role in the Audit module'srequires_any_role.- The Audit module does not start, and
server.logsays thatrequires_any_role"did not resolve to any role names". The property is set to an empty list or an invalid value. Remove it, or list at least one role. - The Audit tab is not shown to anyone, although the role requirement is turned off.
requires_any_rolefor the tab inshell.jsonis set to an empty list instead of being removed. - The user must log in again to open Audit, or the tab is empty.
http_contextor the HTTP listener/port inaudit.jsonorshell.jsondoes not match the Forms module. - Changes are shown as DNs instead of names. Check
enrichmentin step 3. The object types must beuserandgroup. If the entry has been deleted or the directory is unreachable, the change is still recorded, but without names. - The audit trail is empty after a container restart. The
datadirectory is not on a persistent volume. See the warning in step 1.