โก Fortify
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 fortify to harden it. The built-in Deploy menu is available for quick setup if needed.
๐ Quick Install
bash <(curl -sL https://github.com/SamNet-dev/fortify/raw/main/install.sh)
Then just run:
fortify
๐ What It Does
Fortify 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]
๐ก๏ธ Supported Backends
| 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 |
โ |
๐ฏ Key Features
๐ Auto-Detection
Fortify scans for installed services on every launch โ no configuration needed. Install a backend, run fortify, and it appears immediately.
๐ Security Scoring
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 |
๐ก๏ธ One-Click Profiles
Apply a full hardening profile with one command:
fortify --profile paranoid
Available profiles:
| Profile |
Description |
paranoid |
Maximum security โ blocks everything unnecessary |
public-share |
Balanced for shared/public VPN servers |
minimal |
Light touch โ essentials only |
๐งฑ Anti-Abuse Protection
- 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
๐ Xray Geo-Blocking
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)
๐ SSH Hardening
- 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
๐ฅ Firewall Management
- 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
๐พ Backup & Restore
- Automatic backup before every change
- Checksum verification (SHA256)
- Named backups with timestamps
- Restore any previous state
๐ฌ Notifications
- Telegram โ bot token + chat ID
- Discord โ webhook URL
- Custom webhook โ any HTTP endpoint
๐ป CLI Usage
# 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
๐ Project Structure
/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
๐ Security Design
No Lockout Guarantee
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-password if no keys found
- ๐ Firewall flush automatically re-creates SSH safety rule
- ๐ SSH port change updates the safety rule to match
Tagged Firewall Rules
Every rule Fortify creates is tagged with a fortify-* comment, making cleanup simple and preventing conflicts with other tools (Docker, fail2ban, etc.).
Non-Destructive
- Uses a separate
inet fortify nftables table (never touches system tables)
- Backs up configs before every change
- All changes are reversible
๐ฅ๏ธ Requirements
- 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)
๐ License
MIT License โ see LICENSE for details.
๐ค Author
Sam โ SamNet Technologies
โก Harden everything. Trust nothing.