自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

使用 Traefik 中間件處理 Log4J 漏洞

網(wǎng)絡(luò) 通信技術(shù)
Traefik 的中間件是最讓人喜歡的一個(gè)功能,為了能夠擴(kuò)展中間件,我們可以非常方便的使用平臺(tái)上提供的各種中間件,在 Dashboard 上就可以無縫進(jìn)行對接.

[[441829]]

Traefik 的中間件是最讓人喜歡的一個(gè)功能,為了能夠擴(kuò)展中間件,Traefik 官方還推出了 Pilot(https://pilot.traefik.io/) 這樣的中間件 SaaS 服務(wù),和 Traefik 深度集成,我們可以非常方便的使用平臺(tái)上提供的各種中間件,在 Dashboard 上就可以無縫進(jìn)行對接:

Log4Shell(https://github.com/traefik/plugin-log4shell) 就是一個(gè)解決最近很火的 Log4J 漏洞的 Traefik 插件,相關(guān)介紹:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228。不過要使用該中間件需要 Traefik >= v.2.5.5 版本。

使用也是非常簡單的,首先通過靜態(tài)配置啟用該插件,可以通過 Traefik 啟動(dòng)參數(shù)配置:

  1. --pilot.token=xxx  # 去 pilot 注冊實(shí)例獲取的 token 
  2. --experimental.plugins.log4shell.modulename=github.com/traefik/plugin-log4shell 
  3. --experimental.plugins.log4shell.version=v0.1.2 

或者配置文件:

  1. pilot: 
  2.   token: xxx 
  3.  
  4. experimental: 
  5.   plugins: 
  6.     log4shell: 
  7.       modulename: github.com/traefik/plugin-log4shell 
  8.       version: v0.1.2 

為了使用 Log4Shell 插件我們首先需要?jiǎng)?chuàng)建一個(gè)中間件,比如在 Kubernetes 系統(tǒng)中,只需要?jiǎng)?chuàng)建如下所示的資源對象即可:

  1. apiVersion: traefik.containo.us/v1alpha1 
  2. kind: Middleware 
  3. metadata: 
  4.   name: log4shell-foo 
  5. spec: 
  6.   plugin: 
  7.     log4shell: 
  8.       errorCode: 200 

然后在 IngressRoute 中關(guān)聯(lián)上上面的中間件即可修復(fù):

  1. apiVersion: traefik.containo.us/v1alpha1 
  2. kind: IngressRoute 
  3. metadata: 
  4.   name: whoami 
  5. spec: 
  6.   entryPoints: 
  7.     - web 
  8.   routes: 
  9.     - kind: Rule 
  10.       match: Host(`whoami.localhost`) 
  11.       middlewares: 
  12.         - name: log4shell-foo 
  13.       services: 
  14.         - kind: Service 
  15.           name: whoami-svc 
  16.           port: 80 

當(dāng)然如果使用的是默認(rèn)的 Ingress 資源對象,則需要通過 annotation 注解來配置:

  1. apiVersion: networking.k8s.io/v1 
  2. kind: Ingress 
  3. metadata: 
  4.   name: myingress 
  5.   annotations: 
  6.     traefik.ingress.kubernetes.io/router.middlewares: default-log4shell-foo@kubernetescrd 
  7. spec: 
  8.   ingressClassName: traefik 
  9.   rules: 
  10.     - host: whoami.localhost 
  11.       http: 
  12.         paths: 
  13.           - path: / 
  14.             pathType: Prefix 
  15.             backend: 
  16.               service: 
  17.                 name:  whoami 
  18.                 port: 
  19.                   number: 80 

同樣如果是使用 Docker 環(huán)境則需要通過 labels 標(biāo)簽進(jìn)行配置:

  1. version: '3.7' 
  2.  
  3. services: 
  4.   whoami: 
  5.     image: traefik/whoami:v1.7.1 
  6.     labels: 
  7.       traefik.enable: 'true' 
  8.       traefik.http.routers.app.rule: Host(`whoami.localhost`) 
  9.       traefik.http.routers.app.entrypoints: websecure 
  10.       traefik.http.routers.app.middlewares: log4shell-foo 
  11.       traefik.http.middlewares.log4shell-foo.plugin.log4shell.errorcode: 200 

 

責(zé)任編輯:姜華 來源: k8s技術(shù)圈
相關(guān)推薦

2022-03-25 13:42:15

Log4j漏洞網(wǎng)絡(luò)安全

2021-12-23 09:47:36

Log4jRCE漏洞DoS漏洞

2022-03-30 11:29:53

漏洞補(bǔ)丁Spring

2021-12-14 23:44:26

漏洞Log4j項(xiàng)目

2022-01-24 10:02:53

漏洞微軟網(wǎng)絡(luò)攻擊

2021-12-13 01:49:34

漏洞Log4j代碼

2021-12-23 11:03:25

Log4j 漏洞漏洞

2022-01-02 07:07:55

CISAApache Log4漏洞

2023-11-10 10:08:23

2022-01-06 09:52:39

Log4j漏洞攻擊

2021-12-11 19:04:38

漏洞

2019-03-20 15:21:28

Web漏洞Tomcat

2022-02-15 17:51:38

Log4j漏洞網(wǎng)絡(luò)安全

2022-02-13 16:18:57

JetBrainsIntelliJLog4j

2021-12-21 14:25:01

Log4j2漏洞網(wǎng)絡(luò)

2022-05-30 14:04:23

Log4j遠(yuǎn)程代碼漏洞

2021-12-22 16:53:31

Log4jLog4j庫零日漏洞

2021-12-16 12:27:15

Log4j漏洞網(wǎng)絡(luò)安全

2021-12-29 14:47:43

Apache團(tuán)隊(duì)Log4j漏洞

2021-06-03 10:58:16

logbacklog4jJava
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)