SSH tunnel (Proxy) to VPN Provider

That was right again @ulmwind. I have now:

/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

But now I cannot connect to LuCI with a second browser via 192.168.1.1.

Should I activate something in the OpenWRT Firewall?

Sorry, what does it mean 'second' browser?

I am connected with Firefox (192.168.1.1:5080) to VPN Provider

I cannot connect to LuCI (192.168.1.1) with Chrome.

OK, it is interesting. Try to type:
http://192.168.1.1:80

Not possible.

And after stopping ssh connection works fine?

I connect to OpenWrt via PuTTY.

The following commands, for example, have no effect:

/etc/init.d/ssh-pp stop
/etc/init.d/ssh-pp disable
reboot

When I remove ssh-pp via SCP and reboot OpenWrt, then I have access again via chrome

OK, stopping we'll discuss later. You should kill process, or write kill command to stop section of file.

It is interesting, could you perform one experiment:
change port in /etc/config/uhttpd on something exotics, like 3000, reboot router, and try to connect to http://192.168.1.1:3000

I think it was a problem of start priority.

After I changed from START=30 to START=99 it worked.

#!/bin/sh /etc/rc.common
 
START=99

I'm trying your idea too.

I think pservice is worth a try here. It can be convenient for running single command or scripts under procd, without writing init scripts.

It comes with a sample uci config pservice.config

After changing to START=99, every start priority number works now. I can now connect to LuCI, but I can't reboot the router in LuCI, for example.

How can I write this kill command?

After changing to START=99, I can't go back to START=30, because now every start priority number works. I can no longer reproduce the issue.

I do not know how to install the package on OpenWrt.

Where should I enter the ssh command in the sample?

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.