WIP-CHECKPOINT[auth-refactor]: 固化工程师崩溃前部分成果 + 同树其他未提交WIP(仅源码,不含密钥/二进制)-- 待重激活工程师续作
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import re
|
||||
|
||||
# 读取nginx.conf
|
||||
with open('/etc/nginx/nginx.conf', 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# 找到/itadmin/ location块并替换
|
||||
old_block = '''location /itadmin/ {
|
||||
# IP 白名单:仅允许内网网段
|
||||
allow 10.0.0.0/8;
|
||||
allow 172.16.0.0/12;
|
||||
allow 192.168.0.0/16;
|
||||
allow 10.212.0.0/16; # VPN 网段
|
||||
deny all;'''
|
||||
|
||||
new_block = '''location /itadmin/ {
|
||||
# IP 白名单:仅允许内网网段 + 临时公网IP
|
||||
allow 10.0.0.0/8;
|
||||
allow 172.16.0.0/12;
|
||||
allow 192.168.0.0/16;
|
||||
allow 10.212.0.0/16; # VPN 网段
|
||||
allow 43.174.152.34; # 临时添加 (2026-07-06)
|
||||
deny all;'''
|
||||
|
||||
content = content.replace(old_block, new_block)
|
||||
|
||||
# 写回
|
||||
with open('/etc/nginx/nginx.conf', 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print('Done')
|
||||
Reference in New Issue
Block a user