jhalter / mobius

A Hotline server implemented in Golang for macOS, Linux, and Windows operating systems
MIT License
76 stars 8 forks source link

Registering with hltracker.com #25

Closed aptonline closed 2 years ago

aptonline commented 2 years ago

I seem to be spamming your issues so I apologise.

I've been trying to register with hltacker.com with no success. I have the following in config.yaml

EnableTrackerRegistration: true
Trackers:
- hltracker.com:5499

I also have the required 5500 and 5501 ports open on my router. Any idea what I'm doing wrong?

jhalter commented 2 years ago

No worries, just saw your question in the Mobius chat.

Your config looks ok to me. Here's what I'm using for reference:

EnableTrackerRegistration: true
Trackers:
  - hltracker.com:5499
  - tracker.preterhuman.net:5499

There is a problem I've noticed with hltracker.com where it periodically drops about a third of the listings, so maybe you're running into that?

Try waiting and refreshing a bit, or include tracker.preterhuman.net and check that one as well.

aptonline commented 2 years ago

Ok So added tracker.preterhuman.net to the trackers in config.yaml and changed the tracker in my client to the same and still not registering.

This may be a silly question but it this anything to do with the fact I'm running inside a docker container? any other ports that need opening in the container and or router?

aptonline commented 2 years ago

I know you confirmed that the tracker was working in Docker but wondering if as a workaround for my use case that the UDP port for the tracker needs mapping correctly. I found this which links to docker docs which may (or may not) help.

https://github.com/moby/moby/issues/15127#issuecomment-825493346

jhalter commented 2 years ago

That seems to be related to inbound UDP, but in this case the container is sending only outbound. The tracker doesn't send any reply, so it's all one-way.

Still suspicious of your Synology firewall, but it could also be something like apparmor or SElinux.

As a test, maybe try temporarily disabling apparmor?
https://community.synology.com/enu/forum/17/post/76654

jhalter commented 2 years ago

Also, anything interesting show up in dmesg?

aptonline commented 2 years ago

Noting jumps out in dmseg and I don’t seem to be able to disable apparmor easily.

I did however find this which seems to indicate if I run the docker container as privileged it bypasses apparmor.

https://stackoverflow.com/questions/37072468/disable-apparmor-for-docker-for-ptrace-scope#39277945

aptonline commented 2 years ago

Ok here's an update.

I tried a docker container on my main machine (not the Synology box) and was unable to get the server registered with any tracker. I then used the server via the brew install on the same machine and it worked straight away.

On my main machine I have Little Snitch installed and there was no UDP activity seen from docker during the testing but as soon as I launched the Brew server Little Snitch flagged the UDP tracker activity. Screenshot 2022-06-06 at 09 48 48 Screenshot 2022-06-06 at 09 49 05

It does appear that docker is blocking the UDP traffic somehow and this is not an issue with either my Synology box or ports on the router.

jhalter commented 2 years ago

On my setup running the latest MacOS and Docker Desktop, I'm definitely able to see outbound UDP traffic to the tracker:

Term 1

❯ sw_vers
ProductName:    macOS
ProductVersion: 12.4
BuildVersion:   21F79

❯ docker -v
Docker version 20.10.16, build aa7e414

❯ docker run -p 5500:5500 -p 5501:5501 -v ~/mobius-config:/usr/local/var/mobius/config jhalter/mobius-hotline-server:latest
2022-06-06T14:06:03.404Z    info    Hotline server started  {"version": "0.5.0"}
2022-06-06T14:06:03.404Z    info    Hotline file transfer server started    {"Addr": ":5501"}
2022-06-06T14:06:03.404Z    info    Registering with tracker hltracker.com:5499
2022-06-06T14:06:03.405Z    info    Hotline server started  {"Addr": ":5500"}
^

Term 2

