tobychui / zoraxy

A general purpose HTTP reverse proxy and forwarding tool. Now written in Go!
https://zoraxy.aroz.org
GNU Affero General Public License v3.0
3.1k stars 188 forks source link

[HELP] Stream proxy #204

Closed barto95100 closed 5 months ago

barto95100 commented 5 months ago

Hi,

I configure the stream proxy :

CleanShot 2024-06-16 at 22 53 47

but when I test to tcpdump to 192.168.1.243 if the traffic forward from zoraxy nothing in tcpdump..

i'm wrong on configuration ? or other config is necessary ?

zoraxy 3.0.6 Docker Router NAT port 25 -> zoraxy -> to 192.168.1.243:25

thank's for your help

tobychui commented 5 months ago

@barto95100 Just to make sure you setup everything correctly, you have enabled TCP port forward / mapping thing in docker right? Have you click "Refresh" to check if your service is actually running and not exited after running for a few seconds?Can I have your docker config and your wireshark capture?

Updates

After some testing the TCP proxy function indeed working and issue above cannot be reproduced. Check your docker networking config and seek for professional IT support if needed.

barto95100 commented 5 months ago

@tobychui this is my config docker:

version: '3.3'
services:
  zoraxy-docker:
    image: zoraxydocker/zoraxy:latest
    container_name: zoraxy
    ports:
      - 80:80
      - 443:443
      - 25:25
      #- 8008:8000/tcp
    volumes:
      - /home/docker/zoraxy:/opt/zoraxy/config/
    environment: 
      ARGS: '-fastgeoip=true'

the tcpdump: (zoraxy host)

10:09:31.824616 IP 209.85.128.179.54692 > 192.168.99.10.25: Flags [S], seq 1479559046, win 64240, options [mss 1460,sackOK,TS val 3894682929 ecr 0,nop,wscale 7], length 0
10:09:31.824766 IP 192.168.99.10.25 > 209.85.128.179.54692: Flags [R.], seq 0, ack 1479559047, win 0, length 0
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel

and draw to explain: image

and i check i check the service, is started: image

tobychui commented 5 months ago

@barto95100 Have you try to change the listening address to your docker container WAN address instead? Sorry I am not experience in docker, but when I test Zoraxy outside of docker it works perfectly fine. If you need further help, you can tag PassiveLemon and ask for some new ideas.

barto95100 commented 5 months ago

I don't understand:

Have you try to change the listening address to your docker container WAN address instead?

My container zoraxy have 172.23.0.2

this is the tcpdump on interface network used by zoraxy on docker network:

tcpdump -i br-5ea7e450a6d3 port 25
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on br-5ea7e450a6d3, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:15:41.046509 IP mail-wm1-f51.google.com.42474 > 172.23.0.2.smtp: Flags [S], seq 857561589, win 64240, options [mss 1460,sackOK,TS val 421145845 ecr 0,nop,wscale 7], length 0
15:15:41.046559 IP 172.23.0.2.smtp > mail-wm1-f51.google.com.42474: Flags [R.], seq 0, ack 857561590, win 0, length 0
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel

I don't know why the zoraxy dont forward the packet..

Log possible in specify file in container ?

@PassiveLemon maybe idea ?

thank's

tobychui commented 5 months ago

Maybe I can give a bit of context on how that listening address works. This is the code that parse the listening address before it enters the TCP / UDP connection copy go routines

listenerStartingAddr := allowPort
    if isValidPort(allowPort) {
        //number only, e.g. 8080
        listenerStartingAddr = "0.0.0.0:" + allowPort
    } else if strings.HasPrefix(allowPort, ":") && isValidPort(allowPort[1:]) {
        //port number starting with :, e.g. :8080
        listenerStartingAddr = "0.0.0.0" + allowPort
    }

So if you are only filling in :port, then it defaults to 0.0.0.0:port. I am not sure if docker don't like it or not and causes the above issues.

barto95100 commented 5 months ago

Ok, @tobychui i reboot the virtual machine and it's ok now (no config modify) strange :(

tobychui commented 5 months ago

Uhhh ok, please close this if your problem has been resolved.