tomMoulard / fail2ban

Traefik plugin on fail2ban middleware
MIT License
200 stars 11 forks source link

Error running plugin: unable to find source related to: "net/netip"` #85

Closed SanderAtSnakeware closed 11 months ago

SanderAtSnakeware commented 11 months ago

So, I added this plugin to Traefik 2.7 by adding this to traefik.toml:

[experimental.plugins.fail2ban]
  moduleName = "github.com/tomMoulard/fail2ban"
  version = "v0.7.1"

and this to the dynamic-conf.toml:

[http.middlewares.my-fail2ban]
  [http.middlewares.my-fail2ban.plugin]
    [http.middlewares.my-fail2ban.plugin.fail2ban]
      [http.middlewares.my-fail2ban.plugin.fail2ban.rules]
        bantime = "1h"
        enabled = "true"
        findtime = "1m"
        maxretry = "60"
      [http.middlewares.my-fail2ban.plugin.fail2ban.whitelist]
        ip = "::1,127.0.0.1,172.19.0.0/16,172.17.0.0/16"

After restarting the Traefik container the following error is thrown in the Traefik console:

2023/10/18 11:46:59 traefik.go:80: command traefik error: github.com/tomMoulard/fail2ban: failed to import plugin code "github.com/tomMoulard/fail2ban": 1:21: import "github.com/tomMoulard/fail2ban" error: plugins-storage/sources/gop-3703202570/src/github.com/tomMoulard/fail2ban/fail2ban.go:17:2: import "github.com/tomMoulard/fail2ban/ipchecking" error: plugins-storage/sources/gop-3703202570/src/github.com/tomMoulard/fail2ban/ipchecking/ipChecking.go:7:2: import "net/netip" error: unable to find source related to: "net/netip"

This doesn't seem like something I misconfigured, but I could be mistaken. Any idea?

tomMoulard commented 11 months ago

Hello @SanderAtSnakeware,

Thanks for your interest in this Traefik Plugin!

This might be because traefik v2.7 uses a old version of yaegi that did not work with this version of the Plugin. Could you try with a more recent version of traefik (e.g., v2.10)? Does the issue still remains?

SanderAtSnakeware commented 11 months ago

Hi @tomMoulard, sounds like something I can try out...

Yes, that seems to fix things, I used Traefik 2,9 in this case and that seems to work. Thank you!

tomMoulard commented 11 months ago

Perfect