<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Freemen HOUNGBEDJI</title>
    <description>The latest articles on DEV Community by Freemen HOUNGBEDJI (@freemen_tech).</description>
    <link>https://dev.to/freemen_tech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3754857%2F0c8c529a-2768-4ce7-a55c-bcf97afa1345.jpg</url>
      <title>DEV Community: Freemen HOUNGBEDJI</title>
      <link>https://dev.to/freemen_tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/freemen_tech"/>
    <language>en</language>
    <item>
      <title>🔥 Building Vigilo: A 15MB File Integrity Monitor That Outperforms OSSEC</title>
      <dc:creator>Freemen HOUNGBEDJI</dc:creator>
      <pubDate>Fri, 06 Feb 2026 13:37:21 +0000</pubDate>
      <link>https://dev.to/freemen_tech/building-vigilo-a-15mb-file-integrity-monitor-that-outperforms-ossec-5g02</link>
      <guid>https://dev.to/freemen_tech/building-vigilo-a-15mb-file-integrity-monitor-that-outperforms-ossec-5g02</guid>
      <description>&lt;p&gt;🚨 The Night Everything Broke&lt;br&gt;
My former employer got hacked.&lt;/p&gt;

&lt;p&gt;At 3:07 AM, an attacker modified /etc/sudoers.&lt;br&gt;
No alerts.&lt;br&gt;
No logs reviewed.&lt;br&gt;
No alarms.&lt;/p&gt;

&lt;p&gt;We noticed it 3 days later.&lt;br&gt;
That night, I opened a blank Python file:&lt;br&gt;
   file_monitoring.py&lt;br&gt;
That file became Vigilo.&lt;/p&gt;

&lt;p&gt;❌ Why Existing Tools Failed Us&lt;br&gt;
We didn’t ignore security tools.&lt;br&gt;
We tried them.&lt;/p&gt;

&lt;p&gt;OSSEC&lt;br&gt;
❌ 200+ MB RAM on idle&lt;br&gt;
❌ 50+ lines of XML config for a single file&lt;br&gt;
❌ False positives drowning real alerts&lt;/p&gt;

&lt;p&gt;Wazuh&lt;br&gt;
❌ 30+ minutes installation&lt;br&gt;
❌ YAML + agents + dashboards&lt;br&gt;
❌ Massive overkill for &amp;lt; 50 servers&lt;/p&gt;

&lt;p&gt;What we needed was simple:&lt;/p&gt;

&lt;p&gt;“Tell me immediately when a critical file changes.&lt;br&gt;
Nothing more. Nothing less.”&lt;/p&gt;

&lt;p&gt;🛠️ What I Built Instead&lt;/p&gt;

&lt;p&gt;Vigilo is a lightweight File Integrity Monitor built for real-world ops teams.&lt;/p&gt;

&lt;p&gt;💾 &amp;lt; 15 MB RAM&lt;br&gt;
⚡ &amp;lt; 1 second alert latency&lt;br&gt;
🧠 Zero configuration hell&lt;br&gt;
🐍 100% Python, easy to hack &amp;amp; extend&lt;/p&gt;

&lt;p&gt;🎯 Core Design Principles&lt;/p&gt;

&lt;p&gt;Install in under 60 seconds&lt;br&gt;
Minimal memory footprint&lt;br&gt;
Readable, auditable code&lt;br&gt;
Production-ready from day one&lt;/p&gt;

&lt;p&gt;🧩 Technical Architecture&lt;br&gt;
vigilo/&lt;br&gt;
├── file_monitoring.py   # SHA-256 + metadata tracking&lt;br&gt;
├── FileWatcher.py       # inotify wrapper with smart filtering&lt;br&gt;
├── logger.py            # thread-safe persistent storage&lt;br&gt;
├── alert_manager.py     # system / future email / webhook alerts&lt;br&gt;
└── main.py              # CLI entrypoint&lt;/p&gt;

&lt;p&gt;⚡ Performance Optimizations That Matter&lt;br&gt;
1️⃣ In-Memory Baseline Cache&lt;br&gt;
Before (slow, disk-bound):&lt;br&gt;
def handle_event(path):&lt;br&gt;
    baseline = read_from_disk(path)&lt;/p&gt;

&lt;p&gt;After (fast, O(1)):&lt;br&gt;
def handle_event(path):&lt;br&gt;
    baseline = self.cache[path]&lt;br&gt;
