Score:0

OpenVPN, L2TP or PPTP client to proxy (http or socks 4/5)

sc flag

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 :)

Zareh Kasparian avatar
us flag
have a look on redsocks.Tansparent TCP-to-proxy redirector
ehtku5 avatar
sc flag
@ZarehKasparian Thanks a lot sir, I've found [this](https://linuxaria.com/article/redirect-all-tcp-traffic-through-transparent-socks5-proxy-in-linux) but IDK if it's gonna work or not with OpenVPN client. Would you be so kind to shed some light on it?
djdomi avatar
za flag
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
Score:0
sc flag

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
● [email protected] - OpenVPN connection to dl19-T
     Loaded: loaded (/lib/systemd/system/[email protected]; 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/[email protected]
             └─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
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.