|
2 | 2 |
|
3 | 3 | `linux-auth-observe` is a small deterministic mini-lab for normalizing Linux auth evidence into JSONL, filtering it, and generating a short Markdown report. |
4 | 4 |
|
5 | | -## Scope |
6 | | - |
7 | | -- Supported inputs in v0.1: |
8 | | - - `journalctl --output=json` line-delimited exports |
9 | | - - Ubuntu or Debian `auth.log` |
10 | | - - RHEL or CentOS `secure` |
11 | | -- Supported outputs: |
12 | | - - normalized JSONL |
13 | | - - filtered JSONL to stdout |
14 | | - - Markdown summary report |
15 | | -- Not included in v0.1: |
16 | | - - `audit.log` |
17 | | - - real-time tailing |
18 | | - - databases |
19 | | - - packaging or publishing workflows |
20 | | - |
21 | | -## Quickstart |
| 5 | +## Supported Inputs |
| 6 | + |
| 7 | +- `journalctl --output=json` line-delimited exports |
| 8 | +- Ubuntu or Debian `auth.log` |
| 9 | +- RHEL or CentOS `secure` |
| 10 | + |
| 11 | +## Non-Goals |
| 12 | + |
| 13 | +- `audit.log` |
| 14 | +- real-time tailing or monitoring |
| 15 | +- databases or storage layers |
| 16 | +- packaging or publishing workflows |
| 17 | + |
| 18 | +## Validation Status |
| 19 | + |
| 20 | +- `pytest -q` currently passes for parser behavior, filtering, summary generation, CLI workflow, golden regression checks, and syslog year-rollover coverage |
| 21 | +- `normalize` is covered against the three supported fixture families |
| 22 | +- `filter` is covered for `user`, `IP`, and `service` constraints |
| 23 | +- `summary` is covered for readable Markdown output |
| 24 | +- `error-output` is covered as an optional JSONL artifact for parse failures during batch normalization |
| 25 | + |
| 26 | +## Assumptions |
| 27 | + |
| 28 | +- Syslog inputs are line-oriented and follow a standard auth/syslog prefix with no embedded year |
| 29 | +- Syslog timestamps are interpreted in a chosen timezone, defaulting to `local` |
| 30 | +- If `--year` is provided, it anchors the first syslog record and later `Dec -> Jan` transitions roll forward into the next year |
| 31 | +- If `--year` is omitted, the parser infers the starting year from the first syslog record relative to the current time in the chosen timezone; if the first record would land more than about half a year in the future, it is treated as the previous year |
| 32 | +- Journal inputs are one JSON object per line and map from `MESSAGE`, `_PID`, `_COMM`, and `_SYSTEMD_UNIT` when available |
| 33 | +- `_PID` is preserved as contextual process metadata when present; it should not be read as a guaranteed identity anchor on its own |
| 34 | +- Unsupported or malformed records fail clearly per line without stopping the full batch |
| 35 | + |
| 36 | +## End-to-End Workflow |
22 | 37 |
|
23 | 38 | ```bash |
24 | 39 | python -m pip install -e .[dev] |
25 | | -python -m linux_auth_observe normalize --input tests/fixtures/ubuntu_auth.log --source auto --year 2026 --timezone Asia/Shanghai --output output/events.jsonl |
26 | | -python -m linux_auth_observe filter --input output/events.jsonl --user alice --ip 192.0.2.10 --service sshd |
27 | | -python -m linux_auth_observe summary --input output/events.jsonl --output output/summary.md |
28 | | -python -m pytest -q |
| 40 | + |
| 41 | +python -m linux_auth_observe normalize \ |
| 42 | + --input tests/fixtures/ubuntu_auth.log \ |
| 43 | + --source auto \ |
| 44 | + --year 2026 \ |
| 45 | + --timezone Asia/Shanghai \ |
| 46 | + --output output/events.jsonl |
| 47 | + |
| 48 | +python -m linux_auth_observe filter \ |
| 49 | + --input output/events.jsonl \ |
| 50 | + --user alice \ |
| 51 | + --ip 192.0.2.10 \ |
| 52 | + --service sshd |
| 53 | + |
| 54 | +python -m linux_auth_observe summary \ |
| 55 | + --input output/events.jsonl \ |
| 56 | + --output output/summary.md |
| 57 | + |
| 58 | +python -m linux_auth_observe normalize \ |
| 59 | + --input tests/fixtures/ubuntu_auth_with_error.log \ |
| 60 | + --source auto \ |
| 61 | + --year 2026 \ |
| 62 | + --timezone Asia/Shanghai \ |
| 63 | + --output output/events.jsonl \ |
| 64 | + --error-output output/parse-errors.jsonl |
29 | 65 | ``` |
30 | 66 |
|
31 | | -`normalize` defaults to the current UTC year and the local system timezone when parsing yearless syslog timestamps. Pass `--year` and `--timezone` to replay fixtures deterministically. |
| 67 | +The intended flow is `normalize -> filter -> summary`, with `--error-output` available when you want a structured JSONL artifact for parse failures while the batch continues. |
32 | 68 |
|
33 | 69 | ## Event Schema |
34 | 70 |
|
|
0 commit comments