@@ -96,8 +96,29 @@ telepath -h
9696telepath -f /etc/telepath/telepath.json
9797```
9898
99+ - Test tunnel configuration
100+ ``` sh
101+ telepath -f /etc/telepath/telepath.json --dry-run
102+ ```
103+
104+ ## Run using Docker compose
105+ You can run using docker compose and use it's internal network to access it.
106+ ``` yaml
107+ services :
108+ telepath :
109+ container_name : autossh
110+ image : ghcr.io/tech-thinker/telepath:latest
111+ networks :
112+ - telepath
113+ volumes :
114+ - ./myconfig:/etc/telepath
115+
116+ networks :
117+ telepath :
118+ ` ` `
119+
99120## Define Config file
100- Config file is a JSON file which contains list of config. Here I have attached a sample config file-
121+ The configuration file is a JSON array of objects. Each object defines a tunnel.
101122
102123` ` ` json
103124[
@@ -117,41 +138,94 @@ Config file is a JSON file which contains list of config. Here I have attached a
117138 " key " : " /etc/autossh/id_rsa" ,
118139 " passphrase " : " passphrase" ,
119140 " jump " : {
120- "host" : " jump-host-ip" ,
121- "port" : 22 ,
122- "username" : " user" ,
123- "authType" : " KEY" ,
124- "password" : " " ,
125- "key" : " /etc/autossh/id_rsa" ,
126- "passphrase" : " passphrase"
127- }
128- }
129- },
130- {
131- "name" : " mysql" ,
132- "type" : " R" ,
133- "localPort" : 3306 ,
134- "localHost" : " 0.0.0.0" ,
135- "remotePort" : 3306 ,
136- "remoteHost" : " 0.0.0.0" ,
137- "server" : {
138- "host" : " final-host-ip" ,
139- "port" : 22 ,
140- "username" : " user" ,
141- "authType" : " KEY" ,
142- "password" : " " ,
143- "key" : " /etc/autossh/id_rsa" ,
144- "passphrase" : " passphrase" ,
145- "jump" : {
146- "host" : " jump-host-ip" ,
141+ " host " : " jump-1-ip" ,
147142 " port " : 22,
148143 " username " : " user" ,
149144 " authType " : " KEY" ,
150145 " password " : " " ,
151146 " key " : " /etc/autossh/id_rsa" ,
152- "passphrase" : " passphrase"
147+ " passphrase " : " passphrase" ,
148+ " jump " : {
149+ " host " : " jump-2-ip" ,
150+ " port " : 22,
151+ " username " : " user" ,
152+ " authType " : " KEY" ,
153+ " password " : " " ,
154+ " key " : " /etc/autossh/id_rsa" ,
155+ " passphrase " : " passphrase"
156+ }
153157 }
154158 }
155159 }
156160]
157161```
162+
163+ ### Fields Description
164+
165+ | Field | Type | Required | Description |
166+ | -----------------| ----------------| ----------| -----------------------------------------------------------------------------|
167+ | ` name ` | string | ✅ | Identifier for the tunnel. |
168+ | ` type ` | string | ✅ | Tunnel type: ` L ` for remote → local, ` R ` for local → remote. |
169+ | ` localPort ` | number | ✅ | Port on the local machine. |
170+ | ` localHost ` | string | ✅ | Local host IP or ` 0.0.0.0 ` to bind all interfaces. |
171+ | ` remotePort ` | number | ✅ | Port on the remote machine. |
172+ | ` remoteHost ` | string | ✅ | Remote host IP or ` 0.0.0.0 ` . |
173+ | ` server ` | object | ✅ | Final destination SSH server configuration. |
174+ | ` server.host ` | string | ✅ | SSH server IP or hostname. |
175+ | ` server.port ` | number | ✅ | SSH server port, usually 22. |
176+ | ` server.username ` | string | ✅ | SSH username. |
177+ | ` server.authType ` | string | ✅ | Authentication type: ` KEY ` or ` PASS ` . |
178+ | ` server.key ` | string | 🔹 | Path to SSH key file if ` authType ` is ` KEY ` . |
179+ | ` server.password ` | string | 🔹 | Password if ` authType ` is ` PASS ` . |
180+ | ` server.passphrase ` | string | 🔹 | Passphrase for the SSH key if required. |
181+ | ` server.jump ` | object/null | ❌ | Optional jump host configuration (recursive structure). |
182+
183+ > ** Note:** Jump hosts are optional and can be nested multiple times.
184+
185+ ### Tunnel Type
186+ - ** L (Local)** : Forwards traffic from ** remote → local**
187+ - ** R (Remote)** : Forwards traffic from ** local → remote**
188+
189+ ### Example Topology Diagram
190+ ``` mermaid
191+ flowchart LR
192+ A[Local Machine] -->|SSH Tunnel| J1[Jump Host 2]
193+ J1 --> J2[Jump Host 1]
194+ J2 --> S[Final SSH Server]
195+ S --> M[MongoDB:27017]
196+ ```
197+
198+ - ** A:** Your local machine
199+ - ** J1, J2:** Intermediate jump hosts
200+ - ** S:** Final SSH server
201+ - ** M:** MongoDB service running on the remote host
202+
203+ ### Simple Tunnel Diagram (No Jump Hosts)
204+ ``` mermaid
205+ flowchart LR
206+ L[Local Machine] -->|SSH Tunnel| F[Final Server]
207+ F --> D[Service:27017]
208+ ```
209+
210+ - ** L:** Local machine
211+ - ** F:** Final SSH server
212+ - ** D:** Remote service (MongoDB, PostgreSQL, etc.)
213+
214+ ### Authentication Flow
215+ 1 . ** KEY authentication**
216+ - Uses a private key (` key ` ) and optional ` passphrase ` .
217+ 2 . ** Password authentication**
218+ - Uses ` password ` field directly.
219+
220+ ``` mermaid
221+ flowchart TB
222+ LocalMachine --> SSHAuth[SSH Authentication]
223+ SSHAuth -->|KEY| PrivateKey["Key + Passphrase"]
224+ SSHAuth -->|PASS| Password["Password"]
225+ ```
226+
227+ ## Usage Notes
228+ - You can have multiple tunnels defined in the JSON array.
229+ - Jump hosts can be nested arbitrarily.
230+ - Each tunnel should have a unique ` name ` .
231+ - All ports and hosts are configurable to support complex network setups.
0 commit comments