BetterCorp / cloudflarewarp

MIT License
85 stars 6 forks source link

Plugin Panic #2

Closed ellisonpatterson closed 2 years ago

ellisonpatterson commented 2 years ago

I'm seeing this error:

time="2022-05-02T11:05:44-04:00" level=error msg="plugins-storage/sources/gop-1720437937/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:62:5: panic" plugin=plugin-traefik-cf-warp module=github.com/BetterCorp/cloudflarewarp

Config:

[experimental]
  http3 = true
  [experimental.plugins.traefik-cf-warp]
    moduleName = "github.com/BetterCorp/cloudflarewarp"
    version = "v1.0.0"

[entryPoints]
  [entryPoints.websecure]
    address = "157.90.93.23:443"
    [entryPoints.websecure.http]
      middlewares = ["cloudflarewarp@file"]

[http]
  [http.middlewares]
    [http.middlewares.cloudflarewarp]
      [http.middlewares.cloudflarewarp.plugin.traefik-cf-warp]
        trustip = ["127.0.0.1/32", "172.17.0.0/16", "172.41.0.0/16", "173.245.48.0/20", "103.21.244.0/22", "103.22.200.0/22", "103.31.4.0/22", "141.101.64.0/18", "108.162.192.0/18", "190.93.240.0/20", "188.114.96.0/20", "197.234.240.0/22", "198.41.128.0/17", "162.158.0.0/15", "104.16.0.0/13", "104.24.0.0/14", "172.64.0.0/13", "131.0.72.0/22", "2400:cb00::/32", "2606:4700::/32", "2803:f800::/32", "2405:b500::/32", "2405:8100::/32", "2a06:98c0::/29", "2c0f:f248::/32"]
mrinc commented 2 years ago

Hey,

What traefik version are you running?

mrinc commented 2 years ago

There is no code written to handle IPv6 ... so could be that which is what is causing the panic.

Try remove the IPv6 entries and see if the plugin stops panicking?

ellisonpatterson commented 2 years ago

Traefik version is 2.6.3.

I removed the IPv6 entries and same error unfortunately. Is there a way I can get get more info for you? EDIT: Verbose log is showing me a RemoteAddr of 172.70.230.151:13694 before the panic occurs.

mrinc commented 2 years ago

I think there might be an issue with array handling still.

Try with just 1 ip address and see if it's all dandy?

Also, remove the 127.0.0.1 from the trust ip - that is invalid (shouldn't cause an issue, but check anyway).

Remote addr shouldn't contain the port when flowing through the plugin, so technically should be fine....

Does this happen on any request, or only ones from the trusted IP list?

Will spin up a debug instance with the above config and check it out tomorrow for you.

alexdelprete commented 2 years ago

Same issue:

time="2022-07-08T14:56:15+02:00" level=error msg="plugins-storage/sources/gop-2063719338/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:62:5: panic" plugin=plugin-traefik-cf-warp module=github.com/BetterCorp/cloudflarewarp
time="2022-07-08T14:57:42+02:00" level=error msg="plugins-storage/sources/gop-2063719338/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:62:5: panic" plugin=plugin-traefik-cf-warp module=github.com/BetterCorp/cloudflarewarp
time="2022-07-08T14:58:23+02:00" level=error msg="plugins-storage/sources/gop-2063719338/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:62:5: panic" plugin=plugin-traefik-cf-warp module=github.com/BetterCorp/cloudflarewarp
time="2022-07-08T14:59:22+02:00" level=error msg="plugins-storage/sources/gop-2063719338/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:62:5: panic" plugin=plugin-traefik-cf-warp module=github.com/BetterCorp/cloudflarewarp

Config:

    cloudflarewarp:  
      plugin:  
        traefik-cf-warp:  
          trustip:
            # Cloudflared docker network IP
            - 172.19.0.54/32
            # - 172.19.0.0/16

This is the current working configuration, if I use the commented subnet entry, it doesn't work, the "proxy" .54 is not trusted using the subnet. If I use the .54 entry, it works.

There's a bug, let me know if I can provide you with anything else useful...

alexdelprete commented 2 years ago

Traefik stops as soon as v2.0.0 of the plugin gets loaded.

static config:

  plugins:
    traefik-cf-warp:
      modulename: github.com/BetterCorp/cloudflarewarp
      version: v2.0.0

dynamic config:

    cloudflare-realip:
      plugin:
        traefik-cf-warp:
          trustip:
            - "172.19.0.0/16"

log:

time="2022-07-28T02:45:36+02:00" level=info msg="Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration."
time="2022-07-28T02:45:36+02:00" level=info msg="Help us improve Traefik by leaving this feature on :)"
time="2022-07-28T02:45:36+02:00" level=info msg="More details on: https://doc.traefik.io/traefik/contributing/data-collection/"
time="2022-07-28T02:45:36+02:00" level=warning msg="Traefik Pilot is deprecated and will be removed soon. Please check our Blog for migration instructions later this year."
time="2022-07-28T02:45:36+02:00" level=debug msg="loading of plugin: traefik-cf-warp: github.com/BetterCorp/cloudflarewarp@v2.0.0"
Error response from daemon: Container 31dff307d99886ad4af130bc27487412b238feb0b056017bfa27c6c7072a2555 is restarting, wait until the container is running