OSSEC电子邮件通知无法发送电子邮件 [英] OSSEC email notification failed to send an email
问题描述
尝试获取ossec功能时出现错误:电子邮件通知。在这种情况下,我使用了我的Gmail帐户。我已经尝试过教程,
,但我无法从中获取任何电子邮件。我收到错误日志并发出警告服务器未接受邮件
。它位于 /var/ossec/logs/ossec.log
中,您可以在下面看到日志。
I am getting an error when trying to get the ossec features: email notification. I used my Gmail account for this case. I have tried this tutorial,
but i couldn't get any email from that. I got the error log inside with warn Mail not accepted by server
. It was located at /var/ossec/logs/ossec.log
you could see the log below.
2017/10/06 20:05:18 os_sendmail(1764): WARN: Mail from not accepted by server
2017/10/06 20:05:18 ossec-maild(1223): ERROR: Error Sending email to 74.125.200$
2017/10/06 20:05:58 ossec-syscheckd: INFO: Starting syscheck scan (forwarding d$
2017/10/06 20:05:58 ossec-syscheckd: INFO: Starting syscheck database (pre-scan$
2017/10/06 20:05:58 ossec-syscheckd: INFO: Initializing real time file monitori$
这是我的 ossec.conf
中的电子邮件配置$ c> /var/ossec/etc/ossec.conf
Here are my configuration for email in ossec.conf
located at /var/ossec/etc/ossec.conf
<global>
<email_notification>yes</email_notification>
<email_to>myrealemailaccount@gmail.com</email_to>
<smtp_server>smtp.gmail.com.</smtp_server>
<email_from>ossecm@gantz-X450CC</email_from>
<email_maxperhour>20</email_maxperhour>
<email_from>myrealemailaccount@gmail.com</email_from>
</global>
我已经填满了我的< smtp_server>
到 smtp.gmail.com
。一切都没有改变。在我的 ossec.log
I have filled my <smtp_server>
to smtp.gmail.com
. And nothing's change. Its still got the error message at my ossec.log
我该如何解决呢?我在 Ubuntu服务器上安装了此应用程序:16.04
How can i fix this ? I installing this application on Ubuntu Server: 16.04
推荐答案
我终于得到了解决方案。就我而言,我使用了 Postfix 将我的帐户gmail连接到我的本地主机。如果您有自己的专用电子邮件服务器(例如在服务器中),那将很棒,而不是使用gmail。
I finally got the solution. For my case, i used Postfix to connect my account gmail to my localhost. If you have your own dedicated Email server, like in your server, it woud be great, rather than using gmail.
-
确保您已经更新了Linux。
Make sure you have update your linux.
apt-get update
通过终端安装postfix,如果无法安装postfix,请尝试更改 /etc/sources.list
中的存储库位置,然后更新linux中使用 apt-get update
,直到可以在命令下运行
Install postfix via terminal , if you cant install postfix, try changing your repositories location in /etc/sources.list
and than update your linux in using apt-get update
, untill you can run below command
sudo apt-get install postfix
或
sudo apt-get install mailutils
将安装Postfix以及为
。之后,您将获得选择,选择 Internet站点
that will install Postfix as well as a few other programs needed for . After that you will get option, choose Internet Site
配置Postfix
在 /etc/postfix/main.cf
中搜索 main.cf
,使用<$ c编辑文件$ c> nano 。在文件末尾添加此语法。
Search main.cf
at /etc/postfix/main.cf
, edit the file using nano
. Add this syntax at the end of file.
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
在 / etc / postfix / sasl_passwd编辑
,编辑文件,然后将以下行添加到 sasl_passwd
sasl_passwd
文件:
[smtp.gmail.com]:587 your_email_here:your_password here
将您要作为ossec电子邮件通知发件人的电子邮件放在该 sasl_pawd上。
You should put your email that you want to as a sender of ossec email notification on that `sasl_pawd. Not as a receiver.
编辑您的 /var/ossec/etc/ossec.conf
,然后更改SMTP以浏览本地IP,例如 127.0.0.1
或 localhost
Edit your /var/ossec/etc/ossec.conf
, and change your SMTP to tour local ip like 127.0.0.1
or localhost
<global>
<email_notification>yes</email_notification>
<email_to>your email that want to be send to</email_to>
<smtp_server>localhost</smtp_server>
<email_from>127.0.0.1</email_from> #if 127.0.0.1 didnt work ,try same email address which you put in your sasl passwd
<email_maxperhour>100</email_maxperhour>
</global>
已更新2018年5月22日
For further configuration, please read this tutorial and this
这篇关于OSSEC电子邮件通知无法发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!