@@ -97,7 +97,7 @@ telepath -f /etc/telepath/telepath.json
9797```
9898
9999## Define Config file
100- Config file is a JSON file which contains list of config. Here I have attached a sample config file-
100+ The configuration file is a JSON array of objects. Each object defines a tunnel.
101101
102102``` json
103103[
@@ -117,41 +117,94 @@ Config file is a JSON file which contains list of config. Here I have attached a
117117 "key" : " /etc/autossh/id_rsa" ,
118118 "passphrase" : " passphrase" ,
119119 "jump" : {
120- "host" : " jump-host -ip" ,
120+ "host" : " jump-1 -ip" ,
121121 "port" : 22 ,
122122 "username" : " user" ,
123123 "authType" : " KEY" ,
124124 "password" : " " ,
125125 "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" ,
147- "port" : 22 ,
148- "username" : " user" ,
149- "authType" : " KEY" ,
150- "password" : " " ,
151- "key" : " /etc/autossh/id_rsa" ,
152- "passphrase" : " passphrase"
126+ "passphrase" : " passphrase" ,
127+ "jump" : {
128+ "host" : " jump-2-ip" ,
129+ "port" : 22 ,
130+ "username" : " user" ,
131+ "authType" : " KEY" ,
132+ "password" : " " ,
133+ "key" : " /etc/autossh/id_rsa" ,
134+ "passphrase" : " passphrase"
135+ }
153136 }
154137 }
155138 }
156139]
157140```
141+
142+ ### Fields Description
143+
144+ | Field | Type | Required | Description |
145+ | -----------------| ----------------| ----------| -----------------------------------------------------------------------------|
146+ | ` name ` | string | ✅ | Identifier for the tunnel. |
147+ | ` type ` | string | ✅ | Tunnel type: ` L ` for remote → local, ` R ` for local → remote. |
148+ | ` localPort ` | number | ✅ | Port on the local machine. |
149+ | ` localHost ` | string | ✅ | Local host IP or ` 0.0.0.0 ` to bind all interfaces. |
150+ | ` remotePort ` | number | ✅ | Port on the remote machine. |
151+ | ` remoteHost ` | string | ✅ | Remote host IP or ` 0.0.0.0 ` . |
152+ | ` server ` | object | ✅ | Final destination SSH server configuration. |
153+ | ` server.host ` | string | ✅ | SSH server IP or hostname. |
154+ | ` server.port ` | number | ✅ | SSH server port, usually 22. |
155+ | ` server.username ` | string | ✅ | SSH username. |
156+ | ` server.authType ` | string | ✅ | Authentication type: ` KEY ` or ` PASS ` . |
157+ | ` server.key ` | string | 🔹 | Path to SSH key file if ` authType ` is ` KEY ` . |
158+ | ` server.password ` | string | 🔹 | Password if ` authType ` is ` PASS ` . |
159+ | ` server.passphrase ` | string | 🔹 | Passphrase for the SSH key if required. |
160+ | ` server.jump ` | object/null | ❌ | Optional jump host configuration (recursive structure). |
161+
162+ > ** Note:** Jump hosts are optional and can be nested multiple times.
163+
164+ ### Tunnel Type
165+ - ** L (Local)** : Forwards traffic from ** remote → local**
166+ - ** R (Remote)** : Forwards traffic from ** local → remote**
167+
168+ ### Example Topology Diagram
169+ ``` mermaid
170+ flowchart LR
171+ A[Local Machine] -->|SSH Tunnel| J1[Jump Host 2]
172+ J1 --> J2[Jump Host 1]
173+ J2 --> S[Final SSH Server]
174+ S --> M[MongoDB:27017]
175+ ```
176+
177+ - ** A:** Your local machine
178+ - ** J1, J2:** Intermediate jump hosts
179+ - ** S:** Final SSH server
180+ - ** M:** MongoDB service running on the remote host
181+
182+ ### Simple Tunnel Diagram (No Jump Hosts)
183+ ``` mermaid
184+ flowchart LR
185+ L[Local Machine] -->|SSH Tunnel| F[Final Server]
186+ F --> D[Service:27017]
187+ ```
188+
189+ - ** L:** Local machine
190+ - ** F:** Final SSH server
191+ - ** D:** Remote service (MongoDB, PostgreSQL, etc.)
192+
193+ ### Authentication Flow
194+ 1 . ** KEY authentication**
195+ - Uses a private key (` key ` ) and optional ` passphrase ` .
196+ 2 . ** Password authentication**
197+ - Uses ` password ` field directly.
198+
199+ ``` mermaid
200+ flowchart TB
201+ LocalMachine --> SSHAuth[SSH Authentication]
202+ SSHAuth -->|KEY| PrivateKey["Key + Passphrase"]
203+ SSHAuth -->|PASS| Password["Password"]
204+ ```
205+
206+ ## Usage Notes
207+ - You can have multiple tunnels defined in the JSON array.
208+ - Jump hosts can be nested arbitrarily.
209+ - Each tunnel should have a unique ` name ` .
210+ - All ports and hosts are configurable to support complex network setups.
0 commit comments