A Generic File Integrity Monitoring Platform with CMS-specific templates.
OJS Monitor is the first dedicated template. The platform is designed to support multiple CMS/systems (WordPress, Drupal, custom) via template plugins.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FIM MONITOR PLATFORM β
β (Generic File Integrity Monitoring) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Core Engine (Platform-wide) β
β βββ File Scanner (Hash, Permission, Metadata) β
β βββ FIM Watcher (fsnotify) β
β βββ Background Worker (Job Queue) β
β βββ Database (SQLite - Platform Schema) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Templates/Plugins (CMS-Specific Detection) β
β βββ OJS Template β submission_files, users, journals β
β βββ WordPress Template β wp_posts, wp_uploads (future) β
β βββ Custom Template β (user-defined rules) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Baseline Scanning: Create initial file baseline with SHA-256 hashes
- Change Detection: Detect added, modified, and deleted files
- Permission Tracking: Monitor file mode, UID, GID changes
- Real-time Monitoring: Using fsnotify for instant detection
- Whitelist/Blacklist: Exclude specific paths or extensions
- OJS Template: Orphan detection, user metrics, journal statistics
- Extensible: Add new CMS support via template interface
- Generic Core: Scanner/watcher work without CMS templates
- Background Worker: Non-blocking scan jobs
- Progress Tracking: Real-time scan progress updates
- Scheduled Scans: Daily integrity scans
- Graceful Shutdown: Clean worker shutdown on signals
- JWT Authentication: Secure admin login
- Audit Logging: Track all admin actions
- Race Condition Protection: Database-level locking
backend/
βββ cmd/ # Entry points (source code)
β βββ manage/ # CLI tool
β βββ server/ # HTTP API server
β βββ worker/ # Background worker
β
βββ bin/ # Compiled binaries
β βββ manage # CLI tool
β βββ fim-server # HTTP API server
β βββ worker # Background worker
β
βββ pkg/ # Shared packages
β βββ response/ # HTTP response helpers
β
βββ internal/ # Application code
βββ domain/ # Business rules (models, interfaces)
βββ application/ # Use cases
βββ infrastructure/ # Technology implementations
β βββ database/ # SQLite/MySQL
β βββ http/ # HTTP handlers
β βββ scanner/ # File scanning
β βββ watcher/ # FIM watcher
β βββ worker/ # Background worker
β βββ templates/ # CMS templates
βββ wire/ # Dependency injection
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend ββββββΆβ Go Backend ββββββΆβ SQLite DB β
β (Next.js) β β (chi router) β β (metadata) β
βββββββββββββββββββ ββββββββββ¬βββββββββ βββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β OJS Metricsβ CMS-specificβ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β OJS β βWordPress β β Custom β
β Template β β Template β β Template β
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
β β β
βββββββββββββββ΄ββββββββββββββ
β
βΌ
βββββββββββββββ
β CMS MySQL β
β Databases β
βββββββββββββββ
| Component | Technology |
|---|---|
| Frontend | Next.js 16 (Turbopack), React, Tailwind CSS |
| Backend | Go 1.21+, chi router, bcrypt, jwt |
| Local DB | SQLite (WAL mode) |
| Target DB | MySQL 5.7+ (CMS databases) |
- Go 1.21 or higher
- Node.js 18 or higher
- MySQL 5.7+ (for CMS database access)
- Linux (for real-time monitoring with fsnotify)
git clone https://github.com/your-repo/fim-monitor.git
cd fim-monitor
make build# Run migrations
./bin/manage migrate
# Create admin user
./bin/manage add-admin admin secretpassword
# Or use default admin
./bin/manage seed # admin / admin123# Daemon mode (recommended)
./bin/manage server:start
# Or separate terminals
./bin/fim-server # Terminal 1: API Server
./bin/worker # Terminal 2: Background Worker- API Server: http://localhost:8080
- Frontend: http://localhost:3000 (if running)
- Default Login: admin / admin123
# Database management
./bin/manage migrate # Run migrations
./bin/manage seed # Seed default admin
./bin/manage add-admin <username> <password> # Create admin user
./bin/manage status # Show system status
# Server management (daemon mode)
./bin/manage server:start # Start server + worker
./bin/manage server:stop # Stop server + worker
./bin/manage server:restart # Restart all services
./bin/manage server:status # Show service status
# Manual mode (separate terminals)
./bin/fim-server # Start HTTP API server
./bin/worker # Start background worker
# Help
./bin/manage help # Show all commandsThe CLI manages server and worker processes using PID files:
| Command | Description |
|---|---|
manage server:start |
Start server + worker (daemon) |
manage server:stop |
Stop gracefully with SIGTERM |
manage server:restart |
Restart all services |
manage server:status |
Show running processes |
PID files: .server.pid, .worker.pid
- Login to the dashboard
- Click "Add Project"
- Configure:
- Name: Project identifier
- Template: OJS (or future templates)
- App Path: Path to CMS installation
- Files Path: Path to CMS uploads
- Database: CMS MySQL connection
- Open the project
- Click "Start Scan"
- Monitor progress in Jobs tab
Templates provide CMS-specific detection:
- Orphan Detection: Files not in CMS database
- User Metrics: New users, validated users, etc.
- CMS Statistics: Journal counts, submission counts
| Template | Status | Features |
|---|---|---|
| OJS | β Ready | Full support |
| WordPress | π Future | Pending |
| Drupal | π Future | Pending |
| Custom | π Future | User-defined |
- Create
internal/templates/<name>/ - Implement
Templateinterface - Register in application
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Backend server port |
DB_PATH |
./database/ |
SQLite database path |
For monitoring CMS paths, ensure:
- Read access to application directories
- Read access to upload directories
- MySQL SELECT permissions on CMS database
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/login |
Admin login |
| GET | /api/projects |
List projects |
| POST | /api/projects |
Create project |
| GET | /api/projects/:id |
Get project |
| PUT | /api/projects/:id |
Update project |
| POST | /api/projects/:id/scan |
Start baseline scan |
| GET | /api/projects/:id/jobs |
Get scan jobs |
| GET | /api/projects/:id/files |
Get files |
| GET | /api/logs |
Get audit logs |
make build # Build all binaries
make clean # Remove binaries
make test # Run tests
make test-race # Run tests with race detector
make status # Check system status
make migrate # Run migrationsbackend/
βββ cmd/ # Binaries
β βββ manage/main.go # CLI tool
β βββ server/main.go # HTTP server
β βββ worker/main.go # Background worker
βββ pkg/ # Shared
βββ internal/ # Application
β βββ domain/ # Business rules
β βββ application/ # Use cases
β βββ infrastructure/ # Implementations
βββ wire/ # DI
- Change default password after first login
- Use HTTPS in production
- Restrict paths - Read-only access to CMS directories
- MySQL permissions - Use minimal required permissions
GRANT SELECT ON cms_database.* TO 'fim_monitor'@'%';
FLUSH PRIVILEGES;- Verify MySQL is running and accessible
- Check firewall settings
- Ensure MySQL allows remote connections
- Check if worker is running
- Verify paths are correct and accessible
- Check disk space
- Ensure paths have correct permissions
- Check whitelist/blacklist settings
- Verify symlinks are not being skipped
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - see LICENSE for details.
Binaries are located in backend/bin/:
backend/bin/manage # CLI tool
backend/bin/fim-server # HTTP API server
backend/bin/worker # Background worker
Build using Makefile:
make buildOr manually:
cd backend
go build -o bin/manage ./cmd/manage
go build -o bin/fim-server ./cmd/server
go build -o bin/worker ./cmd/worker