samizdapp / herakles

slaying the hydra of IP/NAT/DNS/TLS/AppStore
2 stars 1 forks source link

Bad peer gets added to config by networking-service - causes yggdrasil service to segfault #157

Open JoshuaCWebDeveloper opened 1 year ago

JoshuaCWebDeveloper commented 1 year ago

Somehow, on my dev box, the networking service added a bad yggdrasil config pee:

    "Peers": [
        "tls://51.38.64.12:28395",
        "tcp://172.114.149.250:5008",
        "tcp://98.53.136.200:5000",
        "tcp://98.53.136.200:5001",
        "tcp://24.212.191.150:5000",
        "tcp://100.64.153.14:5000",
        "tcp://73.181.212.115:5000",
        "tcp://67.161.135.149:5000",
        "tcp://45.18.74.227:5000",
        "tcp://118.208.141.64:5000",
        "tcp://;; UDP setup with 1.0.0.1#53(1.0.0.1) for whoami.cloudflare failed: network unreachable.\n;; UDP setup with 1.0.0.1#53(1.0.0.1) for whoami.cloudflare failed: network unreachable.\n;; UDP setup with 1.0.0.1#53(1.0.0.1) for whoami.cloudflare failed: network unreachable.:5005"
    ],

Manually editing the yggdrasil config file would not resolve the issue as the networking service would simply put the bad value back in.

It isn't clear whether this was a bad value stuck in memory, or whether the networking service was making the fetch node info call every time and getting the same error. Regardless, I don't know why this bad value wasn't sanitized; my only guess is that some sort of race condition was happening, but I don't see a place in the code where a race condition could occur. I couldn't reproduce this locally by manually inserting the error into the yggdrasil config (it would correctly get sanitized).

The network error itself happens here: https://github.com/samizdapp/athena/blob/2a10367cc7124e3983c908a3384432450089e942/packages/networking-service/src/yggdrasil/manager.ts#L36