📈 Result: 10× faster event processing.&lt;/p&gt;

&lt;p&gt;2️⃣ Atomic Writes (No Corrupted State)&lt;br&gt;
temp = "file_info.json.tmp"&lt;br&gt;
write_to(temp)&lt;br&gt;
os.replace(temp, "file_info.json")  # POSIX atomic&lt;/p&gt;

&lt;p&gt;Even a crash won’t break your baseline.&lt;/p&gt;

&lt;p&gt;3️⃣ Thread Safety (Because Events Are Brutal)&lt;br&gt;
_db_lock = threading.Lock()&lt;br&gt;
with _db_lock:&lt;br&gt;
    save_state()&lt;br&gt;
No race conditions. No silent corruption.&lt;/p&gt;

&lt;p&gt;📊 Benchmarks&lt;/p&gt;

&lt;p&gt;Test: Monitoring /etc/nginx/nginx.conf&lt;br&gt;
Load: 10 modifications / second&lt;/p&gt;

&lt;p&gt;Tool    CPU RAM False Positives&lt;br&gt;
Vigilo  0.8%    11 MB   0&lt;br&gt;
OSSEC   3.2%    187 MB  14&lt;br&gt;
Wazuh   5.1%    243 MB  23&lt;/p&gt;

&lt;p&gt;🚀 Usage&lt;/p&gt;

&lt;h1&gt;
  
  
  Install
&lt;/h1&gt;

&lt;p&gt;pip install -r requirements.txt&lt;/p&gt;

&lt;h1&gt;
  
  
  Add file to monitoring
&lt;/h1&gt;

&lt;p&gt;vigilo add /etc/nginx/nginx.conf --preset full --alert system&lt;/p&gt;

&lt;h1&gt;
  
  
  Start monitoring
&lt;/h1&gt;

&lt;p&gt;vigilo start&lt;br&gt;
Modify the file → desktop alert in &amp;lt; 1 second.&lt;/p&gt;

&lt;p&gt;🔐 Security First (Yes, Even the Tool)&lt;/p&gt;

&lt;p&gt;✅ Path whitelisting (no /etc/shadow)&lt;br&gt;
✅ Command injection protection (shlex.quote)&lt;br&gt;
✅ Strict file permissions (0o600)&lt;br&gt;
✅ Input validation on all CLI arguments&lt;/p&gt;

&lt;p&gt;🌙 Lessons Learned (The Hard Way)&lt;/p&gt;

&lt;p&gt;Night 1 — The Watchdog Spam&lt;br&gt;
One file triggered 1000+ events/min.&lt;br&gt;
👉 Fixed by filtering events before processing.&lt;/p&gt;

&lt;p&gt;Night 2 — The Performance Breakthrough&lt;br&gt;
Added in-memory cache.&lt;br&gt;
👉 Everything became 10× faster.&lt;/p&gt;

&lt;p&gt;Night 3 — The Security Obsession&lt;br&gt;
Found a command injection flaw in alert execution.&lt;br&gt;
👉 6 hours replacing everything with shlex.quote().&lt;/p&gt;

&lt;p&gt;Worth it.&lt;/p&gt;

&lt;p&gt;❌ When NOT to Use Vigilo&lt;br&gt;
You manage 1000+ servers&lt;br&gt;
You need advanced event correlation&lt;br&gt;
You require enterprise SLAs&lt;br&gt;
You must meet strict compliance (→ use Tripwire / Wazuh)&lt;br&gt;
✅ When Vigilo Is Perfect:&lt;br&gt;
&amp;lt; 100 servers&lt;br&gt;
You want something that just works&lt;br&gt;
You hate false positives&lt;br&gt;
You like tools you can actually read and modify&lt;/p&gt;

&lt;p&gt;🌍 Open Source&lt;br&gt;
🔗 GitHub: &lt;a href="https://github.com/FreemenTech/Vigilo" rel="noopener noreferrer"&gt;https://github.com/FreemenTech/Vigilo&lt;/a&gt;&lt;br&gt;
📄 License: MIT&lt;br&gt;
Contributions are welcome 🙌&lt;br&gt;
💬 Questions or feedback? Drop them below 👇&lt;/p&gt;

</description>
      <category>python</category>
      <category>cybersecurity</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
