1

Temat: httptunnel przez ssh: Write failed: Broken pipe

Chce zrobic tunel httptunnel z routerem z OpenWRT pelniacym role serwera. Robie tak:

$ hts -F localhost:22 80

netstati i fw pokazuje ze port 80 i 22 jest dostepny dla WAN i ze chodzi na nich po jednej usludze:


    $ 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

/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

Na ubuntu robie tak:

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

Niestety, kiedy probuje uzyc mojego nowiutkiego tunelu dostaje po ryju od ssh:

    $ 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

Samo polaczenie jest b. wolne. ssh informuje, ze "Connection established." a kilka linii ponizej "Write failed: Broken pipe". Na OpenWRT w logach mam:

    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

A na ubuntu tak:

    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

Co robie zle?

2

Odp: httptunnel przez ssh: Write failed: Broken pipe

W sumie to przeczytałem jedynie tytuł tematu i pierwsze zdanie i strzelam, ale może wiem co chcesz osiągnąć.
Też korzystam z tunelowania ruchu przez mój serwerek openwrt, ale robię to w inny sposób. Uzywam do tunelowania ruchu http z przeglądarki SOCKS proxy. Nie trzeba nic instalowac na routerze, nic konfigurować. Wystarczy skonfigurowany dostęp SSH. Pod windowsem uzywam putty i po zalogowaniu na serwer ustawiam tunel typu "dynamic" na wybranym porcie (np. 8080) i przeglądarkę ustaiwam na proxy localhost:8080. Od tej pory cały ruch z przegladarki idzie na serwerek openwrt.

3

Odp: httptunnel przez ssh: Write failed: Broken pipe

Z SOCKS korzystam kiedy sie da. Niestety teraz trafilo mi sie takie dranstwo ktore:

1) nie puszcza ssh na porcie 22
2) nie puszcza ssh na porcie 443
3) nie puszcza ssh przez corkscrew

Jeszcze nigdy nie mialem takiego ciezkiego przypadku, zazwyczaj jeden z mykow 1-3 rozwiazywal sprawe, teraz nie.

4

Odp: httptunnel przez ssh: Write failed: Broken pipe

Kiedyś też miałem podobnie ciężki przypadek. Musiałem przestawić na serwerku ssh na port 80.

5

Odp: httptunnel przez ssh: Write failed: Broken pipe

No oczywiscie zapomnialem wspomniec, ze na porcie 80 tez nie puszcza.

Hmm, teraz zrobilem w domu tak jak robilem w robocie i wyszlo - to cholerstwo musi cos jeszcze wyprawiac, cos jeszcze blokowac. Moze ktos mnie chociaz naprowadzi na wlasciwy tor?

6

Odp: httptunnel przez ssh: Write failed: Broken pipe

To dziwne, ale tunel chodzi przez port 443. Mozliwe jest ze to UPC jakos blokuje forwarding z portu 80 na 22? Mam taki bialy modem Thomson, moze w nim cos pokrecone jest. Mozliwe?

7

Odp: httptunnel przez ssh: Write failed: Broken pipe

Z sprzętem od UPC jest możliwe wszystko

RB760iGS + RB260GS / Ryzen 5 2660 / 16G DDR4 / MiniITX - Inea 1G (https://i.imgur.com/TLbJVDw.png)
RB951-2HnD / Celeron J1900 / 4G DDR3 / MiniITX - Satpol 100M