0

I'm looking for a way to open a proxy server on Windows or Linux which is bound to a client of OpenVPN or L2TP or PPTP, so the user that is connecting to the proxy is gonna connect to the VPN server and the host (proxy server) whatever it's Linux or Windows shouldn't route any traffic to the VPN client excpet the ones coming and going from proxy side.

user <---> proxy server <---> openvpn client <----> internet

So far, I have found suggestions like: running ForceBindIP to bind freesshd to the TUN interface of the openvpn client and using putty to connect to freesshd and putty expose socks5, but it didn't work.

Any help is highly appreciated

P.S. I'm new to the linux world :)

3
  • have a look on redsocks.Tansparent TCP-to-proxy redirector Jan 21 at 14:54
  • @ZarehKasparian Thanks a lot sir, I've found this but IDK if it's gonna work or not with OpenVPN client. Would you be so kind to shed some light on it?
    – ehtku5
    Jan 21 at 17:44
  • you only have to set a routing for the vpn subnet. and don't set to use to redirect all traffic. then it's possible to access the proxy. but for only one user, a ssh port redirection will be easier
    – djdomi
    Jan 21 at 20:12

1 Answer 1

0

So I end up with using Dante as my socks proxy server and use the IP that the OpenVPN server assigned as it's external, and I can connect to the proxy and traffic will route through the OpenVPN but the problem is all my OS traffic is going through OpenVPN which I don't want I want only my socks traffic to go through that and OpenVPN only listen to it.

I used route-noexec and pull-filter ignore redirect-gateway and after testing them one by one the problem was that there was no traffic going through it from socks.

My /etc/danted.conf:

logoutput: /var/log/socks.log
internal: ens192 port = 1080
external: 172.25.0.10
clientmethod: none
socksmethod: none
user.privileged: root
user.notprivileged: nobody

client pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: error connect disconnect
}
client block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}
socks pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: error connect disconnect
}
socks block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}

systemctl status openvpn@dl19-T:

root@CaptainMarvel:~# systemctl status openvpn@dl19-T
● openvpn@dl19-T.service - OpenVPN connection to dl19-T
     Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-01-22 07:09:42 EST; 13s ago
       Docs: man:openvpn(8)
             https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
             https://community.openvpn.net/openvpn/wiki/HOWTO
   Main PID: 13527 (openvpn)
     Status: "Initialization Sequence Completed"
      Tasks: 1 (limit: 629145)
     Memory: 1.0M
        CPU: 33ms
     CGroup: /system.slice/system-openvpn.slice/openvpn@dl19-T.service
             └─13527 /usr/sbin/openvpn --daemon ovpn-dl19-T --status /run/openvpn/dl19-T.status 10 --cd /etc/openvpn --config /etc/openvpn/dl19-T.conf --writepid /run/openvpn/dl19-T.pid

Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: ROUTE_GATEWAY 192.168.11.111/255.255.255.0 IFACE=ens192 HWADDR=00:0c:29:2d:7f:1b
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: TUN/TAP device tun0 opened
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_iface_mtu_set: mtu 1500 for tun0
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_iface_up: set tun0 up
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_addr_v4_add: 172.25.0.10/24 dev tun0
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_route_v4_add: 87.248.155.111/32 via 192.168.11.111 dev [NULL] table 0 metric -1
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_route_v4_add: 0.0.0.0/1 via 172.25.0.1 dev [NULL] table 0 metric -1
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: net_route_v4_add: 128.0.0.0/1 via 172.25.0.1 dev [NULL] table 0 metric -1
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Jan 22 07:09:45 CaptainMarvel ovpn-dl19-T[13527]: Initialization Sequence Completed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.