差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
it:server:保护 [2022-08-27 18:33] – goldentianya | it:server:保护 [2022-08-29 19:03] (当前版本) – [保护VPS] goldentianya | ||
---|---|---|---|
行 13: | 行 13: | ||
< | < | ||
sudo grep " | sudo grep " | ||
+ | </ | ||
+ | |||
+ | 3. 统计以root或者其它用户登录的次数 | ||
+ | < | ||
+ | sudo grep " | ||
+ | sudo grep " | ||
</ | </ | ||
行 21: | 行 27: | ||
* <color # | * <color # | ||
* <color # | * <color # | ||
+ | |||
+ | < | ||
+ | // 统计以 root 用户尝试登录到数量 | ||
+ | sudo grep " | ||
+ | // 统计以其它用户试登录到数量 | ||
+ | sudo grep " | ||
+ | </ | ||
< | < | ||
行 50: | 行 63: | ||
如果依然可以密码登录,则是 <color # | 如果依然可以密码登录,则是 <color # | ||
- | === fail2ban === | + | ===== fail2ban |
安装 fail2ban 防止攻击 <color # | 安装 fail2ban 防止攻击 <color # | ||
+ | 检查状态 <color # | ||
解锁ssh fail2ban-client set sshd unbanip < | 解锁ssh fail2ban-client set sshd unbanip < | ||
或者更改 / | 或者更改 / | ||
+ | |||
+ | |||
+ | 添加对nginx 和 wordpress 的保护 mkdir -p / | ||
+ | 然后重启服务 | ||
+ | * service fail2ban restart | ||
+ | * fail2ban-client reload | ||
+ | ++++ jail.local | | ||
+ | < | ||
+ | # 保护Linux,防止远程SSH爆破 | ||
+ | [ssh-iptables] | ||
+ | enabled = true | ||
+ | filter | ||
+ | action | ||
+ | logpath = / | ||
+ | |||
+ | # HTTP 验证防暴力破解 | ||
+ | [nginx-http-auth] | ||
+ | enabled | ||
+ | filter | ||
+ | port = http,https | ||
+ | logpath | ||
+ | |||
+ | # | ||
+ | [nginx-badbots] | ||
+ | enabled | ||
+ | port = http,https | ||
+ | filter | ||
+ | logpath | ||
+ | maxretry = 2 | ||
+ | |||
+ | # | ||
+ | [nginx-nohome] | ||
+ | enabled | ||
+ | port = http,https | ||
+ | filter | ||
+ | logpath | ||
+ | maxretry = 2 | ||
+ | |||
+ | #避免 nginx 被他人用于反向代理 | ||
+ | [nginx-noproxy] | ||
+ | enabled | ||
+ | port = http,https | ||
+ | filter | ||
+ | logpath | ||
+ | maxretry = 2 | ||
+ | |||
+ | #防范 WordPress 暴力破解登录请求 | ||
+ | [wp-login] | ||
+ | enabled = true | ||
+ | port = http,https | ||
+ | filter = wp-login | ||
+ | maxretry = 10 | ||
+ | findtime = 60 | ||
+ | bantime = 43600 | ||
+ | logpath | ||
+ | |||
+ | #防止 WordPress 受到 xmlrpc.php CC 攻击 | ||
+ | [xmlrpc] | ||
+ | enabled = true | ||
+ | port = http,https | ||
+ | filter = xmlrpc | ||
+ | logpath | ||
+ | bantime = 43600 | ||
+ | maxretry = 1 | ||
+ | findtime | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | |||
+ | |||
+ |