Using Audit Middleware with Barbican

Using Audit Middleware with Barbican


Audit middleware is a python middleware logic which is added in service request processing pipeline via paste deploy filters. Audit middleware constructs audit event data in CADF format.

Audit middleware supports delivery of CADF audit events via Oslo messaging notifier capability. Based on notification_driver configuration, audit events can be routed to messaging infrastructure (notification_driver = messagingv2) or can be routed to a log file (notification_driver = log).

Audit middleware creates two events per REST API interaction. First event has information extracted from request data and the second one has request outcome (response).

Enabling Audit for API Requests

Audit middleware is available as part of keystonemiddleware (>= 1.6) library. Assuming a barbican deployment is already using keystone for token validation, auditing support requires only configuration changes. It has Oslo messaging library dependency as it uses this for audit event delivery. pyCADF library is used for creating events in CADF format.

  • Enable Middleware : Enabling Middleware Link . Change is primarily in service paste deploy configuration.
  • Configure Middleware : Configuring Middleware Link . Can use provided audit mapping file. If there are no custom mapping for actions or path, then related mapping values are derived from taxonomy defined in pyCADF library.


Audit middleware filter should be included after Keystone middleware’s keystone_authtoken middleware in request pipeline. This is needed so that audit middleware can utilize environment variables set by keystone_authtoken middleware.


  1. Turn off any active instances of Barbican.

  2. Copy api_audit_map.conf to /etc/barbican directory.

  3. Edit /etc/barbican/barbican-api-paste.ini

    Replace the /v1 app pipeline from barbican_api to barbican-api-keystone-audit pipeline

    [pipeline:barbican-api-keystone-audit] pipeline = authtoken context audit apiapp

  4. Edit barbican.conf to update notification_driver value.

  5. Start Barbican {barbican_home}/bin/ start

Sample Audit Event

Following is the sample of audit event for symmetric key create request

   "timestamp":"2015-12-11 00:44:26.412076",

Ceilometer audit wiki can be referred to identify meaning of different fields in audit event to 7 “W”s of Audit and Compliance.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.