Open m2acgi opened 1 year ago
You can use -H
option to specify HTTP header. e.g. -H "Authorization: Basic am9objoxMjM0"
Not work, it says ↑ 0B ( 0B/s) | ↓ 0B ( 0B/s)2024/05/28 09:45:30 [ERR] yamux: Failed to read header: invalid content-type:
, test on Windows 10 + go-piping-tunnel v0.11.0
Did you use only piping-tunnel
on both server-host and client-host or a different tool?
Both server and client are piping-tunnel
I tried it but it worked.
edit: I may drop Content-Type checking in yamux. https://github.com/nwtgck/go-piping-tunnel/blob/add2e220369ee8b36040b9c5de6ebd9755b54063/cmd/client/client.go#L238
In my environment, the piping server is behind the Caddy reverse proxy server, the basic auth was provided by the Caddy server
Does it work without --yamux
flag?
I will release new version avoiding content-type checking.
The program exited directly after remove --yamux
:
[root@almalinux9-test ~]# ./piping-tunnel server --port 22 -H "Authorization: Basic Z3Vlc3Q6MTIzNDU2" --server https://piping.example.com 1234 4321
[INFO] Hint: Client host (socat + curl)
curl -NsS https://piping.example.com/4321 | socat TCP-LISTEN:31376 - | curl -NsST - https://piping.example.com/1234
[INFO] Hint: Client host (piping-tunnel)
piping-tunnel -s https://piping.example.com client -p 31376 1234 4321
↑ 0B ( 0B/s) | ↓ 0B ( 0B/s)
[INFO] Finished
[root@almalinux9-test ~]#
0.12.0 was released for avoiding "invalid content-type" error. https://github.com/nwtgck/go-piping-tunnel/releases/tag/v0.12.0
piping-tunnel v0.12.0 server still not work:
server:
[root@almalinux9-test ~]# ./piping-tunnel server --port 22 --yamux -H "Authorization: Basic Z3Vlc3Q6MTIzNDU2" --server https://piping.example.com 1234 4321
[INFO] Hint: Client host (piping-tunnel)
piping-tunnel -s https://piping.example.com client -p 31376 --yamux 1234 4321
[INFO] Multiplexing with hashicorp/yamux
↑ 0B ( 0B/s) | ↓ 0B ( 0B/s)[WARN] --yamux flag may be missing in client-host
Error: EOF
client:
root@debian-12-test:~# ./piping-tunnel client --port 2222 --yamux -H "Authorization: Basic Z3Vlc3Q6MTIzNDU2" --server https://piping.example.com 1234 4321
[INFO] Client host listening on 2222 ...
[INFO] Hint: Server host (piping-tunnel)
piping-tunnel -s https://piping.example.com server -p <YOUR PORT> --yamux 1234 4321
OR
piping-tunnel -s https://piping.example.com socks --yamux 1234 4321
[INFO] Multiplexing with hashicorp/yamux
↑ 0B ( 0B/s) | ↓ 0B ( 0B/s)[INFO] --yamux flag may be missing in server-host
Could you check the server supports data streaming? You can use curl
like the following video:
https://github.com/nwtgck/go-piping-tunnel/assets/10933561/751e189d-5e09-4661-b612-982175032bb4
# sender
curl -T- https://ppng.io/mytext
# receiver
curl https://ppng.io/mytext
For the port forwarding, the server's streaming feature is necessary.
I've checked the feature data streaming after I deploy the piping-server to the prod env.
BTW: After disable the basic auth from Caddy server, the piping-tunnel works well without the -H
arg.
Have you tried -H
flags with curl for streaming check?:
# sender
curl -H "Authorization: Basic ..." -T- https://your.server/mytext
# receiver
curl -H "Authorization: Basic ..." https://your.server/mytext
Have you tried
-H
flags with curl for streaming check?:# sender curl -H "Authorization: Basic ..." -T- https://your.server/mytext
# receiver curl -H "Authorization: Basic ..." https://your.server/mytext
Work fine.
Did curl -H "Authorization: ..."
work with Basic-auth-enabled Caddy?
Did
curl -H "Authorization: ..."
work with Basic-auth-enabled Caddy?
Yes
How to use with piping-server http basic auth? Thanks.