Log4Shell is a middleware plugin for Traefik which blocks JNDI attacks based on HTTP header values.
Related to the Log4J CVE: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228
--pilot.token=xxx--experimental.plugins.log4shell.modulename=github.com/traefik/plugin-log4shell--experimental.plugins.log4shell.version=v0.1.2
pilot:token: xxxexperimental:plugins:log4shell:modulename: github.com/traefik/plugin-log4shellversion: v0.1.2
[pilot]token = "xxx"[experimental.plugins.log4shell]modulename = "github.com/traefik/plugin-log4shell"version = "v0.1.2"
To configure the Log4Shell
plugin you should create a middleware in your dynamic configuration as explained here.
http:middlewares:log4shell-foo:plugin:log4shell:errorCode: 200routers:my-router:rule: Host(`localhost`)middlewares:- log4shell-fooservice: my-serviceservices:my-service:loadBalancer:servers:- url: 'http://127.0.0.1'
[http.middlewares][http.middlewares.log4shell-foo.plugin.log4shell]errorCode = 200[http.routers][http.routers.my-router]rule = "Host(`localhost`)"middlewares = ["log4shell-foo"]service = "my-service"[http.services][http.services.my-service][http.services.my-service.loadBalancer][[http.services.my-service.loadBalancer.servers]]url = "http://127.0.0.1"
---apiVersion: traefik.containo.us/v1alpha1kind: Middlewaremetadata:name: log4shell-foospec:plugin:log4shell:errorCode: 200---apiVersion: traefik.containo.us/v1alpha1kind: IngressRoutemetadata:name: whoamispec:entryPoints:- webroutes:- kind: Rulematch: Host(`whoami.example.com`)middlewares:- name: log4shell-fooservices:- kind: Servicename: whoami-svcport: 80
---apiVersion: traefik.containo.us/v1alpha1kind: Middlewaremetadata:name: log4shell-foospec:plugin:log4shell:errorCode: secretName---apiVersion: networking.k8s.io/v1kind: Ingressmetadata:name: myingressannotations:traefik.ingress.kubernetes.io/router.middlewares: default-log4shell-foo@kubernetescrdspec:rules:- host: example.comhttp:paths:- path: /pathType: Prefixbackend:service:name: whoamiport:number: 80
version: '3.7'services:whoami:image: traefik/whoami:v1.7.1labels:traefik.enable: 'true'traefik.http.routers.app.rule: Host(`whoami.localhost`)traefik.http.routers.app.entrypoints: websecuretraefik.http.routers.app.middlewares: log4shell-footraefik.http.middlewares.log4shell-foo.plugin.log4shell.errorcode: 200