6.4 KiB
6.4 KiB
Checkpoint Security Gateway
High-performance, TypeScript-based security gateway with advanced threat detection, behavioral analysis, and adaptive protection.
Features:
- 🔐 Checkpoint Security: Proof-of-work (PoW) and proof-of-space-time (PoST) challenges for suspicious traffic
- 🛡️ Web Application Firewall: Advanced pattern matching against SQL injection, XSS, command injection, and more
- 🌎 IP & Geo-Filtering: Block or allow traffic based on country, continent, or ASN using MaxMind GeoIP2
- 🔀 Reverse Proxy: High-performance request forwarding with WebSocket support
- 🧠 Behavioral Detection: ML-inspired pattern recognition with adaptive scoring
- 📊 Threat Scoring: Real-time risk assessment with configurable thresholds
- 🤖 Bot Verification: Identifies and handles good bots vs malicious automation
- 🧩 Plugin Architecture: Modular design for easy extension and customization
- 📂 Data Persistence: Secure token storage with LevelDB + TTL and HMAC protection
🚀 Quick Start
-
Clone the repository
git clone https://git.caileb.com/Caileb/Checkpoint.git cd Checkpoint -
Install dependencies
npm install -
Set up configuration files
cp config/*.toml.example config/*.toml -
Configure your settings
- Edit TOML files in
config/directory - Set proxy mappings in
proxy.toml - Configure security rules in
waf.toml - Adjust thresholds in
threat-scoring.toml
- Edit TOML files in
-
Development mode
npm run dev -
Production mode
npm start -
Daemonize with PM2
npm run daemon # Start in background npm run stop # Stop daemon npm run restart # Restart daemon npm run logs # View logs
⚙️ Configuration
All settings are stored in TOML files within the config/ directory:
checkpoint.toml— Proof-of-work parameters, token storage, exclusion ruleswaf.toml— Web Application Firewall rules, scoring, and bot verificationbehavioral-detection.toml— Pattern detection rules and correlationsproxy.toml— Hostname-to-backend mappings, timeouts, and body size limitsipfilter.toml— Geographic and network filtering with MaxMind integrationthreat-scoring.toml— Advanced scoring thresholds and feature weights
Environment Variables
PORT— Server port (default: 3000)NODE_ENV— Environment mode (production/development)MAXMIND_ACCOUNT_ID— MaxMind account ID for GeoIP databasesMAXMIND_LICENSE_KEY— MaxMind license keyMAX_BODY_SIZE— Request body size limit (default: 10mb)MAX_BODY_SIZE_MB— WAF body size limit in MB (default: 10)
📂 Project Structure
.
├── config/ # TOML configuration files
├── data/ # Runtime data (secrets, downloads)
├── db/ # LevelDB token stores
├── pages/ # Static assets and UI templates
│ ├── interstitial/ # Proof-of-work challenge pages
│ ├── ipfilter/ # Custom geo-block pages
│ └── dashboard/ # Admin dashboard (if enabled)
├── src/ # TypeScript source code
│ ├── plugins/ # Plugin modules
│ │ ├── ipfilter.ts # Geographic filtering
│ │ └── waf.ts # Web Application Firewall
│ ├── utils/ # Utility modules
│ │ ├── behavioral-detection.ts
│ │ ├── behavioral-middleware.ts
│ │ ├── bot-verification.ts
│ │ ├── cache-utils.ts
│ │ ├── logs.ts
│ │ ├── network.ts
│ │ ├── performance.ts
│ │ ├── plugins.ts
│ │ ├── proof.ts
│ │ ├── threat-scoring/
│ │ └── time.ts
│ ├── checkpoint.ts # Checkpoint security middleware
│ ├── index.ts # Main application entry
│ └── proxy.ts # Reverse proxy implementation
├── dist/ # Compiled JavaScript (generated)
├── .tests/ # Test files
├── docker-compose-synology.yml
├── Dockerfile
├── jest.config.cjs
├── package.json
├── tsconfig.json
└── README.md
🏗️ Architecture
The gateway processes requests through a layered security pipeline:
- Pre-filtering — Request exclusion rules
- IP Filter — Geographic and ASN-based blocking
- WAF — Pattern matching and attack detection
- Behavioral Detection — Cross-request pattern analysis
- Threat Scoring — Aggregate risk assessment
- Checkpoint — Challenge suspicious requests
- Proxy — Forward legitimate traffic to backends
🔒 Security Features
Web Application Firewall
- SQL injection detection with evasion handling
- XSS prevention across multiple vectors
- Command injection blocking
- Path traversal protection
- XXE and SSRF prevention
- Bot detection and verification
Behavioral Analysis
- Request pattern tracking
- Rate limit enforcement
- Geo-velocity detection
- User agent consistency checks
- Automated attack pattern recognition
Threat Scoring Engine
- Real-time risk calculation
- Adaptive thresholds
- Feature extraction from multiple sources
- Configurable scoring weights
- Automatic severity classification
📊 Default Security Thresholds
Critical Threats (Immediate Block):
javascript:URLs — Score: 100+<script>tags — Score: 80+- Command injection — Score: 90+
- SQL injection — Score: 70+
Action Thresholds:
- Allow: 0-15 (normal traffic)
- Challenge: 16-80 (suspicious)
- Block: 80+ (malicious)
🚢 Deployment
Docker
docker build -t Checkpoint .
docker run -d -p 3000:3000 -v $(pwd)/config:/app/config Checkpoint
Docker Compose (Synology)
docker-compose -f docker-compose-synology.yml up -d
PM2 Process Manager
npm run daemon # Start with PM2
pm2 save # Save process list
pm2 startup # Generate startup script
🧪 Testing
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
📈 Performance
- Handles 10,000+ requests/second
- Sub-millisecond security decisions
- Efficient caching and connection pooling
- WebSocket support with proper cleanup