PascalMinder / geoblock

Traefik middleware plugin - Deny requests based on country of origin
105 stars 9 forks source link

BlackListMode not working #35

Closed fdegraeve closed 1 year ago

fdegraeve commented 1 year ago

Hello,

I try to enabled the BlackListMode is not working.

I try this

  middlewares:
    geoblock:
      plugin:
        GeoBlock:
          allowLocalRequests: true
          logLocalRequests: false
          logAllowedRequests: false
          logApiRequests: false
          api: "https://get.geojs.io/v1/ip/country/{ip}"
          apiTimeoutMs: 800
          cacheSize: 25
          forceMonthlyUpdate: true
          allowUnknownCountries: false
          unknownCountryApiResponse: "nil"
          backListMode: true
          countries:
            - IL # Israel

or this

  middlewares:
    geoblock:
      plugin:
        GeoBlock:
          allowLocalRequests: true
          logLocalRequests: false
          logAllowedRequests: false
          logApiRequests: false
          api: "https://get.geojs.io/v1/ip/country/{ip}"
          apiTimeoutMs: 800
          cacheSize: 25
          forceMonthlyUpdate: true
          allowUnknownCountries: false
          unknownCountryApiResponse: "nil"
          blacklist: true
          countries:
            - IL # Israel

It's never work. The logs.

INFO: GeoBlock: 2023/05/14 20:12:20 allow local IPs: true
INFO: GeoBlock: 2023/05/14 20:12:20 log local requests: false
INFO: GeoBlock: 2023/05/14 20:12:20 log allowed requests: false
INFO: GeoBlock: 2023/05/14 20:12:20 log api requests: false
INFO: GeoBlock: 2023/05/14 20:12:20 API uri: https://get.geojs.io/v1/ip/country/{ip}
INFO: GeoBlock: 2023/05/14 20:12:20 API timeout: 800
INFO: GeoBlock: 2023/05/14 20:12:20 cache size: 25
INFO: GeoBlock: 2023/05/14 20:12:20 force monthly update: true
INFO: GeoBlock: 2023/05/14 20:12:20 allow unknown countries: false
INFO: GeoBlock: 2023/05/14 20:12:20 unknown country api response: nil
INFO: GeoBlock: 2023/05/14 20:12:20 allowed countries: [IL]
INFO: GeoBlock: 2023/05/14 20:12:38 geoblock@file: request denied [x.x.x.x] for country [FR]

Thanks for your help.

fdegraeve commented 1 year ago

Ok find it, just typo on Readme. I open this PR for fix: https://github.com/PascalMinder/geoblock/pull/36

PascalMinder commented 1 year ago

Hi @fdegraeve

Thank you for your contribution. I am currently on holiday. I'll review it afterwards (about 3 weeks).

PascalMinder commented 1 year ago

Fixed by https://github.com/PascalMinder/geoblock/pull/36