Skip to content

test: add SIEM integration tests - #1115

Open
Manuthor wants to merge 17 commits into
feat/audit_startupfrom
feat/audit_integration
Open

test: add SIEM integration tests#1115
Manuthor wants to merge 17 commits into
feat/audit_startupfrom
feat/audit_integration

Conversation

@Manuthor

@Manuthor Manuthor commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Proves issue #937 (syslog/CEF, SIEM integration):

  • mise test:audit — tamper-evident JSONL, hash chain, fields
  • mise test:cef — CEF v27 format (jc), UDP syslog, TCP rsyslog
  • mise test:siem — fluent-bit, filebeat
  • mise test:monitoring — OTel+VictoriaMetrics+Grafana stack health

@Manuthor
Manuthor force-pushed the feat/audit_integration branch from ed88871 to d6467a7 Compare August 11, 2026 04:59
@Manuthor
Manuthor force-pushed the feat/audit_integration branch from 1f8bd3b to 4d6ead1 Compare August 11, 2026 12:49
@Manuthor
Manuthor force-pushed the feat/audit_integration branch from 4d6ead1 to 1308d9a Compare August 11, 2026 13:48
@Manuthor
Manuthor force-pushed the feat/audit_integration branch from 1308d9a to 9551216 Compare August 11, 2026 16:11
@Manuthor
Manuthor force-pushed the feat/audit_integration branch from 9551216 to 3ad51e5 Compare August 11, 2026 19:52

@HatemMn HatemMn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, multiple updates introduced are unrelated to this and should be pushed to a new branch about "Monitoring refactoring"

The last comment, about the docker-file might be a real concern with the codebase that we should have eventually noticed, to be discussed in another future issue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file is stale documentation from the part that was deleted, shall be deleted too ?

Comment thread .mise/tasks/test/audit
#USAGE }
# Proves ADR-003 (tamper-evident JSONL single-writer) + ADR-004 (HTTP audit middleware).
# Requires non-fips: audit middleware and CEF features are only in non-fips builds.
# No Nix shell needed. Uses Cargo to build KMS binary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audit is not gated behind non-fips, why this constraint ?

Comment thread lychee.toml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this file is related to this PR ?

Comment thread documentation/nav.yml Outdated
Comment on lines +135 to +139
- Observability:
- Log output: configuration/logging.md
- Log call-site reference: configuration/log-reference.md
- Metrics & traces (OTLP): configuration/otlp-telemetry.md
- Monitoring stack (Grafana): configuration/monitoring-setup.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding, this is a doc change related to the Observability stack, maybe this should be deferred to its own PR to avoid errors ?

For example, if logg call-site directory is decided to now become part of the root tree, this comment should be updated to reflect it :

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other thing to note especially if moving this : duckduckgo throws a 404 when someone searches this on google:

https://docs.cosmian.com/key_management_system/configuration/log-reference/

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deferred to #1150

Comment on lines +218 to +220
syslog_msg="<134>$(date '+%b %d %H:%M:%S') kms-audit: ${line}"
# RFC 6587 octet-counting: space between count and message, count = len(message)
printf '%zu %s' "${#syslog_msg}" "${syslog_msg}" |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${#msg} is a bash character count, not a byte (or octet) count

in other terms, any non ASCII character in the name field will produce a wrong count, producing an error that might cascade

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth checking if the ADRs do follow on this

Comment thread .mise/scripts/README.md
Comment on lines +33 to +43
## test

### Database backends

| Task | Default variant | Description |
|------|-----------------|-------------|
| `test:sqlite` | fips | SQLite workspace tests |
| `test:psql` | fips | PostgreSQL tests |
| `test:mysql` | fips | MySQL tests |
| `test:percona` | fips | Percona XtraDB tests |
| `test:mariadb` | fips | MariaDB tests |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did all this change ?

| `result_status` | `"Success"` or `"Failure"` | No | Normalized outcome (after pipeline); use for facets and alerts |
| `result_error` | string | Yes | Normalized error message (after pipeline); present only on Failure events |
| `duration_ms` | integer | No | Operation latency |
| `request_id` | string (UUID) | Yes | Correlation ID across batch operations |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table lists request_id as a real field, and cef-export.md's devicePayloadId mapping treats it the same way, but audit-logs.md's Event schema table (which is supposed to be the canonical one) doesn't have it at all, not in the table, not in the example JSON, not in the hash-chain field list. Might be worth checking which one is actually right and fixing the other.

(careful: this comment is the result of some LLM analysis, treat it with caution)

@@ -94,7 +184,9 @@ field extraction, facets, or dashboards:
| `object_uid` | string | Yes | Target object identifier (KMIP `UniqueIdentifier`) |
| `algorithm` | string | Yes | Cryptographic algorithm (e.g. `AES`, `RSA`) |
| `client_ip` | string | Yes | Source IP address |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client_ip here has no caveat attached to it, but on the audit-logs page it's documented as only trustworthy when --audit-trusted-proxy-cidrs is set up correctly, otherwise it's just the peer IP or an XFF value from a proxy nobody configured. This is exactly the table someone would use to wire up SOC dashboards and field mappings, so a short link back to that section would help people not treat this field as always validated.

(careful: this comment is the result of some LLM analysis, treat it with caution)

# The message is a syslog PRI header + CEF line.
while IFS= read -r line; do
msg="<134>$(date '+%b %d %H:%M:%S') kms-audit: ${line}"
printf '%zu %s' "${#msg}" "${msg}" > /dev/tcp/<host>/5514

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet won't actually run outside of bash. printf '%zu %s' ... throws printf: %z: invalid directive on zsh and on dash/sh, tested this live on both. The < <(...) process substitution a few lines below is already bash only too, so it might be worth adding a #!/usr/bin/env bash shebang or at least a note that this needs bash specifically, otherwise someone on macOS (zsh by default) or in a minimal container (dash) copy pastes this and nothing gets sent, with no clue why.

(careful: this comment is the result of some LLM analysis, treat it with caution)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems like a comment only stale artifact, delete ?

@HatemMn
HatemMn changed the base branch from feat/audit_and_siem to feat/audit_startup August 17, 2026 12:03
@Manuthor
Manuthor force-pushed the feat/audit_integration branch from 6570e83 to d60fb61 Compare August 20, 2026 06:29
HatemMn and others added 14 commits August 31, 2026 13:00
fix: fixes

fix: commit

fix: manual edits

fix: another fix
feat: WIP on feat/audit_and_siem

chore: adr

feat: fix the limits

doc: doc is hard

test: integration
feat: fix final flaws

feat: fix tests that didn't pass

fix: ci fix

feat: 2

feat: ci

fear: update reverse proxy docs

fix: iris

fix: another fix

fix: restaure iris
Proves issue #937 (OTel audit push, syslog/CEF, SIEM integration):

- mise test:audit  — ADR-003/004: tamper-evident JSONL, hash chain, fields
- mise test:cef    — ADR-005/007: CEF v27 format (jc), UDP syslog, TCP rsyslog
- mise test:siem   — fluent-bit, filebeat, otlp (64-event OTLP batch guard)
- mise test:monitoring — OTel+VictoriaMetrics+Grafana stack health

Zero error tolerance: all Docker-prerequisite guards exit 1 (no silent skip).
Pre-flight port cleanup prevents stale container conflicts on re-runs.
CI: add audit and monitoring matrix entries to test_all.yml.
Docs: Mermaid sequence diagrams in audit-logs.md, siems.md, monitoring-setup.md.
README: single test table covering all mise test:* commands with ADRs and scripts.
lychee: exclude kms.different.com (test placeholder) and percona.com (bot throttle).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants