You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User for HTTP proxy (basic auth). This flag invokes prompt for password (not echoed to terminal)
113
+
User for HTTP proxy (basic auth). This flag invokes prompt for password (not echoed to terminal)
107
114
-c string
108
-
Path to certificate PEM encoded file
109
-
-dShow logs in DEBUG mode
115
+
Path to certificate PEM encoded file
116
+
-dShow logs in DEBUG mode
110
117
-f string
111
-
Path to server configuration file in YAML format
112
-
-jShow logs in JSON format
118
+
Path to server configuration file in YAML format
119
+
-jShow logs in JSON format
113
120
-k string
114
-
Path to private key PEM encoded file
121
+
Path to private key PEM encoded file
115
122
-l string
116
-
Address of HTTP proxy server (default "127.0.0.1:8080")
123
+
Address of HTTP proxy server (default "127.0.0.1:8080")
117
124
-s string
118
-
Address of SOCKS5 proxy server (default "127.0.0.1:1080")
125
+
Address of SOCKS5 proxy server (default "127.0.0.1:1080")
126
+
-t string
127
+
Address of transparent proxy server (it starts along with HTTP proxy server)
119
128
-u string
120
-
User for SOCKS5 proxy authentication. This flag invokes prompt for password (not echoed to terminal)
121
-
-vprint version
129
+
User for SOCKS5 proxy authentication. This flag invokes prompt for password (not echoed to terminal)
130
+
-vprint version
122
131
```
123
132
124
-
## Example
125
-
126
133
### Configuration via CLI flags
127
134
128
135
```shell
@@ -217,6 +224,152 @@ server:
217
224
218
225
To learn more about proxy chains visit [Proxychains Github](https://github.com/rofl0r/proxychains-ng)
219
226
227
+
## Transparent proxy
228
+
229
+
> Also known as an `intercepting proxy`, `inline proxy`, or `forced proxy`, a transparent proxy intercepts normal application layer communication without requiring any special client configuration. Clients need not be aware of the existence of the proxy. A transparent proxy is normally located between the client and the Internet, with the proxy performing some of the functions of a gateway or router
This functionality available only on Linux systems and requires additional setup (`iptables`, ip route, etc)
234
+
235
+
`-T address`flag specifies the address of transparent proxy server (`GoHPTS` will be running without HTTP server).
236
+
237
+
`-t address`flag specifies the address of transparent proxy server (`HTTP` proxy and other functionality stays the same).
238
+
239
+
In other words, `-T` spins up a single server, but `-t` two servers, `http` and `tcp`.
240
+
241
+
There are two modes `redirect` and `tproxy` that can be specified with `-M` flag
242
+
243
+
## `redirect` (via _NAT_ and _SO_ORIGINAL_DST_)
244
+
245
+
In this mode proxying happens with `iptables` `nat` table and `REDIRECT` target. Host of incoming packet changes to the address of running `redirect` transparent proxy, but it also contains original destination that can be retrieved with `getsockopt(SO_ORIGINAL_DST)`
246
+
247
+
To run `GoHPTS` in this mode you use `-t` or `-T` flags with `-M redirect`
248
+
249
+
### Example
250
+
251
+
```shell
252
+
# run the proxy
253
+
gohpts -s 1080 -t 1090 -M redirect -d
254
+
```
255
+
256
+
```shell
257
+
# run socks5 server on 127.0.0.1:1080
258
+
ssh remote -D 1080 -Nf
259
+
```
260
+
261
+
Setup your operating system:
262
+
263
+
```shell
264
+
# commands below require elevated privileges (you can run it with `sudo -i`)
265
+
266
+
#enable ip forwarding
267
+
sysctl -w net.ipv4.ip_forward=1
268
+
269
+
# create `GOHPTS` nat chain
270
+
iptables -t nat -N GOHPTS
271
+
272
+
# set no redirection rules for local, http proxy, ssh and redirect procy itself
273
+
iptables -t nat -A GOHPTS -d 127.0.0.0/8 -j RETURN
In this mode proxying happens with `iptables``mangle` table and `TPROXY` target. Transparent proxy sees destination address as is, it is not being rewrited by the kernel. For this to work the proxy binds with socket option `IP_TRANSPARENT`, `iptables` intercepts traffic using TPROXY target, routing rules tell marked packets to go to the local proxy without changing their original destination.
313
+
314
+
This mode requires elevated privileges to run `GoHPTS`. You can do that by running the follwing command:
315
+
316
+
```shell
317
+
sudo setcap 'cap_net_admin+ep'~/go/bin/gohpts
318
+
```
319
+
320
+
To run `GoHPTS` in this mode you use `-t` or `-T` flags with `-M tproxy`
321
+
322
+
### Example
323
+
324
+
```shell
325
+
# run the proxy
326
+
gohpts -s 1080 -T 0.0.0.0:1090 -M tproxy -d
327
+
```
328
+
329
+
```shell
330
+
# run socks5 server on 127.0.0.1:1080
331
+
ssh remote -D 1080 -Nf
332
+
```
333
+
334
+
Setup your operating system:
335
+
336
+
```shell
337
+
ip netns exec ns-client ip route add default via 10.0.0.1
0 commit comments