Skip to content

Commit

Permalink
Updated README and updated comments on the created routes to include …
Browse files Browse the repository at this point in the history
…specific prefix
  • Loading branch information
Lol3rrr committed Jul 15, 2023
1 parent 6b55acc commit 2046519
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# IPtables-Proxy
A Reverse Proxy utilizing IPtables to route the inoming packets to the correct end points.

## Intended Use-Case
This is intended to make it easier to expose services running behind a VPN, by easily allowing you to
forward external packets to a given address inside of the network.

## Example Setup
In this example we consider 3 Nodes involved, a Proxy, a Server and a Client.

The Proxy is running this software listening on some internal address.

The Server is connected to the Proxy over a VPN and is not reachable from the Client directly.
When the Server wants to expose some service running on it to the Client, it sends a corresponding
`Create` Request to `iptables-proxy` running on the Proxy, which will then setup the corresponding
iptables rules to forward external traffic to that service.

When the Client now sends some packets to the Proxy on the given IP+Port, the Packets get fowarded
to the Server using their VPN connection and all returning packets are also again forwarded to the Client
through the Proxy.

When the Server stops the Service it has exposed, the given Route can be removed by sending a corresponding
`Remove` Request to `iptables-proxy` running on the Proxy, which will delete the associated IPtables rules
and thereby stop forwarding packets.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl ForwardingRoute {
"-m".into(),
"comment".into(),
"--comment".into(),
"\"Accept to forward traffic\"".into(),
"\"[iptables-proxy] Accept to forward traffic\"".into(),
"-m".into(),
"tcp".into(),
"-p".into(),
Expand All @@ -53,7 +53,7 @@ impl ForwardingRoute {
"-m".into(),
"comment".into(),
"--comment".into(),
"\"Accept to forward return traffic\"".into(),
"\"[iptables-proxy] Accept to forward return traffic\"".into(),
"-s".into(),
format!("{}", self.dest_ip).into(),
"-m".into(),
Expand All @@ -79,7 +79,7 @@ impl ForwardingRoute {
"-m".into(),
"comment".into(),
"--comment".into(),
"\"redirect pkts to homeserver\"".into(),
"\"[iptables-proxy] redirect pkts to homeserver\"".into(),
"-j".into(),
"DNAT".into(),
"--to-destination".into(),
Expand Down

0 comments on commit 2046519

Please sign in to comment.