1

I know similar question have been asked but none of them are explained thoroughly. I have setup a VPS and setup openvpn using https://github.com/Nyr/openvpn-install on tcp and port 443(I have access to limited open ports). Now I want to tunnel the openvpn traffic through ssh.I want to do so because the packets are filtered and any vpn related packets are removed on the network. I'm on a linux machine, can anyone explain me how to do so? What changes do I make to client.ovpn?

1

There's actually at least two ways to achieve this:

  • Request SSH to forward a local port to your OpenVPN instance, using ssh -L <local_port>:<remote_host>:<remote_port>. This feature is described on OpenSSH manpage
 -L [bind_address:]port:host:hostport
 -L [bind_address:]port:remote_socket
 -L local_socket:host:hostport
 -L local_socket:remote_socket
         Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given

host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.

  • Request OpenSSH to implement a SOCKS Proxy using ssh -D <local_port> and, then, request OpenVPN to use this proxy (using socks-proxy configuration directive on your openvpn.conf)

Even if technically similar, the first solution may generate warning/errors because OpenVPN will actually connect to localhost instead of the server's real FQDN (which may cause problems with certificate's CommonName attribute).

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.