TCP & SSH Tunneling Core
Forward any TCP protocol — SSH, databases, RDP, custom protocols — over nfltr's outgoing TLS connection to the relay. Access remote machines via SSH, or forward any port to your machine.
Tutorials: SSH to a machine behind NAT · Reach a private LAN · Diagnose connection problems
How TCP Tunneling Works
Each machine makes one outgoing TLS connection to the relay (TCP by default, gRPC as a fallback). The agent connects to a local TCP port (e.g., SSH port 22) and carries each connection as a session over it; a session moves to a direct UDP path when both ends ask for it and their networks allow, and back to the relay when that path fails. The machine that has the service runs nfltr serve, which names the service; the other side runs nfltr forward to establish a local listener that forwards to it.
SSH Tunneling — Two Ways
With --forward localhost:22 the target machine needs its own SSH server (e.g. sshd) on that port; the NFLTR agent proxies its traffic. nfltr serve ssh --ssh serves an embedded SSH server instead (keys only; the machine must be enrolled in your organisation: nfltr machines add on the issuer's machine, then nfltr join on this one).
1. Embedded SSH server and nfltr ssh
No sshd needed: the remote machine serves nfltr's embedded SSH server, and nfltr ssh connects to it from an enrolled machine:
# On the remote machine (enrolled)
nfltr serve ssh --ssh --agent raspberry-pi
# On your laptop (enrolled)
nfltr ssh pi@raspberry-pi/ssh
2. Your own sshd and plain ssh
Use NFLTR as an SSH ProxyCommand in front of the machine's own sshd. This integrates seamlessly with your existing SSH configuration — agent forwarding, keys, configs all work normally:
# On the remote machine
nfltr serve ssh --forward localhost:22 --agent raspberry-pi # SSH encrypts end to end itself
# On your laptop — connect via native SSH
ssh -o ProxyCommand="nfltr pipe --plain %h/ssh" pi@raspberry-pi
3. Port Forwarding
Forward any remote TCP port to a local port on your machine:
# On the remote server
nfltr serve pg --forward localhost:5432 --agent db-server --e2ee
# On your laptop — PostgreSQL appears on localhost:5432
nfltr forward db-server/pg --listen :5432
psql -h localhost -p 5432 -U myuser mydb
Supported Protocols
| Protocol | Remote Command | Local Access |
|---|---|---|
| SSH (embedded server) | nfltr serve ssh --ssh --agent myhost | nfltr ssh user@myhost/ssh |
| SSH (your sshd) | nfltr serve ssh --forward localhost:22 --agent myhost | ssh -o ProxyCommand="nfltr pipe --plain %h/ssh" user@myhost |
| PostgreSQL | nfltr serve pg --forward localhost:5432 --agent db --e2ee | nfltr forward db/pg --listen :5432 |
| MySQL | nfltr serve mysql --forward localhost:3306 --agent mysql --e2ee | nfltr forward mysql/mysql --listen :3306 |
| Redis | nfltr serve redis --forward localhost:6379 --agent redis --e2ee | nfltr forward redis/redis --listen :6379 |
| RDP | nfltr serve rdp --forward localhost:3389 --agent desktop --e2ee | nfltr forward desktop/rdp --listen :3389 |
| Kubernetes API | nfltr serve api --forward localhost:6443 --agent k8s --e2ee | nfltr forward k8s/api --listen :6443 |
| Any TCP | nfltr serve svc --forward localhost:<port> --e2ee | nfltr forward <where>/svc --listen :<port> |
SSH Config Integration
Add NFLTR as a permanent SSH proxy for specific hosts in ~/.ssh/config:
# ~/.ssh/config
Host raspberry-pi
HostName raspberry-pi
User pi
ProxyCommand nfltr pipe --plain %h/ssh
Host office-server
HostName office-server
User admin
ProxyCommand nfltr pipe --plain %h/ssh
Now ssh raspberry-pi works from anywhere — no VPN, no port forwarding.
End-to-End Encryption (E2EE)
A service served with --e2ee is end-to-end encrypted in organisation mode: the NFLTR server only relays opaque ciphertext and never sees your plaintext traffic. Without --e2ee the sessions are plain to the relay.
Default Behaviour
E2EE works in organisation mode: both machines are enrolled in your organisation (nfltr machines add on the issuer's machine, then nfltr join on the new one; see the organisation enrolment guide), the agent serves with --e2ee, your organisation's access rules (nfltr access allow, signed by your root) say who may connect, and each side checks the other's organisation certificate. The relay holds neither key. An enrolled client opens organisation-mode sessions by default; a machine that is not enrolled is refused (exit 4, ERROR_REASON_E2EE_REQUIRED), and a machine no access rule admits gets exit 10 (e2ee_client_refused).
# Agent side (an enrolled machine named my-db)
nfltr serve pg --forward localhost:5432 --agent my-db --e2ee
# Once, on your root's machine: group ops may use pg on my-db
nfltr access allow ops my-db/pg
# Client side (an enrolled machine in group ops)
nfltr forward my-db/pg --listen :5432
psql -h localhost -p 5432 -U myuser mydb
Plain services
If your protocol already handles its own encryption (e.g., SSH), serve it without --e2ee; the sessions are then plain to the relay, and clients reach the service with --plain:
nfltr serve ssh --forward localhost:22 --agent my-ssh
Security
- End-to-end encryption — A service served with
--e2eetakes only end-to-end encrypted sessions; the server never sees their plaintext - Encrypted transport — Traffic to and from the relay is additionally carried in each machine's TLS connection
- Authentication required — Both sides must authenticate with their machine certificate
- No exposed ports — The agent connects outbound; no inbound ports are opened
Since NFLTR acts as a transparent TCP proxy, scp and sftp work with the same ProxyCommand.
Ready to tunnel TCP?
Forward SSH, databases, or any TCP protocol in seconds.
Install the CLI Dashboard →