A security monitoring and IP blocking system written in Go that detects direct IP access attempts, checks them against AbuseIPDB, and automatically blocks malicious IPs in UniFi firewalls.
- π Direct IP Access Detection - Monitors and logs all direct IP access attempts
- π‘οΈ Automatic IP Blocking - Integrates with UniFi controllers to block high-risk IPs
- π AbuseIPDB Integration - Checks IP reputation against AbuseIPDB
- π¨ Telegram Notifications - Real-time alerts via Telegram with customizable templates
- πΎ Payload Saving - Optional request payload capture for analysis
- β‘ Rate Limiting - Configurable per-IP rate limiting
- π Web Dashboard - Modern web interface to monitor blocked IPs and statistics
- ποΈ SQLite Database - Persistent storage of IP information
- π― IP Exclusion - Whitelist trusted IPs
- π Tarpit Mode - Slow down high-risk attackers
git clone https://github.com/TOomaAh/GateKeeper.git
cd GateKeeper
go build -o gatekeeper ./cmd/gatekeeperdocker-compose up -dDownload the latest release from the releases page.
Create a config.yaml file based on config.yaml.example:
notifications:
telegram:
- chat_id: "YOUR_TELEGRAM_CHAT_ID"
token: "YOUR_TELEGRAM_BOT_TOKEN"
abuseip:
api_key: "YOUR_ABUSEIPDB_API_KEY"
unifi:
- url: "https://192.168.1.1:8443"
username: "admin"
password: "your_unifi_password"
ratelimit:
enabled: true
requests_per_minute: 5
database:
path: "./gatekeeper.db"
payload:
enabled: true
max_size: 1048576 # 1MB
directory: "./payloads"
dashboard:
enabled: true
port: ":8080"
excluded_ips:
- "192.168.1.10"
- "10.0.0.5"- telegram: List of Telegram notification configurations
chat_id: Telegram chat ID for notificationstoken: Telegram bot tokentemplate: (Optional) Custom message template
- api_key: Your AbuseIPDB API key (get one at https://www.abuseipdb.com)
- url: UniFi controller URL
- username: UniFi admin username
- password: UniFi admin password
You can configure multiple UniFi controllers.
- enabled: Enable/disable rate limiting
- requests_per_minute: Maximum requests per IP per minute
- path: Path to SQLite database file
- enabled: Enable/disable payload saving
- max_size: Maximum payload size in bytes
- directory: Directory to store captured payloads
- enabled: Enable/disable web dashboard
- port: HTTP port for dashboard (e.g.,
:8080)
- excluded_ips: List of IPs to whitelist (no checks performed)
./gatekeeper -config config.yamldocker-compose up -dOnce running, access the dashboard at: http://localhost:8080
The dashboard displays:
- Total IPs tracked
- Active entries
- Blocked IPs count
- Database size
- System uptime
- Recent IP activity table with scores and status
- Detection: GateKeeper listens on port 8888 and detects direct IP access attempts
- Rate Limiting: Applies per-IP rate limiting if enabled
- IP Check: Queries AbuseIPDB for IP reputation score
- Database: Stores IP information in SQLite with TTL
- Blocking: High-risk IPs (score β₯ 75) are automatically added to UniFi firewall groups
- Notification: Sends alerts via Telegram with IP details
- Response:
- High-risk IPs: Tarpit mode (slow connection)
- Other IPs: Drop connection immediately
GET /api/stats- Returns system statisticsGET /api/ips- Returns list of recent IPs (last 100)
Example response for /api/stats:
{
"database_stats": {
"TotalEntries": 150,
"ActiveEntries": 45,
"BlockedEntries": 23,
"DBSize": 49152
},
"uptime": "2h15m30s",
"timestamp": "2025-11-05T10:30:00Z"
}- Go 1.21 or higher
go build -o gatekeeper ./cmd/gatekeeper# Linux AMD64
GOOS=linux GOARCH=amd64 go build -o gatekeeper-linux-amd64 ./cmd/gatekeeper
# Windows AMD64
GOOS=windows GOARCH=amd64 go build -o gatekeeper-windows-amd64.exe ./cmd/gatekeeper
# macOS ARM64
GOOS=darwin GOARCH=arm64 go build -o gatekeeper-darwin-arm64 ./cmd/gatekeeper.
βββ cmd/
β βββ gatekeeper/
β βββ main.go # Application entry point
βββ internal/
β βββ abuseip/ # AbuseIPDB client
β βββ cache/ # Caching layer
β βββ config/ # Configuration management
β βββ dashboard/ # Web dashboard
β βββ database/ # SQLite database
β βββ domain/ # Domain types
β βββ gatekeeper/ # Core logic
β βββ notification/ # Notification system
β βββ ratelimit/ # Rate limiting
β βββ unifi/ # UniFi controller client
βββ config.yaml.example # Example configuration
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker compose setup
βββ .goreleaser.yml # GoReleaser configuration
go test ./...Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Store your
config.yamlsecurely and never commit it to version control - Use strong passwords for UniFi controllers
- Keep your AbuseIPDB API key confidential
- Regularly review the excluded IPs list
- Monitor the dashboard for unusual activity
- Review captured payloads for security research only
- AbuseIPDB for IP reputation data
- UniFi Network for network management
- Telegram for notification system