anandslab / docker-traefik

Docker media and home server stack with Docker Compose, Traefik, Swarm Mode, Google OAuth2/Authelia, and LetsEncrypt
https://www.smarthomebeginner.com/
MIT License
2.75k stars 613 forks source link

Traefik Plugins #307

Open Bispo1986 opened 1 year ago

Bispo1986 commented 1 year ago

Hello there.

First and foremost thank you very much for you guides and Repo about Home Serving. Followed your steps to traefik+authelia+Cloudflare DNS, etc. Till now with success.

----> my Middlewares.yml is exactly how you have yours. ----> my Middlewares-chains.yml are very simple: http: middlewares: chain-no-auth: chain: middlewares:

chain-authelia: chain: middlewares:

where i add the new middleware to the chain. I recreate the container with this configuration:

static: --experimental.plugins.geoblock.modulename=github.com/PascalMinder/geoblock --experimental.plugins.geoblock.version=v0.2.5

dynamic:

http: middlewares: my-geoblock: plugin: geoblock: allowLocalRequests: "false" allowUnknownCountries: "false" api: https://get.geojs.io/v1/ip/country/{ip} apiTimeoutMs: "150" cacheSize: "15" countries:

and ofc i call the dynamic on the chain.

It doesnt work no matter what i try. The plugin here is only an example. This happens with every Plugin. As i said no error comes out of traefik itself and the plugin is loaded without a problem.

I would ask you, if and when you got the time, to make a guide with the new crowdsec plugin for traefik, where the traefik-bouncer is configured as a plugin. That one would be of interest given that the one mentioned in your guide no longer shows as stable by traefik.

chk86 commented 8 months ago

I was able to get the new crowdsec plugin working in traefik. It's the only traefik plugin I have enabled right now.

It's hard to see the indentations and code in your middlewares with the geoblock, so I'm not sure about why your setup is giving you 404s.

But here's what I have for the crowdsec plugin:

Middlewares.yml

crowdsec-bouncer-plugin:
      plugin:
        crowdsec-bouncer-traefik-plugin:
          Enabled: true
          logLevel: INFO
          updateIntervalSeconds: 60
          defaultDecisionSeconds: 60
          httpTimeoutSeconds: 10
          crowdsecMode: none
          crowdsecLapiKey: <lapikey>
          crowdsecLapiHost: crowdsec:8080
          crowdsecLapiScheme: http
          crowdsecLapiTLSInsecureVerify: false
          forwardedHeadersTrustedIPs: 
            - ipaddress
          clientTrustedIPs: 
            - ipaddress
          forwardedHeadersCustomName: X-Custom-Header

traefik compose

# Traefik 2 - Reverse Proxy
  traefik:
    <<: *common-keys-core # See EXTENSION FIELDS at the top
    container_name: traefik
    image: traefik:2.10
    command: # CLI arguments
      - --global.checkNewVersion=true
      - --global.sendAnonymousUsage=true   
      - --experimental.plugins.crowdsec-bouncer-traefik-plugin.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
      - --experimental.plugins.crowdsec-bouncer-traefik-plugin.version=v1.1.16

And then I just added the crowdsec bouncer middlewares to my middlewares-chain:

http:
  middlewares:
    chain-authelia:
      chain:
        middlewares:
          # - middlewares-crowdsec-bouncer # leave this out if you are not using CrowdSec
          - crowdsec-bouncer-plugin
          - middlewares-rate-limit
          - middlewares-https-redirectscheme
          - middlewares-secure-headers
          - middlewares-authelia
          - middlewares-compress