|
| 1 | +telemetry_audit_logging |
| 2 | +======================= |
| 3 | + |
| 4 | +Verify that OpenStack API audit events are emitted in CADF format and forwarded |
| 5 | +to the dedicated audit Loki stack. The scenarios follow the manual verification |
| 6 | +steps in |
| 7 | +[Manually enable audit logs](https://redhat.atlassian.net/wiki/spaces/CLOUDOPS/pages/389779771/Manually+enable+audit+logs). |
| 8 | + |
| 9 | +For each OpenStack service the role: |
| 10 | + |
| 11 | +1. Generates API activity with an ``openstack`` command |
| 12 | +2. Checks the service API pod logs for CADF audit notifications using ``oc logs`` |
| 13 | + |
| 14 | +After all service checks, the role verifies Loki log separation using ``oc`` and |
| 15 | +``curl`` with an OpenShift bearer token, as documented in the forwarding section: |
| 16 | + |
| 17 | +* Default Loki (``logging-loki``) must **not** contain CADF audit events |
| 18 | +* Audit Loki (``logging-loki-audit``) **must** contain CADF audit events |
| 19 | + |
| 20 | +Requirements |
| 21 | +------------ |
| 22 | + |
| 23 | +* OpenStack deployed with audit logging enabled |
| 24 | +* Audit Loki stack and ClusterLogForwarder configured in ``openshift-logging`` |
| 25 | +* ``oc``, ``curl``, and ``openstack`` CLI access via ``openstackclient`` |
| 26 | + |
| 27 | +Service verification steps |
| 28 | +-------------------------- |
| 29 | + |
| 30 | ++----------+---------------------------+-----------------------------------------------+ |
| 31 | +| Service | API activity | Pod log check | |
| 32 | ++==========+===========================+===============================================+ |
| 33 | +| Barbican | ``openstack secret list`` | ``grep barbican-api`` | |
| 34 | +| Cinder | ``openstack volume list`` | ``grep cinder-api`` | |
| 35 | +| Glance | ``openstack image list`` | ``grep glance-default`` | |
| 36 | +| Keystone | ``openstack project list``| ``oc get pod -l service=keystone ...`` | |
| 37 | +| Neutron | ``openstack network list``| ``grep neutron`` | |
| 38 | +| Nova | ``openstack server list`` | ``grep nova-api`` | |
| 39 | ++----------+---------------------------+-----------------------------------------------+ |
| 40 | + |
| 41 | +Role Variables |
| 42 | +-------------- |
| 43 | + |
| 44 | +| Variable | Default | Description | |
| 45 | +|----------|---------|-------------| |
| 46 | +| ``openstack_cmd`` | ``oc rsh openstackclient openstack`` | OpenStack CLI command | |
| 47 | +| ``audit_logging_namespace`` | ``openshift-logging`` | Namespace for Loki routes | |
| 48 | +| ``audit_logging_default_loki_route`` | ``logging-loki`` | Main Loki route name | |
| 49 | +| ``audit_logging_loki_route`` | ``logging-loki-audit`` | Audit Loki route name | |
| 50 | +| ``audit_logging_loki_tenant`` | ``application`` | Loki tenant in query URL | |
| 51 | +| ``audit_logging_loki_logql_query`` | ``{log_type="application"} \|= "..."`` | LogQL query for Loki checks | |
| 52 | +| ``audit_logging_services`` | see ``defaults/main.yml`` | List of service scenarios | |
| 53 | + |
| 54 | +Each service entry supports: |
| 55 | + |
| 56 | +* ``name`` - service identifier |
| 57 | +* ``trigger_args`` - arguments passed to ``openstack_cmd`` |
| 58 | +* ``pod_pattern`` - substring used to locate the API pod |
| 59 | +* ``pod_label_selector`` - optional ``oc get pod -l`` selector (used for Keystone) |
| 60 | + |
| 61 | +Example Playbook |
| 62 | +---------------- |
| 63 | + |
| 64 | +.. code-block:: yaml |
| 65 | + |
| 66 | + - hosts: localhost |
| 67 | + gather_facts: true |
| 68 | + environment: |
| 69 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 70 | + PATH: "{{ cifmw_path }}" |
| 71 | + vars_files: |
| 72 | + - vars/osp18_env.yml |
| 73 | + tasks: |
| 74 | + - name: "Run audit logging service tests" |
| 75 | + ansible.builtin.import_role: |
| 76 | + name: telemetry_audit_logging |
| 77 | + |
| 78 | +License |
| 79 | +------- |
| 80 | + |
| 81 | +Apache 2 |
0 commit comments