Skip to content

Instantly share code, notes, and snippets.

@n0toose
Last active March 12, 2021 15:21
Show Gist options
  • Save n0toose/1dff85946b1c75fa8650c32216368edf to your computer and use it in GitHub Desktop.
Save n0toose/1dff85946b1c75fa8650c32216368edf to your computer and use it in GitHub Desktop.
Expose a SOCKS proxy in a virtual machine that routes traffic through another VPN connection

Instructions

  • Install Debian (or your distro of choice) in a virtual machine.
  • Configure OpenVPN/Wireguard.
  • Install dante-server and paste the contents of danted.conf in /etc/danted.conf.
  • Make the appropriate changes to the aforementioned configuration file.
  • Run ip a and take note of the IP address of the virtual machine.
  • Run sudo systemctl enable --now danted.
  • Ensure that the proxy is functioning properly with sudo systemctl status danted.
  • If all went well, you should now be able to connect to your SOCKS5 proxy!

Use the IP address of the virtual machine and the port 1080 if you haven't modified the danted.conf file.

# Warning: Make sure that the virtual machine's network
# is ONLY accessible to your host machine. Otherwise,
# modify this configuration appropriately in order to
# not allow strangers to connect through the proxy.
#
# I am using this in a KVM virtual machine in order to
# route specific applications on my host machine to an
# internal VPN network.
#
# DO *NOT* USE AS-IS IN A CORPORATE ENVIRONMENT.
#
# If you do, make sure to use authentication and only
# allow specific IP ranges to connect to it, in order
# to decrease the attack surface.
logoutput: syslog
user.privileged: root
user.unprivileged: nobody
# "Where should the SOCKS server be exposed?"
internal: enp1s0 port=1080
# "Which interface should the SOCKS server route traffic to?"
#
# If you're using a Wireguard interface, you may want to use `wg0` instead.
# You can find out the available interfaces by running the command `ip a`
external: tun0
# Disables authentication.
socksmethod: none
clientmethod: none
# Allows *all* IP addresses to connect to the machine.
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment