CâSentinel: Semantic Observability for UNIX Systems
CâSentinel is a lightweight, portable system prober written in C that captures comprehensive system fingerprintsâincluding auditdâbased security eventsâand leverages LLMâdriven reasoning to surface subtle, nonâobvious risk indicators. Its modern web dashboard offers multiâuser RBAC, twoâfactor authentication, personal API keys, audit logging, and proactive email/Slack alerts, delivering explainable risk scores and realâtime threat visibility across hosts.
# CâSentinel: Semantic Observability for UNIX Systems
CâSentinel is a compact, Câbased probing engine that gathers a holistic view of a Linux hostâsystem metrics, process information, network state, configuration changes, and security eventsâinto a JSON âfingerprint.â The engineâs core advantage lies in its ability to combine traditional observability data with auditd logs to provide a semantic understanding of how and why system states shift, enabling AIâaugmented reasoning that surfaces hidden degradation, causal chains, and contextârich alerts.
---
## The Observability Gap
Modern observability platforms such as Dynatrace, Datadog, and Prometheus excel at collecting metrics and triggering threshold alerts. However, they typically answer a single question: *Is this metric outside its expected range?* They struggle with:
* **Causal reasoning** â determining the root cause of an anomaly.
* **Context synthesis** â linking a config change weeks ago to a latency spike today.
* **Nonâobvious degradation** â catching subtle drifts before full failure.
* **Security context** â correlating who accessed what and why it matters.
CâSentinel addresses these limitations by generating a full system fingerprint that includes security events, then feeding that structured data to a largeâlanguageâmodel (LLM) layer that applies semantic reasoning.
---
## QuickâStart Guide
```sh
# Clone the repository
git clone https://github.com/williamofai/c-sentinel.git
cd c-sentinel
# Build the agent (release)
make
# Perform a oneâshot analysis with network and audit data (requires root for audit logs)
sudo ./bin/sentinel --quick --network --audit
# Learn baseline patterns (automatic with --audit)
./bin/sentinel --learn --network
# Start continuous monitoring (watch mode, 5âminute intervals)
sudo ./bin/sentinel --watch --interval 300 --network --audit
```
#### CommandâLine Overview
| Flag | Description |
| ---- | ----------- |
| `--quick` | Humanâreadable summary |
| `--network` | Probe listening ports and established connections |
| `--audit` | Include security events (requires root) |
| `--watch` | Continuous monitoring; specify `--interval` |
| `--learn` | Save current state as baseline |
| `--json` | Produce a full fingerprint for ingestion |
---
## Architecture Overview
```mermaid
flowchart TD
A(Web Dashboard) --> B(User Auth & RBAC)
A --> C(Email & Slack Notifications)
A --> D(Session & Audit Log)
B --> E({CâSentinel Agent})
E --> F(JSON Fingerprint)
F --> G(Dashboard Ingestion API)
```
**CâSentinel Agent** (â99âŻKB binary) runs on POSIX systems and parses `/proc`, computes SHAâ256 checksums, and optionally reads auditd logs. The lightweight design translates system state into deterministic JSON that can be streamed to the dashboard via HTTP POST.
### Data Capture Categories
| Category | Collected Data | Purpose |
| -------- | -------------- | ------- |
| System | Kernel, uptime, load, memory | Baseline health context |
| Processes | Notable process metadata | Zombie/leak detection |
| Configs | File metadata & SHAâ256 | Drift & integrity monitoring |
| Network | Listeners, connections | Service health |
| Security | Auth failures, sudo usage, sensitive file access | Threat detection |
---
## Dashboard Features
| Feature | Description |
| -------- | ----------- |
| **MultiâUser Authentication** | Three rolesâAdmin, Operator, Viewerâprovide granular permissions. |
| **TwoâFactor Authentication (TOTP)** | QRâcode setup, supported by Google Authenticator, Authy, etc.; enforced on every login when enabled. |
| **Personal API Keys** | Generate perâuser keys (named, expirable) for CI/CD automation; inherit the userâs role permissions. |
| **Admin Audit Log** | Records all user actions (login, logout, changes, revocations) with IP, device, and timestamp filters. |
| **Session Management** | View, revoke, or forceâlogout individual sessions; autoâcleanup of expired sessions. |
| **Security Posture Summary** | PlainâEnglish verdict on the hostâs security health. |
| **Explainable Risk Scoring** | Each risk score is broken down into contributing factors and weights. |
| **Risk Trend Sparkline** | 24âhour visual history of risk scores. |
| **Email & Slack Alerts** | Proactive notifications for highârisk thresholds, bruteâforce patterns, execution from `/tmp`, etc. |
| **Public Demo Mode** | Readâonly viewer access without login; convenient for prospect demos. |
---
## Alerts & Notifications
| Trigger | Alert Medium | Notification Content |
| ------- | ------------- | --------------------- |
| Risk score â„âŻ16 | Email / Slack | Structured message with severity, risk factors, and dashboard link |
| Bruteâforce pattern detected | Email / Slack | Flag and suggested remedial actions |
| Execution from `/tmp` or `/dev/shm` | Email / Slack | Suspicious process details |
| New IP user login | Email | Account activity summary |
Slack integration is enabled via an incoming webhook; the message payload includes coloured severity tags and clickable links to the relevant host view.
---
## Example Output
```
Hostname: axioma-validator
Uptime: 14.5 days
Load: 0.02 0.04 0.00
Memory: 49.2% used
Processes: 120 total
Potential Issues:
Zombie processes: 0
High FD processes: 1
Long-running (>7d): 95
Config permission issues: 0
Network:
Listening ports: 26
Established connections: 14
Unusual ports: 12 â
Security (audit):
Auth failures: 6
â BRUTE FORCE PATTERN DETECTED
Sudo commands: 81
Sensitive file access: 2
- /etc/passwd by touch
- /etc/shadow by touch â
Risk: high (score: 25)
```
The corresponding JSON payload contains audit summaries, learning state, and detailed risk factors.
---
## Deployment & Automation
### Systemd Service
```sh
sudo ./install.sh
sudo systemctl enable sentinel
sudo systemctl start sentinel
sudo journalctl -u sentinel -f
```
### Scheduler for Continuous Ingestion
```crontab
*/5 * * * * sudo /usr/local/bin/sentinel --json --network --audit | \
curl -s -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_KEY" \
-d @- https://your-dashboard.com/api/ingest
```
### Email / Slack Configuration
Configure environment variables in the systemd service or an `env` file:
```
ALERT_EMAIL_ENABLED=true
ALERT_SMTP_HOST=smtp.gmail.com
ALERT_SMTP_PORT=587
ALERT_SMTP_USER=you@example.com
ALERT_SMTP_PASS=app_password
ALERT_FROM=you@example.com
ALERT_TO=alerts@example.com
ALERT_COOLDOWN_MINS=60
ALERT_SLACK_ENABLED=true
ALERT_SLACK_WEBHOOK=https://hooks.slack.com/...
ALERT_SLACK_CHANNEL=#security-alerts
ALERT_SLACK_USERNAME=Sentinel
```
---
## Privacy Controls
* **Username hashing** â failed login usernames are stored as deterministic hashes (e.g., `user_c4c5`) to preserve correlation while protecting identity.
* **No command arguments** â sensitive arguments are omitted from logs.
* **Process names only** â full executable paths are sanitized.
---
## Roadmap Highlights
* Completed: core prober, baseline learning, auditd parsing, risk scoring, web dashboard, multiâuser auth, 2FA, API keys, audit log, email/Slack alerts, public demo mode.
* Planned: native FreeBSD/macOS support, Microsoft Teams webhook alerts, custom alert rules, PDF security reports, explicit hostâlevel permissions.
---
## Licensing & Credits
CâSentinel is distributed under the MIT License. The project was crafted by William Murray (30âŻyears UNIX engineering experience) and is maintained at GitHub: `@williamofai`.
---
> "The goal isn't to replace monitoring toolsâit's to add wisdom to their data."