Skip to content

Commit

Permalink
更新 iptables 命令防止重复添加
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherDream committed Jun 19, 2019
1 parent 9844299 commit 410af95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions setup-ipset.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#
# 该脚本用于禁止 jsporxy 用户访问内网(针对 TCP)
# 该脚本用于禁止 jsporxy 用户访问内网,防止 SSRF 攻击
# 需要 root 权限运行,依赖 ipset 命令
#
if [[ $(iptables -L | grep "anti ssrf") ]]; then
exit
fi

ipset create ngx-ban-dstip hash:net

# 该策略对 jsproxy 用户的所有程序都生效
iptables \
-m comment --comment "anti ssrf" \
-A OUTPUT \
-p tcp --syn \
-m owner --uid-owner jsproxy \
Expand Down

0 comments on commit 410af95

Please sign in to comment.