❯ sudo tcpdump -i en0 -vvv -X udp port 5499
tcpdump: listening on en0, link-type EN10MB (Ethernet), capture size 262144 bytes
07:06:03.517574 IP (tos 0x0, ttl 63, id 14758, offset 0, flags [none], proto UDP (17), length 116)
    datacide.lan.54992 > stickytack.com.5499: [udp sum ok] UDP, length 88
    0x0000:  4500 0074 39a6 0000 3f11 ca5a c0a8 561f  E..t9...?..Z..V.
    0x0010:  47ac 1905 d6d0 157b 0060 8c53 0001 157c  G......{.`.S...|
    0x0020:  0000 0000 52fd fc07 114d 7920 486f 746c  ....R....My.Hotl
    0x0030:  696e 6520 7365 7276 6572 3941 2064 6566  ine.server9A.def
    0x0040:  6175 6c74 2063 6f6e 6669 6775 7265 6420  ault.configured.
    0x0050:  486f 746c 696e 6520 7365 7276 6572 2072  Hotline.server.r
    0x0060:  756e 6e69 6e67 204d 6f62 6975 7320 7630  unning.Mobius.v0
    0x0070:  2e30 2e31                                .0.1
^C
1 packet captured
10325 packets received by filter
0 packets dropped by kernel

I'll look into adding some debug logging to help figure this out.

aptonline commented 2 years ago

Yeah initially I wasn't seeing the traffic from docker but I can now... its just not doing anything. It's like it's staying in the network for some reason, unlike the Brew install which is going straight out and registering. Who would Docker be different? (for me at least).

aptonline commented 2 years ago

As requested, here is the log of the debug image:

2022-06-06T15:13:22.804Z info Tracker registration enabled {"frequency": "300s", "trackers": ["hltracker.com:5499", "tracker.preterhuman.net:5499"]}

2022-06-06T15:13:22.804Z info Hotline server started {"version": "0.5.0"}

2022-06-06T15:13:22.804Z info Hotline file transfer server started {"Addr": ":5501"}

2022-06-06T15:13:22.804Z info Hotline server started {"Addr": ":5500"}

Sent 107 bytes to hltracker.com:5499. err: <nil>

([]uint8) (len=107 cap=107) {

00000000 00 01 15 7c 00 00 00 00 52 fd fc 07 24 4d 79 20 |...|....R...$My |

00000010 48 6f 74 6c 69 6e 65 20 73 65 72 76 65 72 20 28 |Hotline server (|

00000020 44 6f 63 6b 65 72 20 2d 20 47 6c 61 63 69 65 72 |Docker - Glacier|

00000030 29 39 41 20 64 65 66 61 75 6c 74 20 63 6f 6e 66 |)9A default conf|

00000040 69 67 75 72 65 64 20 48 6f 74 6c 69 6e 65 20 73 |igured Hotline s|

00000050 65 72 76 65 72 20 72 75 6e 6e 69 6e 67 20 4d 6f |erver running Mo|

00000060 62 69 75 73 20 76 30 2e 35 2e 30 |bius v0.5.0|

}

2022-06-06T15:13:22.848Z info Sent Tracker registration {"data": {"Port":"FXw=","UserCount":0,"PassID":"Uv38Bw==","Name":"My Hotline server (Docker - Glacier)","Description":"A default configured Hotline server running Mobius v0.5.0"}}

Sent 107 bytes to tracker.preterhuman.net:5499. err: <nil>

([]uint8) (len=107 cap=107) {

00000000 00 01 15 7c 00 00 00 00 52 fd fc 07 24 4d 79 20 |...|....R...$My |

00000010 48 6f 74 6c 69 6e 65 20 73 65 72 76 65 72 20 28 |Hotline server (|

00000020 44 6f 63 6b 65 72 20 2d 20 47 6c 61 63 69 65 72 |Docker - Glacier|

00000030 29 39 41 20 64 65 66 61 75 6c 74 20 63 6f 6e 66 |)9A default conf|

00000040 69 67 75 72 65 64 20 48 6f 74 6c 69 6e 65 20 73 |igured Hotline s|

00000050 65 72 76 65 72 20 72 75 6e 6e 69 6e 67 20 4d 6f |erver running Mo|

00000060 62 69 75 73 20 76 30 2e 35 2e 30 |bius v0.5.0|

}

2022-06-06T15:13:22.971Z info Sent Tracker registration {"data": {"Port":"FXw=","UserCount":0,"PassID":"Uv38Bw==","Name":"My Hotline server (Docker - Glacier)","Description":"A default configured Hotline server running Mobius v0.5.0"}}
aptonline commented 2 years ago

And using debugv2:

2022-06-06T16:12:39.354Z info Tracker registration enabled {"frequency": "300s", "trackers": ["hltracker.com:5499", "tracker.preterhuman.net:5499"]}

2022-06-06T16:12:39.354Z info Hotline server started {"version": "0.5.0"}

2022-06-06T16:12:39.354Z info Hotline file transfer server started {"Addr": ":5501"}

2022-06-06T16:12:39.354Z info Hotline server started {"Addr": ":5500"}

Sent 107 bytes to hltracker.com:5499. err: <nil>

([]uint8) (len=107 cap=107) {

00000000 00 01 15 7c 00 00 00 00 3f c2 16 c9 24 4d 79 20 |...|....?...$My |

00000010 48 6f 74 6c 69 6e 65 20 73 65 72 76 65 72 20 28 |Hotline server (|

00000020 44 6f 63 6b 65 72 20 2d 20 47 6c 61 63 69 65 72 |Docker - Glacier|

00000030 29 39 41 20 64 65 66 61 75 6c 74 20 63 6f 6e 66 |)9A default conf|

00000040 69 67 75 72 65 64 20 48 6f 74 6c 69 6e 65 20 73 |igured Hotline s|

00000050 65 72 76 65 72 20 72 75 6e 6e 69 6e 67 20 4d 6f |erver running Mo|

00000060 62 69 75 73 20 76 30 2e 35 2e 30 |bius v0.5.0|

}

2022-06-06T16:12:39.361Z info Sent Tracker registration {"data": {"Port":"FXw=","UserCount":0,"PassID":"P8IWyQ==","Name":"My Hotline server (Docker - Glacier)","Description":"A default configured Hotline server running Mobius v0.5.0"}}

Sent 107 bytes to tracker.preterhuman.net:5499. err: <nil>

([]uint8) (len=107 cap=107) {

00000000 00 01 15 7c 00 00 00 00 3f c2 16 c9 24 4d 79 20 |...|....?...$My |

00000010 48 6f 74 6c 69 6e 65 20 73 65 72 76 65 72 20 28 |Hotline server (|

00000020 44 6f 63 6b 65 72 20 2d 20 47 6c 61 63 69 65 72 |Docker - Glacier|

00000030 29 39 41 20 64 65 66 61 75 6c 74 20 63 6f 6e 66 |)9A default conf|

00000040 69 67 75 72 65 64 20 48 6f 74 6c 69 6e 65 20 73 |igured Hotline s|

00000050 65 72 76 65 72 20 72 75 6e 6e 69 6e 67 20 4d 6f |erver running Mo|

00000060 62 69 75 73 20 76 30 2e 35 2e 30 |bius v0.5.0|

}

2022-06-06T16:12:39.368Z info Sent Tracker registration {"data": {"Port":"FXw=","UserCount":0,"PassID":"P8IWyQ==","Name":"My Hotline server (Docker - Glacier)","Description":"A default configured Hotline server running Mobius v0.5.0"}}
jhalter commented 2 years ago

At the moment I can't tell if traffic is reaching the tracker but getting rejected for some reason, or not reaching the tracker at all. To figure this out, let's try sending the traffic to my public IP so that I can see if anything shows up. If not, then we've narrowed it down to a problem with traffic leaving your Synlogy.

Ping me on the Mobius server when you can and we'll give it a try.

aptonline commented 2 years ago

Will do. At the moment the testing I’m doing is independent of the synology box, it’s on the same machine that the Brew install works on.

jhalter commented 2 years ago

I installed Little Snitch to see how that behaves.

I ran docker run --rm -p 5500:5500 -p 5501:5501 jhalter/mobius-hotline-server:debugv2

And got:

Screen Shot 2022-06-06 at 11 26 44 AM

So that seems right. I'm not sure why you're seeing different behavior.

If you list your Little Snitch rules, what do you have for Docker?

I have:

Screen Shot 2022-06-06 at 11 35 21 AM

You?

aptonline commented 2 years ago

Thanks @jhalter for testing and getting to the bottom of this issue, much appreciated. For anyone who comes across a similar problem the issue was down to the length of either the server name (most likely) or description in config.yaml. This was causing Mobius to not correctly send all the required data to the tracker.