test: add SIEM integration tests - #1115
Conversation
ed88871 to
d6467a7
Compare
1f8bd3b to
4d6ead1
Compare
4d6ead1 to
1308d9a
Compare
1308d9a to
9551216
Compare
9551216 to
3ad51e5
Compare
HatemMn
left a comment
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I think this file is stale documentation from the part that was deleted, shall be deleted too ?
| #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. |
There was a problem hiding this comment.
Audit is not gated behind non-fips, why this constraint ?
There was a problem hiding this comment.
Why this file is related to this PR ?
| - 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 |
There was a problem hiding this comment.
There was a problem hiding this comment.
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/
| 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}" | |
There was a problem hiding this comment.
${#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
There was a problem hiding this comment.
Also worth checking if the ADRs do follow on this
| ## 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 | |
| | `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 | |
There was a problem hiding this comment.
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 | | |||
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
This file seems like a comment only stale artifact, delete ?
6570e83 to
d60fb61
Compare
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).
d60fb61 to
cf5411d
Compare
…udit (see feat/other_changes_than_audit)

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