通过使用 php 修改 htaccess 来阻止暴力攻击


Blocking bruteforce attack by modifying htaccess with php

当检测到暴力破解或DoS攻击时,是否可以接受(并且可能)通过在php中动态修改.htaccess文件来自动阻止IP地址?

是的,可以阻止 IP。 但是尝试以这种方式阻止DDos攻击是没有意义的,因为Apache进程已经生成。

Deny from xx.xx.xx.xx

阻止 IP 时,通常会在防火墙中输入规则以阻止该 IP。

我建议你看看 apache 安全模块

https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_security-with-apache-on-debian-ubuntu

此外,fail2ban是阻止暴力攻击的好方法。

https://www.linode.com/docs/security/using-fail2ban-for-security