From ad3d82f270c4fc95bda3bca4bdeab0e97ca342de Mon Sep 17 00:00:00 2001 From: wulabing Date: Wed, 15 Jun 2022 20:28:58 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20ss=5Fwhitlist=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20=E9=80=9A=E8=BF=87=E8=AE=BF=E9=97=AE=20/purge=20=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E5=90=8D=E5=8D=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ss_whitelist/README.MD | 4 ++++ ss_whitelist/config/nginx.conf | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ss_whitelist/README.MD b/ss_whitelist/README.MD index e7be382..9dd1662 100644 --- a/ss_whitelist/README.MD +++ b/ss_whitelist/README.MD @@ -28,3 +28,7 @@ 大部分代理使用场景都是在固定场所,在一定时间内有相对固定的 IP,因此在大部分情况下,通过白名单限制访问 ss 的 IP 来源方式相对可行 +## 使用方法 + +* 访问 IP/域名 输入鉴权信息,添加当前 IP 地址进入白名单 +* 访问 /purge 清空白名单信息 diff --git a/ss_whitelist/config/nginx.conf b/ss_whitelist/config/nginx.conf index a594757..43d1230 100644 --- a/ss_whitelist/config/nginx.conf +++ b/ss_whitelist/config/nginx.conf @@ -110,5 +110,19 @@ http { os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload") } } + location /purge { + auth_basic ""; + auth_basic_user_file /etc/openresty/auth; + add_header Content-Type text/plain; + content_by_lua_block { + ngx.header.content_type = "text/plain;charset=UTF-8"; + file = io.open("/etc/openresty/allow.list","w") + io.input(file) + io.output(file) + ngx.print("IP列表已被清空") + io.close(file) + os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload") + } + } } }