Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to create httptunnel with OpenWRT router as the server. Unfortunately, it doesn't work. I do it this way:

router:

Start hts to redirect port 80 to 22:

$ hts -F localhost:22 80

netstat shows that there is exactly one program listening on port 80 and port 22:

$ netstat -lpten
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8200            0.0.0.0:*               LISTEN      18528/minidlna
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      15369/smbd
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      28596/hts
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      15361/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      603/sshd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      27930/sshd
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      15369/smbd

Both ports 80 and 22 are opened on firewall:

/etc/config/firewall:

config rule
        option src wan
        option dest_port 22
        option target ACCEPT
        option proto tcp

config rule
        option src wan
        ption dest_port 80
        option target ACCEPT
        option proto tcp

On ubuntu:

$ sudo htc --forward-port 6666 <PUBLIC_IP_ADDRES>:80

And this happens when I try to use my newly created tunnel (NoHostAuthenticationForLocalhost=yes option is taken from here http://nil.rpc1.org/blog/):

$ ssh -o NoHostAuthenticationForLocalhost=yes root@localhost -p 6666 -vvv
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/<USER>/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 6666.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/<USER>/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/<USER>/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/<USER>/.ssh/id_rsa-cert type -1
debug1: identity file /home/<USER>/.ssh/id_dsa type -1
debug1: identity file /home/<USER>/.ssh/id_dsa-cert type -1
debug1: identity file /home/<USER>/.ssh/id_ecdsa type -1
debug1: identity file /home/<USER>/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1
debug1: match: OpenSSH_6.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [localhost]:6666
debug3: load_hostkeys: loading entries for host "[localhost]:6666" from file "/home/<USER>/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
Write failed: Broken pipe

Connection is very slow, I wait a couple of minutes before "Write failed: Broken pipe" shows up. However, ssh says "Connection established" several lines before so I have no idea what's really going on here - it seems like I get disconnected after establishing connection due to exceeding certain timeout. I have "ServerAliveInterval 60" added in my /etc/ssh/ssh_config to no avail. On router side there is plenty of the following in /var/log/messages:

Oct 21 19:39:32 OpenWrt daemon.notice hts[29384]: couldn't accept connection: Success
Oct 21 19:39:32 OpenWrt daemon.notice hts[29384]: connection from <OUTSIDE_IP>:1136
Oct 21 19:39:42 OpenWrt daemon.err hts[29384]: tunnel_accept: poll timed out
Oct 21 19:39:42 OpenWrt daemon.err hts[29384]: tunnel_accept: in_fd = -1, out_fd = 5
Oct 21 19:39:42 OpenWrt daemon.notice hts[29384]: couldn't accept connection: Success
Oct 21 19:39:42 OpenWrt daemon.notice hts[29384]: connection from <OUTSIDE_IP>:57246
Oct 21 19:39:42 OpenWrt daemon.notice hts[29384]: connection from <OUTSIDE_IP>:60995
Oct 21 19:41:43 OpenWrt daemon.notice hts[29384]: disconnected from FIXME:hostname:port

On Ubuntu side however, I got this in /var/log/syslog:

Oct 21 19:35:32 AMDC689 htc[32137]: connected to <PUBLIC_IP_ADDRES>:80
Oct 21 19:41:25 AMDC689 htc[32137]: disconnected from <PUBLIC_IP_ADDRES>80

I am losing my head here :( I need this tunnel to access my home router with an external disk connected to access my backup in a very restricted environment. Can someone help me here?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.