PascalMinder / geoblock

Traefik middleware plugin - Deny requests based on country of origin
98 stars 10 forks source link

Error messages in Traefik container logs when start plugin #19

Closed DmitriiTrotskii closed 1 year ago

DmitriiTrotskii commented 1 year ago

Hi,

Getting some error message when start router with using plugin middleware in my Traefik container logs.

Using dynamic config for traefik and internal site:

static.yml

experimental:
  plugins:
    GeoBlock:
      moduleName: github.com/PascalMinder/GeoBlock
      version: "v0.2.2"

dynamic.yml

http:
  ...
  middlewares:
  ...
    geoBlock:
      plugin:
        GeoBlock:
          allowLocalRequests: true
          allowUnknownCountries: false
          api: "https://get.geojs.io/v1/ip/country/{ip}"
          apiTimeoutMs: 150
          cacheSize: 15
          forceMonthlyUpdate: true
          logAllowedRequests: false
          logApiRequests: true
          logLocalRequests: false
          unknownCountryApiResponse: nil
          countries:
            - EN

and site.yml

http:
  routers:
    test-router:
      entryPoints:
        - https
      service: test
      rule: Host(`test.domain.com`)
      middlewares:
        - geoBlock@file
      tls:
        certResolver: letsencrypt
        options:
          - intermediate@file
  services:
    test:
      loadBalancer:
        servers:
          - url: http://internal.ip
        passHostHeader: true

Everything is fine in traefik dashboard. I see the middleware geoBlock@file with status "Success" and it is connected to the router "test-router".

But when this router start, i see some errors:

level=error msg="2022/07/13 01:40:14 allow local IPs:  true" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 log local requests:  false" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 log allowed requests:  false" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 log api requests:  true" module=github.com/PascalMinder/GeoBlock plugin=plugin-GeoBlock
level=error msg="2022/07/13 01:40:14 API uri:  https://get.geojs.io/v1/ip/country/{ip}" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 API timeout:  150" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 cache size:  15" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 force monthly update:  true" module=github.com/PascalMinder/GeoBlock plugin=plugin-GeoBlock
level=error msg="2022/07/13 01:40:14 allow unknown countries:  false" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 unknown country api response:  nil" plugin=plugin-GeoBlock module=github.com/PascalMinder/GeoBlock
level=error msg="2022/07/13 01:40:14 allowed countries:  [EN]" module=github.com/PascalMinder/GeoBlock plugin=plugin-GeoBlock
PascalMinder commented 1 year ago

Those are the settings the plugin starts with. Somehow, Traefik shows them as an error. I'll check how I can disable this.

PascalMinder commented 1 year ago

The logging problem should be resolved with the release v0.2.3.