Skip to content

outp1/transparent-proxy-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Transparent proxy configurator for specified domains via dnsmasq + ipset + redsocks

Requirements:

  • yay explicitly installed (TODO: make this optional for non-Arch users)

NOTE: if you are not arch-linux user you can just install dnsmasq, ipset, redsocks by yourself.

Files:

  • scripts/env.sh: sources ~/.socks_proxy (preferred) and exports proxy vars
  • configs/domains.txt: list of domains to proxy (one per line, supports comments with #)
  • configs/dnsmasq-openai.conf: dnsmasq rules to populate ipset 'openai' and 'openai6' (generated from domains.txt)
  • configs/redsocks.conf: redsocks config bound on 127.0.0.1:12345 using HTTP CONNECT to your proxy
  • configs/redsocks.conf.template: template for redsocks config
  • scripts/iptables-apply.sh: apply iptables/ip6tables rules
  • scripts/iptables-clear.sh: clear the rules
  • scripts/install_and_enable.sh: install packages, copy configs to /etc, enable services
  • scripts/openai-proxy-apply-domains.sh: apply domain changes and reload dnsmasq (TODO: may not be working)
  • scripts/render_dnsmasq_from_domains.sh: generate dnsmasq config from domains.txt
  • scripts/render_redsocks.sh: render redsocks config from template and env
  • scripts/test.sh: test script for proxy functionality

Usage:

  1. Edit configs/domains.txt to list domains to proxy.
  2. Provide proxy:
    • SOCKS (recommended for transparent mode): create ~/.socks_proxy with one of: SOCKS5_PROXY="socks5://user:pass@host:port" (or SOCKS_PROXY/ALL_PROXY) or explicit vars: SOCKS_HOST=host SOCKS_PORT=port SOCKS_USER=user SOCKS_PASS=pass
    • HTTP fallback: set OPENAI_HTTP_PROXY in ~/.openai_env as before
  3. sudo -E ./scripts/install_and_enable.sh
  4. sudo -E ./scripts/iptables-apply.sh
  5. Test: Run ./scripts/test.sh or request domains you have listed
  6. Rollback: sudo ./scripts/iptables-clear.sh

Troubleshooting

Service is still rejecting your requests

  1. Check if your domains server's prioritized to local one. cat /etc/resolv.conf

  2. Check if your ipset populated with required services. ./scripts/test.sh dig host_name If no, run: ./scripts/openai-proxy-apply-domains.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages