SSH tunnel (Proxy) to VPN Provider

The following should do. It can also be done through LuCI, "System -> Software"

opkg update
opkg install pservice

The following is an example. Mind the quoting.

config pservice
	option name 'demo0'
	option respawn_maxfail 0
	option command /bin/sh
	list args -c
	list args 'exec /usr/bin/sshpass -p "Password" ssh -N -o UserKnownHostsFile=/root/known_hosts -L 192.168.1.1:5080:127.0.0.1:3128 USERNAME@SERVER'


Docs for each option are also available in the link provided.

Post output of
ps | grep ssh

root@OpenWrt:~# ps | grep ssh
22047 root       744 S    sshpass -p zzzzzzzzzzzz ssh -N -o UserKnownHostsFile
22048 root      3444 S    ssh -N -o UserKnownHostsFile=/root/known_hosts -L 19
22113 root      1120 S    grep ssh

OK, now try manually to kill like:

kill 22047
kill 22048

After that we'll write script.

1 Like

I have OpenWrt 19.07.1. Here is the output:

Unknown package 'pservice'.
Collected errors:
 * opkg_install_cmd: Cannot install package pservice.

This is unfortunate. At the moment you can try the following as stated in another thread. I will see if I can find time to do the backport.

1 Like

Thanks again for help @yousong.

Pservice works without any problems. Restart pservice configuration automatically when the http-proxy goes down?

Procd will bring it up according to respawn settings.

pservice is just a thin wrapper for adding random commands or scripts as procd service instances.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.