Harden everything. Trust nothing.
Universal security hardener for proxy & VPN servers
Fortify automatically detects proxy and VPN services running on your server, scores their security posture (0β100, A+ to F), and hardens them with one-click profiles or granular manual controls.
π‘ Best practice: Install your proxy/VPN backend first using its official installer, then run
fortifyto harden it. The built-in Deploy menu is available for quick setup if needed.
bash <(curl -sL https://github.com/SamNet-dev/fortify/raw/main/install.sh)Then just run:
fortifyFortify scans your server, detects running services, and presents an interactive TUI dashboard:
β‘ Fortify v0.9
Harden everything. Trust nothing.
by Sam β SamNet Technologies
Detected Services:
βββ β Anti-Abuse (SMTP torrent)
βββ β Firewall (nftables) 3 ports open
βββ β hysteria2 v2.7.1 (running)
βββ β SSH :2222 key-only
βββ β WireGuard wg0 (3 peers)
βββ β Xray v26.2.6 (running)
Security Score: ββββββββββββββββββββ 82/100 [A]
| Backend | Detection | Hardening | Deploy |
|---|---|---|---|
| π· Xray (VLESS/VMess/Trojan) | β Auto | β Geo-block, port block, sniffing, routing | β Core, 3X-UI, Marzban |
| π’ WireGuard | β Auto | β PresharedKey audit, permissions, peer review | β Full setup |
| π‘ sing-box | β Auto | β Route rules, geo-IP, protocol blocking | β Latest release |
| π΅ Hysteria 2 | β Auto | β TLS check, SMTP block, firewall | β Official installer |
| π OpenVPN | β Auto | β TLS-crypt, cipher hardening, DPI protection | β Server setup |
| π£ DNSTT | β Auto | β Rate limiting, connection limits, SMTP block | π Via dnstm-setup |
| π SSH | β Always | β Key-only auth, fail2ban, cipher hardening | β |
| π§± Firewall | β Always | β nftables/iptables, dual-stack IPv4+IPv6 | β |
Fortify scans for installed services on every launch β no configuration needed. Install a backend, run fortify, and it appears immediately.
Each module gets a score (0β100) based on its security posture. The overall score combines all modules into a single grade:
| Grade | Score | Meaning |
|---|---|---|
| A+ | 95β100 | Hardened |
| A | 85β94 | Strong |
| B | 70β84 | Good |
| C | 50β69 | Needs work |
| D | 30β49 | Weak |
| F | 0β29 | Critical |
Apply a full hardening profile with one command:
fortify --profile paranoidAvailable profiles:
| Profile | Description |
|---|---|
paranoid |
Maximum security β blocks everything unnecessary |
public-share |
Balanced for shared/public VPN servers |
minimal |
Light touch β essentials only |
- SMTP blocking β prevent spam (ports 25, 465, 587)
- Torrent blocking β port-based + deep packet inspection (DPI)
- Rate limiting β per-IP SYN flood protection
- Connection limits β cap concurrent connections
- IP blocking/whitelisting β single IPs or CIDR ranges
Block traffic by country using Xray's GeoIP database:
- Preset list: China, Russia, North Korea, Syria, Cuba, Venezuela, Belarus, Myanmar
- Custom country codes: add any 2-letter ISO code (e.g.,
TR,DE,PK)
- Disable password authentication (key-only)
- Change SSH port with automatic firewall update
- MaxAuthTries enforcement (minimum 4 β prevents lockout)
- fail2ban setup with Fortify-managed jail
- Cipher/KexAlgorithm hardening
- Lockout prevention: SSH access rule is always preserved in the firewall, even after flush
- Dual-stack: IPv4 + IPv6
- Supports nftables and iptables (auto-detected)
- Tagged rules for clean management (
fortify-*comments) - Persistent across reboot via systemd service
- SYN flood protection, invalid packet dropping, ICMP rate limiting
- Automatic backup before every change
- Checksum verification (SHA256)
- Named backups with timestamps
- Restore any previous state
- Telegram β bot token + chat ID
- Discord β webhook URL
- Custom webhook β any HTTP endpoint
# Interactive TUI
fortify
# Quick security scan
fortify --scan
# One-line status (great for monitoring)
fortify --status
# Output: fortify score=82 grade=A modules=8
# JSON report (for automation)
fortify --json
# Apply hardening profile
fortify --profile paranoid
# Deploy a new backend
fortify --deploy
# Backup all configs
fortify --backup
# Show version
fortify --version/opt/fortify/
βββ fortify.sh # Main entry point + TUI + help pages
βββ install.sh # Installer
βββ core/
β βββ utils.sh # Shared utilities, validators, logging
β βββ tui.sh # Terminal UI (menus, boxes, colors)
β βββ firewall.sh # nftables/iptables abstraction layer
β βββ loader.sh # Module loader + service scanner
β βββ scorer.sh # Score calculator + grade system
β βββ backup.sh # Backup/restore with checksums
β βββ notify.sh # Telegram/Discord/webhook notifications
β βββ deployer.sh # Backend installers
β βββ updater.sh # Self-update mechanism
βββ modules/
β βββ antabuse.sh # Anti-abuse (SMTP, torrent, rate limit)
β βββ ssh.sh # SSH hardening
β βββ firewall_mod.sh # Firewall module (audit, rules)
β βββ xray.sh # Xray/panel security
β βββ wireguard.sh # WireGuard hardening
β βββ singbox.sh # sing-box security
β βββ hysteria.sh # Hysteria 2 hardening
β βββ openvpn.sh # OpenVPN hardening
β βββ dnstt.sh # DNSTT security
βββ profiles/
βββ paranoid.conf # Maximum security
βββ public-share.conf # Balanced for shared servers
βββ minimal.conf # Light touch
Fortify is designed to never lock you out of your server:
- π SSH port is always allowed in the firewall (even after flush)
- π MaxAuthTries minimum of 4 enforced (prevents multi-key lockout)
- π Password auth only disabled after confirming SSH keys exist
- π Root login falls back to
prohibit-passwordif no keys found - π Firewall flush automatically re-creates SSH safety rule
- π SSH port change updates the safety rule to match
Every rule Fortify creates is tagged with a fortify-* comment, making cleanup simple and preventing conflicts with other tools (Docker, fail2ban, etc.).
- Uses a separate
inet fortifynftables table (never touches system tables) - Backs up configs before every change
- All changes are reversible
- OS: Ubuntu 20.04+, Debian 11+, CentOS 8+, AlmaLinux 8+, Fedora 36+
- Bash: 4.4+
- Root access required
- Optional:
jq(for Xray/sing-box JSON editing β installed automatically if missing)
MIT License β see LICENSE for details.
Sam β SamNet Technologies
- GitHub: github.com/SamNet-dev
β‘ Harden everything. Trust nothing.