Skip to content

Instantly share code, notes, and snippets.

@cpretzer
Created August 27, 2020 18:44
Show Gist options
  • Save cpretzer/037c2bf697c680d6304f4002c5d61f9e to your computer and use it in GitHub Desktop.
Save cpretzer/037c2bf697c680d6304f4002c5d61f9e to your computer and use it in GitHub Desktop.
2020/08/27 18:37:03 Tracing this script execution as [1598553423]
2020/08/27 18:37:03 State of iptables rules before run:
2020/08/27 18:37:03 > iptables -t nat -vnL
2020/08/27 18:37:03 < Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
2020/08/27 18:37:03 > iptables -t nat -F PROXY_INIT_REDIRECT
2020/08/27 18:37:03 < iptables: No chain/target/match by that name.
2020/08/27 18:37:03 > iptables -t nat -X PROXY_INIT_REDIRECT
2020/08/27 18:37:04 < iptables: No chain/target/match by that name.
2020/08/27 18:37:04 Will ignore port(s) [4190 4191] on chain PROXY_INIT_REDIRECT
2020/08/27 18:37:04 Will redirect all INPUT ports to proxy
2020/08/27 18:37:04 > iptables -t nat -F PROXY_INIT_OUTPUT
2020/08/27 18:37:04 < iptables: No chain/target/match by that name.
2020/08/27 18:37:04 > iptables -t nat -X PROXY_INIT_OUTPUT
2020/08/27 18:37:04 < iptables: No chain/target/match by that name.
2020/08/27 18:37:04 Ignoring uid 65535
2020/08/27 18:37:04 Redirecting all OUTPUT to 4140
2020/08/27 18:37:04 Executing commands:
2020/08/27 18:37:04 > iptables -t nat -N PROXY_INIT_REDIRECT -m comment --comment proxy-init/redirect-common-chain/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_REDIRECT -p tcp --match multiport --dports 4190,4191 -j RETURN -m comment --comment proxy-init/ignore-port-4190,4191/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_REDIRECT -p tcp -j REDIRECT --to-port 4143 -m comment --comment proxy-init/redirect-all-incoming-to-proxy-port/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PREROUTING -j PROXY_INIT_REDIRECT -m comment --comment proxy-init/install-proxy-init-prerouting/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -N PROXY_INIT_OUTPUT -m comment --comment proxy-init/redirect-common-chain/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_OUTPUT -m owner --uid-owner 65535 -o lo ! -d 127.0.0.1/32 -j PROXY_INIT_REDIRECT -m comment --comment proxy-init/redirect-non-loopback-local-traffic/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_OUTPUT -m owner --uid-owner 65535 -j RETURN -m comment --comment proxy-init/ignore-proxy-user-id/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_OUTPUT -o lo -j RETURN -m comment --comment proxy-init/ignore-loopback/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A PROXY_INIT_OUTPUT -p tcp -j REDIRECT --to-port 4140 -m comment --comment proxy-init/redirect-all-outgoing-to-proxy-port/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -A OUTPUT -j PROXY_INIT_OUTPUT -m comment --comment proxy-init/install-proxy-init-output/1598553423
2020/08/27 18:37:04 <
2020/08/27 18:37:04 > iptables -t nat -vnL
2020/08/27 18:37:04 < Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 PROXY_INIT_REDIRECT all -- * * 0.0.0.0/0 0.0.0.0/0 /* proxy-init/install-proxy-init-prerouting/1598553423 */
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 PROXY_INIT_OUTPUT all -- * * 0.0.0.0/0 0.0.0.0/0 /* proxy-init/install-proxy-init-output/1598553423 */
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain PROXY_INIT_OUTPUT (1 references)
pkts bytes target prot opt in out source destination
0 0 PROXY_INIT_REDIRECT all -- * lo 0.0.0.0/0 !127.0.0.1 owner UID match 65535 /* proxy-init/redirect-non-loopback-local-traffic/1598553423 */
0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0 owner UID match 65535 /* proxy-init/ignore-proxy-user-id/1598553423 */
0 0 RETURN all -- * lo 0.0.0.0/0 0.0.0.0/0 /* proxy-init/ignore-loopback/1598553423 */
0 0 REDIRECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 /* proxy-init/redirect-all-outgoing-to-proxy-port/1598553423 */ redir ports 4140
Chain PROXY_INIT_REDIRECT (2 references)
pkts bytes target prot opt in out source destination
0 0 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 4190,4191 /* proxy-init/ignore-port-4190,4191/1598553423 */
0 0 REDIRECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 /* proxy-init/redirect-all-incoming-to-proxy-port/1598553423 */ redir ports 4143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment