-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.toml.example
More file actions
117 lines (98 loc) · 4.49 KB
/
config.toml.example
File metadata and controls
117 lines (98 loc) · 4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# vshell-firewall 配置文件示例
# 支持 HTTP 和 TCP 处理器管道
# 全局配置
[global]
buffer_size = 32768 # 缓冲区大小 (字节)
log_level = "info" # 日志级别: debug, info, warn, error
log_file = "./vshell-firewall.log" # 日志文件路径,为空则只输出到控制台
# GeoIP 配置
[global.geoip]
enabled = false # 是否启用 GeoIP 检查
database_path = "./GeoLite2-Country.mmdb" # GeoIP 数据库路径 (下载: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data)
block_regions = ["US", "EU"] # 拦截的地区列表
# 支持国家代码(如 US, CN, GB)和大洲代码(如 EU, AS, NA, SA, AF, OC)
# EU 会自动匹配所有欧洲国家,包括:DE, FR, IT, ES, GB 等
# 时间窗口配置
[global.time_window]
enabled = false # 是否启用时间窗口过滤
timezone = "UTC" # 时区设置,如 "UTC", "Asia/Shanghai", "America/New_York"
start_time = "00:00" # 允许连接的开始时间 (HH:MM 格式)
end_time = "11:00" # 允许连接的结束时间 (HH:MM 格式)
# 窗口外时,现有连接保持,但新的 TCP 连接请求会被丢弃
# VShell 攻击防御配置
# VShell 是一款流行的C2/RAT工具,此模块可检测并拦截其攻击流量
[global.vshell_defense]
enabled = true # 是否启用 VShell 防御
block_websocket_upgrade = true # 拦截可疑的 WebSocket 升级请求 (VShell通过WebSocket通信)
block_version_handshake = true # 拦截 VShell 版本握手 (如 "4.9.3" 等版本号)
block_command_patterns = true # 拦截 VShell 命令模式 (conf, file, sucs 等)
block_encrypted_payloads = true # 拦截可疑的加密载荷 (AES-GCM 加密数据特征)
block_vkey_patterns = true # 拦截 Vkey 哈希模式 (MD5 哈希认证)
block_suspicious_paths = true # 拦截可疑路径 (/ws, /websocket, /beacon 等)
custom_block_paths = ["/c2", "/shell", "/cmd"] # 自定义拦截路径列表
blocked_vkeys = [] # 已知恶意 Vkey 黑名单 (可添加已知的 vkey 值)
log_attempts = true # 记录所有攻击尝试到日志
# 监听端口配置 - 可以配置多个
[[listeners]]
name = "http_proxy" # 监听器名称
listen_port = ":8880" # 监听端口
backend_addr = "127.0.0.1:9991" # 后端地址
protocol = "tcp" # 后端协议类型: tcp (目前仅支持 TCP)
# TODO: 未来支持 kcp/udp, websocket
# 超时配置
[listeners.timeout]
enabled = true # 是否启用超时
initial_read = 30 # 初始读取超时 (秒),0 表示无限制
connect_backend = 5 # 连接后端超时 (秒),0 表示无限制
# HTTP 处理器管道 - 按顺序匹配处理
# 路径重写示例
[[listeners.http.processor]]
path = "/patch_slt"
match_mode = "prefix" # 匹配模式: prefix (前缀), exact (精确), regex (正则)
action = "rewrite" # 动作: allow, drop, rewrite, file, proxy
rewrite_to = "/slt"
[[listeners.http.processor]]
path = "/patch_swt"
match_mode = "prefix"
action = "rewrite"
rewrite_to = "/swt"
# 路径过滤示例
[[listeners.http.processor]]
path = "/slt"
match_mode = "prefix"
action = "drop"
response = "404" # 响应类型: 404, 403, 502, close
[[listeners.http.processor]]
path = "/swt"
match_mode = "prefix"
action = "drop"
response = "404"
# 允许特定路径
[[listeners.http.processor]]
path = "/admin"
match_mode = "prefix"
action = "allow" # 转发到后端
# 文件响应示例
[[listeners.http.processor]]
path = ["/", "/index"] # 支持多个路径
action = "file" # 返回文件内容
file = "./index.html"
# TCP 处理器 - 处理非 HTTP 的 TCP 连接
[[listeners.tcp.processor]]
action = "drop" # 拒绝所有非 HTTP 的 TCP 连接
response = "close"
# TCP 处理器 - 处理非 HTTP 的 TCP 连接
[[listeners.tcp.processor]]
action = "drop" # 拒绝所有非 HTTP 的 TCP 连接
response = "close"
# 第二个监听器示例 - 纯 TCP 转发,无超时限制
[[listeners]]
name = "tcp_longconn"
listen_port = ":9880"
backend_addr = "127.0.0.1:9992"
protocol = "tcp" # TCP 协议
[listeners.timeout]
enabled = false # 禁用超时,适合长连接
# TCP 处理器 - 允许所有 TCP 连接
[[listeners.tcp.processor]]
action = "allow" # 转发到后端