WordPress作为一个市场占有量最高的CMS,其登录页面wp-login.php每天经受不少的爆破尝试,以我的博客为例,在短短24小时内就被(尝试)爆破了160次
要避免这个问题很简单,我主要用了以下两种方式
限制登录次数
有很多插件可以实现限制登录次数,这里以Limit Login Attempts Reloaded这个插件为例
插件分为免费以及付费版,不过免费版够用了
安装并启用插件,转到插件设置页面,可以设置尝试错误密码多少次后拦截
以下是我的设置:
After a specific IP address fails to log in 4 times, a lockout lasting 20 minutes is activated. If additional failed attempts occur within 24 hours and lead to another lockout, once their combined total hits 4, the 20 minutes duration is extended to 24 hours. The lockout will be lifted once 24 hours have passed since the last lockout incident.
添加验证码
常见的验证码有不少,Cloudflare Turnstile, reCAPTCHA, hCaptcha等等
我比较习惯用老牌的reCAPTCHA
先创建reCAPTCHA ,reCAPTCHA 类型可选V2, V3其中V2需要手动点击,而V3为无感验证
创建后会获得网站密钥及密钥,回到网站安装Advanced Google reCAPTCHA插件
启用插件后找到插件设置,填入Captcha Site Key, Captcha Secret Key,输入后会弹出Verify Captcha按钮,验证一次后即可保存设置
找到Where To Show菜单,这里可以验证码展示的位置,我选择关闭评论的验证码(因为我会手动筛选评论,而且不希望被JS拖慢网站速度)
最后,不要用admin这类的弱密码…
wp-login会被扫,可以把端口换一下,把wp- login重定向到404
是的,有插件WPS Hide Login可以做到