-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{ | ||
"nftables": [ | ||
{ | ||
"metainfo": { | ||
"version": "1.0.9", | ||
"release_name": "Old Doc Yak #3", | ||
"json_schema_version": 1 | ||
} | ||
}, | ||
{ | ||
"table": { | ||
"family": "inet", | ||
"name": "filter", | ||
"handle": 1 | ||
} | ||
}, | ||
{ | ||
"chain": { | ||
"family": "inet", | ||
"table": "filter", | ||
"name": "tproxy_ipv4", | ||
"handle": 1 | ||
} | ||
}, | ||
{ | ||
"chain": { | ||
"family": "inet", | ||
"table": "filter", | ||
"name": "tproxy_ipv6", | ||
"handle": 2 | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "filter", | ||
"chain": "tproxy_ipv4", | ||
"handle": 3, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"meta": { | ||
"key": "l4proto" | ||
} | ||
}, | ||
"right": "tcp" | ||
} | ||
}, | ||
{ | ||
"tproxy": { | ||
"family": "ip", | ||
"addr": "127.0.0.1", | ||
"port": 12345 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "filter", | ||
"chain": "tproxy_ipv4", | ||
"handle": 4, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"meta": { | ||
"key": "l4proto" | ||
} | ||
}, | ||
"right": "tcp" | ||
} | ||
}, | ||
{ | ||
"tproxy": { | ||
"family": "ip", | ||
"port": 12345 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "filter", | ||
"chain": "tproxy_ipv6", | ||
"handle": 5, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"meta": { | ||
"key": "l4proto" | ||
} | ||
}, | ||
"right": "tcp" | ||
} | ||
}, | ||
{ | ||
"tproxy": { | ||
"family": "ip6", | ||
"addr": "::1", | ||
"port": 12345 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"rule": { | ||
"family": "inet", | ||
"table": "filter", | ||
"chain": "tproxy_ipv6", | ||
"handle": 6, | ||
"expr": [ | ||
{ | ||
"match": { | ||
"op": "==", | ||
"left": { | ||
"meta": { | ||
"key": "l4proto" | ||
} | ||
}, | ||
"right": "tcp" | ||
} | ||
}, | ||
{ | ||
"tproxy": { | ||
"family": "ip6", | ||
"port": 12345 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/sbin/nft -f | ||
|
||
flush ruleset | ||
|
||
table inet filter { | ||
|
||
chain tproxy_ipv4 { | ||
meta l4proto tcp tproxy ip to 127.0.0.1:12345 | ||
meta l4proto tcp tproxy ip to :12345 | ||
} | ||
|
||
chain tproxy_ipv6 { | ||
meta l4proto tcp tproxy ip6 to [::1]:12345 | ||
meta l4proto tcp tproxy ip6 to :12345 | ||
} | ||
} |