Ghostunnel: Open-Source TLS Proxy With Mutual Auth

▼ Summary
– Ghostunnel is an open-source proxy that adds TLS capabilities to applications unable to handle encryption natively.
– It operates in server and client modes to enable mutual TLS authentication without modifying application code.
– The tool supports various certificate sources including hardware modules, system stores, and dynamic APIs like SPIFFE.
– Security defaults include localhost-only listening, Landlock sandboxing, and automatic certificate reloading for short-lived credentials.
– It provides a static binary with monitoring metrics and socket activation support across multiple operating systems.
Ghostunnel serves as a lightweight, open-source TLS proxy, designed to secure communication for applications that lack native support for encrypted connections. By operating independently of the primary application logic, it offloads the complexity of certificate management and encryption, allowing legacy or simple services to communicate securely over standard protocols.
The tool functions in two distinct modes: server and client. In server mode, Ghostunnel acts as a front-end guard. It accepts incoming TLS connections, validates the client’s identity through certificate checks, and then forwards the traffic to the backend service via TCP or a UNIX socket. Conversely, in client mode, it listens for unencrypted local requests, wraps them in TLS, and presents a client certificate to the remote endpoint. Deploying instances at both ends ensures mutual authentication while the underlying applications continue to exchange data in plaintext, effectively bridging the gap between modern security standards and older infrastructure.
Identity Verification and Policy Control
Access control is strict and configurable. The proxy will not initiate unless an administrator defines who is permitted to connect. This involves selecting at least one verification method, which can include matching the common name, organizational unit, specific DNS or URI names within the certificate, or verifying against a public key pin. These criteria are evaluated using an OR logic, meaning any single match grants access.
For more granular control, Ghostunnel supports SPIFFE IDs and integrates with the Open Policy Agent (OPA). This allows administrators to write complex authorization policies that can be reloaded dynamically without restarting the tunnel process. This flexibility ensures that security rules can evolve alongside operational requirements.
Certificate Management and Security Defaults
Certificate sources are diverse, supporting PEM and PKCS#12 files, the macOS Keychain, Windows Certificate Store, and hardware modules like YubiKey via PKCS#11. In server mode, it can also fetch certificates from Let’s Encrypt using the ACME protocol. A critical feature is automatic reloading triggered by SIGHUP signals or timers, enabling the use of short-lived credentials. When a certificate rotates, the proxy seamlessly adopts the new one without requiring a service restart.
Security defaults are rigorous. By default, Ghostunnel refuses to listen on external interfaces or target non-local endpoints unless explicitly overridden with the `–unsafe-listen` or `–unsafe-target` flags. On Linux systems, it employs Landlock sandboxing to restrict system calls, enhancing resilience against exploits. Additionally, a status port provides JSON output and Prometheus metrics, ensuring visibility for existing monitoring stacks.
Deployment and Availability
Delivered as a single static Go binary, Ghostunnel eliminates runtime dependency issues. It compiles for Linux, macOS, Windows, and BSD variants, and is released under the permissive Apache 2.0 license. For containerized or managed environments, it supports systemd and launchd socket activation, along with the PROXY protocol v2 to preserve original connection metadata for backends. The software is freely available for download on GitHub, offering a robust solution for implementing mutual TLS across heterogeneous systems.
(Source: Help Net Security)



