Answers:
我们遇到了同样的问题,可以很容易地绕过前面的maxlength限制(您可以通过从html 删除maximum-length-25类来自己尝试)。
所以这是我发现的东西:
解决方案1:通过IP屏蔽:从哥伦比亚到越南,每个帐户订阅都使用不同的IP ...
解决方案2:通过用户代理阻止:可以伪造...如果您想限制爬虫印迹,它可以工作。
解决方案3:使用HoneyPot:可能有效,但是如果该bot已经吸引了您,我认为它肯定知道要发布哪些字段(请参阅:https : //magento.stackexchange.com/a/104261/50635)
解决方案4:验证码(Magento或Google):可能有效,但有人说它已被超越
解决方案5:编辑电子邮件模板并添加确认电子邮件:
解决方案6:直接从customer_eav_attribute表中更新数据库的字段限制规则,用attribute_id = 5 [firstname]和attribute_id = 7 [lastname] 更新行,并将255替换为25:
a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}
a:2:{s:15:"max_text_length";i:25;s:15:"min_text_length";i:1;}
解决方案6似乎是防止垃圾广告的最快,更有效的方法,因为它们使用的字符超过25个。
从那时起,没有更多的假账户被创建!问题解决了。
如果他们尝试的次数更少,则至少会限制他们进行网络钓鱼的尝试。
您可以检查有多少个用户的名字或姓氏超过25个字符,在我们的例子中,实际上是次要的:
SELECT ce.entity_id, ce.email, cev2.value AS firstname, cev3.value AS lastname
FROM customer_entity ce
-- first name
INNER JOIN customer_entity_varchar cev2 ON (ce.entity_id = cev2.entity_id AND cev2.attribute_id = 5)
-- last name
INNER JOIN customer_entity_varchar cev3 ON (ce.entity_id = cev3.entity_id AND cev3.attribute_id = 7)
WHERE CHAR_LENGTH(cev2.value)>25 or CHAR_LENGTH(cev3.value)>25
有关为何注册这些假帐户的更多信息,请阅读此处:https : //magento.stackexchange.com/a/240710/50635
作为补充,我使用以下代码删除了垃圾邮件帐户:
$customers = $this->getCustomerCollection();
$this->registry->register('isSecureArea', true);
function isRussian($text) {
return preg_match('/[А-Яа-яЁё]/u', $text);
}
foreach($customers as $customer){
$name = $customer->getName();
if(isRussian($name)){
$customer->delete();
}
}
App/Code/Ibex/Deleter/view/frontend/templates/customer.phtml
,然后做了一个deleter_index_index.xml
文件Deleter/view/frontend/layout
与<块类=“北山羊\删除器\板块\删除” NAME =“删除”模板=“Ibex_Deleter :: character.phtml” />在那里,这样,当您可以访问yoursite.com/deleter,该代码将运行。只需确保随后停用并删除该模块即可。
如果可以,请使用cloudflare或其他防火墙阻止某些国家/地区。中国,香港,俄罗斯。但是,这并不能阻止所有垃圾邮件,并且如果您需要这些国家/地区能够访问这些功能,那么它也将无法正常工作。但是让我实际使用管理面板很有帮助,因为服务器受到了很大的冲击。
如果尚未将Magento更新到2.3.0+,请启用Google Recaptcha中的版本或使用其他插件。
在Magento 2.3中启用内置的Google reCAPTCHA。
1)前往[商店]> [设定]> [设定]> [安全性]> [Google reCAPTCHA]。2)产生Recaptcha v2不可见的Recaptcha或我不是机器人密钥。3)将它们输入到该页面上的admin配置中,并在前端将其启用以供“创建用户”使用。
但是,启用其他功能也不会真正造成伤害。
为了清理现有帐户,请在其输入中找到模式,并创建查询以选择它们,同时确保普通用户不属于该组数据。
您可以从customer_entity表中删除它们。
我从一个清理过的站点中获取的示例SQL:精心制作自己的站点 ,因为需要注意您的情况,如果您先擦除错误的用户进行备份,则数据集等对我不负责任!
DELETE FROM customer_entity
WHERE SUBSTRING_INDEX(email, '\@', -1) IN ('pp.com',
'sf-express.com',
'qqlong.com',
'kinohit.win',
'sohu.com',
'21cn.com',
'yeah.net',
'koreamail.com',
'aliyun.com',
'mail.ru',
'VIP.SINA.COM',
'yahoo.co.in',
'icload.com',
'sogou.com',
'vip.qq.com',
'sina.cn',
'189.cn',
'wo.com.cn',
'qq.cn',
'sina.com.cn',
'126.cn',
'yahoo.com.cn',
'3g.cn',
'163.com',
'167.com',
'139.com',
'126.com',
'130.com',
'144.com',
'123.com',
'ca800.com',
'168.com',
'188.com',
'1974.com',
'qq.co',
'sina.com',
'qq.com',
'qq.con',
'QQ.come',
'yandex.com',
'5ol.com',
'yeat.net',
'yahoo.cn')
OR lastname LIKE '%http://%'
OR lastname LIKE '%https://%'
OR lastname LIKE '%【%】%'
OR lastname LIKE '%tw55.cc%'
OR lastname LIKE '%www.ope2228.com%'
确保旧的基本Magento验证码已禁用。客户>客户配置>验证码
在店面中启用CAPTCHA:否
因为它将与Google reCAPTCHA冲突...
官方文档链接:
https://docs.magento.com/m2/ce/user_guide/configuration/security/google-recaptcha.html
https://docs.magento.com/m2/ce/user_guide/stores/security-google-recaptcha.html
这些漫游器似乎击中了帐户创建端点(即使您从主题中删除了“创建帐户”按钮/链接,也可以),但是建议删除其帐户或将其停用,因为它们可能会睡到很晚,然后再发送垃圾邮件,并且会占用其中的空间反正你的数据库...
祝大家好运。
您可以轻松地将域设置为阻止状态,并设置当用户尝试向阻止列表中的电子邮件域注册时显示的错误消息。完整说明如下-
在文件夹Ecomsolver中创建一个名为EmailCheck的新模块
步骤– 1 在管理面板上编写以下代码。该文件的路径将是–Ecomsolver >EmailCheck > etc > Adminhtml > System
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="ecomsolver" translate="label" sortOrder="999">
<label>Ecomsolver</label>
</tab>
<section id="emailblock" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Email Check</label>
<tab>ecomsolver</tab>
<resource>PixieMedia_General::general_config</resource>
<group id="domains" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Domain Names</label>
<field id="domains" translate="label" type="textarea" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Domain names to block</label>
<comment>Comma separated values eg google.co.uk,mail.ru,some.com</comment>
</field>
<field id="message" translate="label" type="textarea" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Message to display</label>
<comment>The error message to show users who try to register with one of the above domain names</comment>
</field>
</group>
</section>
</system>
</config>
步骤– 2在文件中编写以下代码。该文件的路径将是–
Ecomsolver >EmailCheck > etc > Frontend > di
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Customer\Controller\Account\CreatePost">
<plugin name="restrictCustomerEmail"
type="Ecomsolver\Emailcheck\Model\Plugin\Controller\Account\RestrictCustomerEmail"/>
</type>
</config>
步骤– 3在名为Config的XML文件中编写以下代码。该文件的路径将是–Ecomsolver >EmailCheck > etc > Config
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<emailblock>
<domains>
<domains>163.com,mail.ru</domains>
</domains>
<message>
<domains>We do not allow registration from your email domain</domains>
</message>
</emailblock>
</default>
</config>
步骤– 4在名为Module的XML文件中编写以下代码。该文件的路径将是–Ecomsolver >EmailCheck > etc > Module
<config xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Ecomsolver_Emailcheck" setup_version="1.0.0">
</module>
</config>
步骤– 5 在EmailCheck中创建文件夹名称Model。然后创建子文件夹Plugin > Controller > Account
。在名为RestrictCustomerEmail的php文件中编写以下代码。php文件的路径为–Ecomsolver >EmailCheck > Plugin > Controller > Account > RestrictCustomerEmail
/*Ecomsolver @@@@@@ ecomsolver@gmail.com*/
namespace Ecomsolver\Emailcheck\Model\Plugin\Controller\Account;
use Magento\Framework\Controller\Result\RedirectFactory;
use Magento\Framework\UrlFactory;
use Magento\Framework\Message\ManagerInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
class RestrictCustomerEmail {
/**
* @var \Magento\Framework\UrlInterface
*/
protected $urlModel;
/**
* @var \Magento\Framework\Controller\Result\RedirectFactory
*/
protected $resultRedirectFactory;
/**
* @var \Magento\Framework\Message\ManagerInterface
*/
protected $messageManager;
/**
* RestrictCustomerEmail constructor.
* @param UrlFactory $urlFactory
* @param RedirectFactory $redirectFactory
* @param ManagerInterface $messageManager
*/
public function __construct(
UrlFactory $urlFactory,
RedirectFactory $redirectFactory,
ManagerInterface $messageManager,
ScopeConfigInterface $scopeConfig
)
{
$this->urlModel = $urlFactory->create();
$this->resultRedirectFactory = $redirectFactory;
$this->messageManager = $messageManager;
$this->scopeConfig = $scopeConfig;
}
/**
* @param \Magento\Customer\Controller\Account\CreatePost $subject
* @param \Closure $proceed
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function aroundExecute(
\Magento\Customer\Controller\Account\CreatePost $subject,
\Closure $proceed
)
{
/** @var \Magento\Framework\App\RequestInterface $request */
$email = $subject->getRequest()->getParam('email');
list($nick, $domain) = explode('@', $email, 2);
$domains = $this->scopeConfig->getValue('emailblock/domains/domains', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
if(!$domains) {
return $proceed;
}
$domainArray = array_map('trim', explode(',', $domains));
if(count($domainArray) < 1) {
return $proceed;
}
if (in_array($domain, $domainArray, true)){
$message = $this->scopeConfig->getValue('emailblock/domains/message', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
if(!$message) { $message = __('We do not allow registration from your email domain'); }
$this->messageManager->addErrorMessage($message);
$defaultUrl = $this->urlModel->getUrl('*/*/create', ['_secure' => true]);
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
return $resultRedirect->setUrl($defaultUrl);
}
return $proceed();
}
}
我已经通过将以下代码添加到.htaccess中作为调试批次来解决了该问题,但我什么都没找到,但是当我在得到客户保存时创建了一个事件之后,现在又重新使用了。
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_USER_AGENT} "rv:40\.0\)\ Gecko/20100101\ Firefox/40\.1$" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Gecko.*Gecko" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Gecko/([a-z]|[A-Z])\." [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Gecko/\ " [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Gecko/20([2-9])" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Gecko/201([1-9])"
</IfModule>