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") + } + } } }