Single Packet Authorization
PortGuard
PortGuard offers robust single packet authorization technology to safeguard your network against unauthorized access, including port scanning threats.
Download Now, Multi-Platform GUI
Multi-Platform GUI
Download for Windows
fwknopc_2_6_11_x64-setup.exe
Download for IOS/Macos from App Store
fwknopc_2_6_11_x64.pkg
Download for Android
fwknopc_2_6_11_x64.apk
Fwknop Server for CentOS7
File Name | Last Modified | MD5 |
---|---|---|
fwknop-server-2.6.11-1.el7.x86_64.rpm | 2025-07-29 |
1a375f89c2aa16935ddce164ad16adad
|
libfko-3.0.0-1.x86_64.rpm | 2025-07-29 |
7f720f1f444f1634bab7cadbbfec40b2
|
1. Why Did I Develop PortGuard?
I first learned about the concept of Single Packet Authorization (SPA) during a casual conversation with colleagues at work. Prior to that, I had no knowledge of port knocking or SPA. It so happened that our company needed a port-knocking solution, and after researching and exploring relevant materials, I discovered fwknop. The concept of fwknop was truly impressive—for services that need to be accessible to only a select few, fwknop is an excellent solution. We considered developing our own tool, but fwknop was far more mature. However, fwknop has its drawbacks: it is complex, with a steep learning curve for installation and use, and it lacks a dedicated client application.This led to the creation of PortGuard. The goal of PortGuard is to support mainstream port-knocking protocols like fwknop and, in the future, tnok, while providing a cross-platform client. Built as an extension of fwknop and tnok, PortGuard aims to make SPA technology more user-friendly and accessible.
2. PortGuard Client Supported Platforms
Currently, PortGuard supports the following platforms:
- iOS
- Android
- Windows
- macOS
3. PortGuard Use Cases
PortGuard's core functionality is to enhance network security by hiding service ports (default closed), and it is suitable for the following scenarios:
3.1 Protect Remote Access Services (e.g. SSH)
Scenario: Administrators need to securely access SSH services from different locations (e.g., home, coffee shop, mobile network) without exposing the SSH port to the public network.
Implementation: Use fwknop or tnok, the client sends SPA data packets or TOTP knock packets, and the server verifies and temporarily opens the SSH port (default 22) after verification.
Advantages: Prevent Nmap and other port scanning tools from discovering services, reducing the risk of zero-day vulnerabilities being exploited.
Example: Remote team members use fwknop client to send SPA data packets on Windows or Android devices, securely access company internal servers.
3.2 Service Protection in Cloud Environments
Scenario: Internal services (e.g., databases, web servers) in AWS, Azure, and other cloud platforms need to be accessed through the public network, but the ports need to be avoided from being directly exposed.
Implementation: PortGuard integrates with NAT to allow external clients to access internal services in the RFC 1918 address space through SPA.
Advantages: Supports complex network topologies, suitable for hybrid cloud and multi-tenant environments.
Example: Run fwknopd on AWS EC2 instances, dynamically open the MySQL port (3306) for authorized users to access.
3.3 Defend Against Port Scanning and Brute Force
Scenario: Servers face port scanning (e.g., Nmap) or brute force attacks, and need to hide service ports to reduce the attack surface.
Implementation: PortGuard maintains the default drop firewall policy, only opening ports after receiving valid SPA data packets.
Advantages: Even if there are unpatched vulnerabilities, attackers cannot discover service ports.
Example: Prevent SSH brute force, fwknop only opens ports after verifying HMAC.
3.4 Support Multiple Service Protection
Scenario: Enterprises need to protect multiple services (e.g., SSH, RDP, VPN, database) but do not want all ports to be open all the time.
Implementation: fwknop supports defining multiple services and ports in access.conf, and the client can specify the target protocol and port.
Advantages: Flexible rule configuration, support custom timeout and port open strategies.
Example: Configure fwknop to protect both SSH (tcp/22) and OpenVPN (udp/1194).
3.5 Embedded or IoT Device Security
Scenario: IoT devices or embedded systems need remote management, but the device resources are limited and vulnerable to attacks.
Implementation: Run lightweight fwknopd or tnokd on resource-constrained devices, control access through SPA or TOTP.
Advantages: Low resource consumption, suitable for small devices.
Example: Protect the Web service running on Raspberry Pi.
3.6 Third-Party Device Integration
Scenario: Need to integrate with devices that do not support native fwknop (e.g., Cisco routers), control firewall rules.
Implementation: The command open/close cycle (command open/close cycle) feature of fwknop allows executing custom scripts to dynamically modify the ACL of third-party devices.
Advantages: Extensible, support non-standard firewall devices.
Example: Run fwknopd on Linux servers, update the ACL of Cisco routers through SSH.
3.7 Technical Details
- fwknop supports defining timeout (CMD_CYCLE_TIMER), port open automatically closed, reducing exposure time.
- Can be combined with VPN (e.g., WireGuard, OpenVPN) to build a secure private network.
- Supports X-Forwarded-For header parsing, suitable for SPA in HTTP environment.
4. How Secure is PortGuard?
PortGuard's security is primarily dependent on the single-packet authorization (SPA) mechanism of fwknop, combined with encryption, authentication, and firewall integration, providing multi-layered protection. The following is a detailed analysis of security:
4.1 Encryption and Authentication
Encryption: fwknop supports Rijndael (AES) symmetric encryption or GnuPG asymmetric encryption, and the SPA data packet content cannot be directly parsed.
Authentication: Use HMAC-SHA256 (default) or higher versions for data packet authentication, ensuring data integrity and source trust.
Security: Prevent man-in-the-middle (MITM) and replay attacks, HMAC applied after encryption, resisting CBC mode padding oracle attacks (e.g., Vaudenay attacks).
Limitations: Symmetric encryption requires client and server shared keys, improper key management may lead to leakage; GnuPG mode requires maintaining key rings,
4.2 Prevent Port Scanning
Mechanism: PortGuard uses the default drop firewall policy, and the service port is invisible when not authorized, so Nmap and other tools cannot detect it.
Security: Significantly reduces the attack surface, even if there are zero-day vulnerabilities, attackers cannot locate the service port.
Limitations: If the knock data packet is sniffed (traditional port knocking is more susceptible to this), attackers may attempt replay (SPA has solved this problem through HMAC).
4.3 Resist Brute Force
Mechanism: SPA data packets need to be correctly encrypted and HMAC authenticated, brute force is almost impossible (data packets with failed HMAC are discarded directly).
Security: Compared to traditional port knocking, SPA's single-packet design and encryption mechanism significantly improve the ability to resist brute force.
Limitations: Configuration errors (e.g., weak keys or disabled HMAC) may reduce security.
✨ Features




People ❤️ Fwknop

John

Michael

James

David

Olivia

William