Why Self-Host an SSH Bastion Host?
Every homelab, small team, and distributed infrastructure faces the same problem: you have dozens of servers, VMs, and containers spread across clouds and local networks, and you need secure, audited access to all of them. Opening SSH port 22 on every machine is a security nightmare. Managing individual SSH keys across a growing fleet becomes unsustainable. And when someone leaves the team, you’re manually revoking keys on every server.
A bastion host (also called a jump server or SSH gateway) solves all of this. It’s a single hardened entry point that sits between you and your infrastructure. All SSH connections flow through it, giving you:
- Centralized access control — one place to manage who can reach what
- Session recording and auditing — full transcripts of every command executed
- No direct SSH exposure — your backend servers never face the public internet
- Role-based permissions — developers get different access than operators
- Single sign-on — authenticate once, access everything
Commercial solutions like AWS Systems Manager Session Manager and ScaleFT exist, but they lock you into a vendor, charge per-node licensing fees, and send your session metadata to third-party servers. Self-hosted alternatives give you the same capabilities with full data sovereignty and zero per-node costs.
The Contenders: Teleport vs Guacamole vs Trisail
Three open-source projects dominate the self-hosted bastion space, each with a different philosophy.
Teleport (Gravitational)
Teleport is the most comprehensive option. It replaces SSH entirely with its own protocol built on top of SSH and TLS, adding identity-aware access, session recording, application proxying, kubernetes access, and database access — all through a single binary. It supports GitHub, OIDC, SAML, and local authentication.
Best for: Teams that want a unified access plane covering SSH, Kubernetes, databases, and web apps with strong audit requirements.
Apache Guacamole
Guacamole is a clientless remote desktop gateway. It supports SSH, RDP, VNC, and Kubernetes through a web browser — no client software needed. You connect to Guacamole’s web interface, select a connection, and get a terminal or desktop in your browser. It’s simpler than Teleport but covers more protocols.
Best for: Environments that need mixed SSH and remote desktop access through a single web portal, especially for less technical users.
Trisail (formerly ShellHub)
Trisail is a lightweight SSH gateway designed specifically for edge and IoT deployments. It uses a reverse-SSH model where agents on target machines initiate outbound connections to the gateway, meaning no firewall changes or port forwarding is required on the target side. It’s the simplest to deploy in network-restricted environments.
Best for: Homelab users and IoT/edge deployments where target machines are behind NAT or restrictive firewalls.
Feature Comparison
| Feature | Teleport | Apache Guacamole | Trisail |
|---|---|---|---|
| SSH access | Yes (native protocol) | Yes (via web terminal) | Yes (reverse SSH) |
| RDP / VNC | No | Yes | No |
| Kubernetes access | Yes (kubectl proxy) | Yes (web console) | No |
| Database access | Yes (PostgreSQL, MySQL, MongoDB) | No | No |
| Application proxy | Yes (HTTP/HTTPS) | No | No |
| Authentication | OIDC, SAML, GitHub, local | CAS, LDAP, SAML, Duo, TOTP | GitHub, SAML, local |
| RBAC | Full policy engine (YAML) | Connection-level permissions | Organization-based |
| Session recording | Yes (video + text) | Yes (video) | Yes (text only) |
| Audit log | Yes (structured events) | Yes (connection logs) | Yes (connection logs) |
| Hardware token (FIDO2) | Yes | Via SSO provider | No |
| Access requests | Yes (approval workflow) | No | No |
| Agent model | Teleport daemon on each node | Guacamole daemon (guacd) | Trisail agent on each node |
| Firewall requirements | Open proxy port on Teleport server | Open Guacamole web port | Only agents need outbound |
| Resource usage | Medium (~256MB RAM) | Low (~128MB RAM) | Low (~64MB RAM) |
| License | OSS (AGPL-3.0) + Enterprise | Apache 2.0 | Apache 2.0 |
| docker support | Official images | Official images | Official images |
Deployment Guide
1. Deploying Teleport
Teleport’s open-source edition (Community Edition) covers SSH access, session recording, RBAC, and OIDC authentication — everything most homelabs and small teams need.
Docker Compose Setup
Create docker-compose.yml:
| |
Teleport Configuration
Create config/teleport.yaml:
| |
Starting Teleport and Creating the First User
| |
Connecting a Target Node
On each server you want to manage, install the Teleport agent and join it to the cluster:
| |
Creating RBAC Rules
Teleport’s role engine is its standout feature. Create role-dev.yaml:
| |
Apply it:
| |
Now users with the developer role can SSH into staging nodes but are explicitly denied access to production — enforced at the protocol level, not just as a suggestion.
2. Deploying Apache Guacamole
Guacamole is ideal when you need both SSH terminal access and remote desktop (RDP/VNC) through a single web interface.
Docker Compose Setup
Guacamole requires three components: PostgreSQL (for connection storage), guacd (the daemon that handles protocols), and the Guacamole web application.
| |
Database Initialization
Guacamole’s Docker image includes a schema initialization script. Run it once before starting the service:
| |
Then start everything:
| |
Access Guacamole at http://your-server:8080/guacamole/. Default credentials are guacadmin / guacadmin — change this immediately.
Adding SSH Connections
Through the web interface:
- Log in as
guacadmin - Navigate to Settings → Connections → New Connection
- Configure the connection:
| |
Under Parameters → Authentication, select the password field or upload a private key for key-based authentication.
For parameterized connections that work across multiple hosts, use Connection Groups to organize servers by environment (staging, production, homelab) and apply connection-level permissions to user groups.
3. Deploying Trisail
Trisail’s reverse-SSH model is the simplest for homelab setups where target machines are behind NAT, CGNAT, or firewalls you cannot modify.
Docker Compose Setup
| |
Installing the Agent on Target Nodes
The agent connects outbound to your Trisail server, so no inbound ports need to be opened on target machines:
| |
Or via Docker on the target:
| |
The agent establishes a persistent reverse tunnel. You then connect through Trisail’s web UI or SSH proxy to reach any registered node — regardless of its network topology.
Choosing the Right Bastion Host
Choose Teleport when:
- You need SSH, Kubernetes, database, and web app access through one gateway
- Audit compliance requires detailed session recordings with search
- You want approval-based access requests (a developer requests production access, an admin approves)
- Your team uses OIDC/SAML identity providers and you want seamless SSO
- You need hardware security key (FIDO2) enforcement for admin accounts
Choose Apache Guacamole when:
- You need both SSH and remote desktop (RDP/VNC) access
- Users should connect through a browser with no client installation
- You have Windows servers alongside Linux machines
- Your team includes non-technical users who need simple point-and-click access
- You prefer Apache 2.0 licensing over AGPL
Choose Trisail when:
- Target machines are behind NAT, firewalls, or CGNAT (common in residential ISPs)
- You want the simplest possible deployment with minimal configuration
- You’re managing IoT devices, edge servers, or homelab nodes
- You need a lightweight solution with low resource overhead
- Your primary use case is SSH access with basic session logging
Security Best Practices for Self-Hosted Bastion Hosts
Regardless of which solution you choose, follow these hardening steps:
1. Put the Bastion Behind a Reverse Proxy
Never expose nginxastion’s management port directly. Use Caddy or Nginx with TLS:
| |
2. Enable Fail2Ban on the Bastion Host
| |
3. Restrict Bastion Host Access by IP
If your team works from known IP ranges, add a firewall rule:
| |
4. Rotate Credentials Regularly
Set up a cron job to rotate join tokens and service account passwords:
| |
5. Ship Audit Logs to Long-Term Storage
Bastion hosts are prime targets — if an attacker compromises the gateway and deletes logs, you lose all forensic evidence. Forward logs to a separate system:
| |
Migration from Direct SSH Access
If your servers currently allow direct SSH from the internet, migrate in phases:
- Phase 1: Deploy the bastion host and register all nodes as read-only (no access restrictions yet)
- Phase 2: Create user accounts and RBAC roles, test access through the bastion
- Phase 3: Remove direct SSH access from backend servers by updating firewall rules or
sshd_config(AllowUsersdirective to only accept connections from the bastion’s IP) - Phase 4: Enable session recording and review the first week of logs to catch permission gaps
| |
Summary
Self-hosted SSH bastion hosts eliminate the friction of managing SSH keys across dozens of servers while adding security features most teams don’t even know they need — session recording, RBAC, and SSO. Teleport leads in features and compliance readiness, Guacamole wins for mixed SSH/desktop environments, and Trisail is the simplest choice for NAT-heavy deployments.
All three run on a single $5 VPS, support Docker Compose deployment, and cost nothing in licensing. The only investment is the initial setup time, which pays for itself the first time you need to audit who accessed what, or onboard a new team member in two clicks instead of distributing SSH keys to twelve servers.
Frequently Asked Questions (FAQ)
Which one should I choose in 2026?
The best choice depends on your specific requirements:
- For beginners: Start with the simplest option that covers your core use case
- For production: Choose the solution with the most active community and documentation
- For teams: Look for collaboration features and user management
- For privacy: Prefer fully open-source, self-hosted options with no telemetry
Refer to the comparison table above for detailed feature breakdowns.
Can I migrate between these tools?
Most tools support data import/export. Always:
- Backup your current data
- Test the migration on a staging environment
- Check official migration guides in the documentation
Are there free versions available?
All tools in this guide offer free, open-source editions. Some also provide paid plans with additional features, priority support, or managed hosting.
How do I get started?
- Review the comparison table to identify your requirements
- Visit the official documentation (links provided above)
- Start with a Docker Compose setup for easy testing
- Join the community forums for troubleshooting