gpt4 book ai didi

elasticsearch - elastalert中的电子邮件发送错误。 SMTPSenderRefused:(530,'5.5.1需要身份验证)

转载 作者:行者123 更新时间:2023-12-02 22:22:42 27 4
gpt4 key购买 nike

我收到了Gmail身份验证错误。我的配置和错误消息如下
我已经允许使用不太安全的Gmail应用。

Config.yaml文件电子邮件部分,如下

 name: frequency_rule
type: frequency
index: security
num_events: 50

timeframe:
days: 1

filter:
- term:
host.keyword : "azure-2"
alert:
- email
email:
"to_address@gmail.com"

smtp_host: "smtp.gmail.com"
smtp_port: "465"
smtp_ssl: true
from_addr: "from_address@gmail.com"
user: "from_address@gmail.com"
password: "password"

错误消息如下
PS C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master> python -m elastalert.elastalert --verbose --config ./config.yaml --rule ./alert_rules/frequency4.yaml
INFO:elastalert:Starting up
INFO:elastalert:Queried rule frequency_rule4 from 2017-11-20 09:48 Central Standard Time to 2017-11-21 09:48 Central Standard Time: 24 / 24 hits
ERROR:root:Traceback (most recent call last):
File "C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master\elastalert\elastalert.py", line 1246, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master\elastalert\elastalert.py", line 1326, in send_alert
alert.alert(matches)
File "elastalert\alerts.py", line 451, in alert
self.smtp.sendmail(self.from_addr, to_addr, email_msg.as_string())
File "C:\Python27\lib\smtplib.py", line 737, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError l4sm636961ioc.69 - gsmtp', 'from_address@gmail.com')

ERROR:root:Uncaught exception running rule frequency_rule4: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError l4sm636961ioc.69 - gsmt

最佳答案

userpassword字段不应存储在同一config.yaml文件中,而应存储在config.yaml中引用的another file中。

例如,创建另一个名为auth.yaml的文件,并将userpassword配置添加到其中:

user: "from_address@gmail.com"
password: "password"

然后可以在config.yaml中使用以下设置引用该文件:
smtp_auth_file: "/path/to/auth.yaml"

关于elasticsearch - elastalert中的电子邮件发送错误。 SMTPSenderRefused:(530,'5.5.1需要身份验证),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474069/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com