zjcqoo 6 лет назад
Родитель
Сommit
aad6a39481
4 измененных файлов с 16 добавлено и 13 удалено
  1. 2 0
      allowed-sites.conf
  2. 10 8
      setup-ipset.sh
  3. 3 4
      upload.sh
  4. 1 1
      www.conf

+ 2 - 0
allowed-sites.conf

@@ -11,6 +11,8 @@ http://localhost                  'lo';
 http://localhost:8080             'lo';
 
 https://jsproxy.tk                'js-tk';
+https://jsproxy-test.tk           'test.tk';
+https://jsproxy.ga                'js-ga';
 
 # 接口和网站同源,这种情况下 origin 为空
 ''                                'mysite';

+ 10 - 8
setup-ipset.sh

@@ -1,16 +1,18 @@
 #
-# 该脚本用于禁止 jsporxy 用户访问内网(针对 TCP)
+# 该脚本用于禁止 jsporxy 用户访问内网,防止 SSRF 攻击
 # 需要 root 权限运行,依赖 ipset 命令
 #
 ipset create ngx-ban-dstip hash:net
 
-# 该策略对 jsproxy 用户的所有程序都生效
-iptables \
-  -A OUTPUT \
-  -p tcp --syn \
-  -m owner --uid-owner jsproxy \
-  -m set --match-set ngx-ban-dstip dst \
-  -j REJECT
+if [[ ! $(iptables -L | grep "anti ssrf") ]]; then
+  iptables \
+    -m comment --comment "anti ssrf" \
+    -A OUTPUT \
+    -p tcp --syn \
+    -m owner --uid-owner jsproxy \
+    -m set --match-set ngx-ban-dstip dst \
+    -j REJECT
+fi
 
 # https://en.wikipedia.org/wiki/Reserved_IP_addresses
 REV_NET=(

+ 3 - 4
upload.sh

@@ -3,10 +3,9 @@
 
 HOST=etherdream.com
 NODE=(
-  aliyun-hk-2
-  # aliyun-hk-0
-  # aliyun-hk-1
-  # aliyun-sg
+  aliyun-hk-0
+  aliyun-hk-1
+  aliyun-sg
 )
 for v in ${NODE[@]}; do
   echo "$v upload ..."

+ 1 - 1
www.conf

@@ -5,7 +5,7 @@ include               mime.types;
 sendfile              on;
 charset               utf-8;
 
-# 安装步骤多,节省的流量不多,暂时不开
+# 安装步骤多,节省的流量不多,暂时不开
 # brotli_static         on;
 # gzip_static           on;
 gzip                  on;