Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH over HTTP with ProxyTunnel "Socket read error: [104] Connection reset by peer"

Tags:

linux

ssh

apache

I am trying to connect to my SSH server over HTTP through my apache web server, I have followed the instructions in guides such as [1] and [2], The tunnel connects and for ~1 minute I get a SSH connection to my server.

However, there seems to be a 60 second timeout somewhere in the chain because I get the error Socket read error: [104] Connection reset by peer after about 60 seconds. This happends both when I run the ssh command as configured and when I run the proxytunnel command in isolation.

I have attempted to fix this issue by changing the ServerAliveInterval to 30 seconds and enabling TCPKeepAlive in the .ssh/config file, as well as putting a ProxyTimeout 3600 in the apache config, which I include below.

ProxyRequests On AllowConnect 22 ProxyTimeout 3600 <Proxy *> Order deny,allow Deny from all </Proxy> <ProxyMatch 127.0.0.1> Order deny,allow Allow from all </ProxyMatch>

Thanks for any help.

[1] http://dag.wiee.rs/howto/ssh-http-tunneling/

[2] http://blog.cppse.nl/apache-proxytunnel-ssh-tunnel

edit: I am running Apache 2.4

like image 730
cadair Avatar asked Sep 02 '14 12:09

cadair


1 Answers

As there was no exact question, here is how I fixed this problem for my servers (when I want to access it from any computer worldwide):

https://wiki.ubuntuusers.de/shellinabox/

The 'shell-in-a-box' emulates a ssh shell which can be called from any browser (I tested chrome and firefox).

Good install tutorial here:

http://www.tecmint.com/shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/

And don't forget to remove the '--localhost-only'

# if you want to restrict access to shellinaboxd from localhost only
SHELLINABOX_ARGS="--o-beep -s /:SSH:172.16.25.125 --localhost-only"

in the config file

/etc/default/shellinabox

in order to be able to access it from outside your network.

like image 198
SolvedForHome Avatar answered Nov 13 '22 14:11

SolvedForHome