【问题标题】:OSSEC email notification failed to send an emailOSSEC 电子邮件通知发送电子邮件失败
【发布时间】:2017-10-05 12:14:40
【问题描述】:

我在尝试获取 ossec 功能时遇到错误:电子邮件通知。在这种情况下,我使用了我的 Gmail 帐户。我试过这个tutorial, 但我无法收到任何电子邮件。我收到了带有警告Mail not accepted by server 的错误日志。它位于/var/ossec/logs/ossec.log,您可以在下面看到日志。

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 中的电子邮件配置,位于/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>

我已将&lt;smtp_server&gt; 填写为smtp.gmail.com。什么都没有改变。它仍然在我的ossec.log 收到错误消息

我该如何解决这个问题?我在Ubuntu Server: 16.04上安装了这个应用程序

【问题讨论】:

    标签: email error-handling smtp ossec


    【解决方案1】:

    我终于找到了解决方案。就我而言,我使用Postfix 将我的帐户 gmail 连接到我的本地主机。如果您有自己的专用电子邮件服务器,比如在您的服务器中,那就太好了,而不是使用 gmail。

    1. 确保您已更新您的 linux。

      apt-get update
      
    2. 通过终端安装 postfix,如果无法安装 postfix,请尝试在 /etc/sources.list 中更改您的存储库位置,然后使用 apt-get update 更新您的 linux,直到您可以运行以下命令

      sudo apt-get install postfix
      

      sudo apt-get install mailutils
      

      这将安装 Postfix 以及 few other programs needed for .之后你会得到选项,选择Internet Site

    3. 配置后缀

      /etc/postfix/main.cf 搜索main.cf,使用nano 编辑文件。在文件末尾添加此语法。

      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
      

      编辑sasl_passwd/etc/postfix/sasl_passwd,编辑文件并将下面的行添加到sasl_passwd文件:

      [smtp.gmail.com]:587    your_email_here:your_password here
      

      您应该将您想要作为 ossec 电子邮件通知发件人的电子邮件放在 `sasl_pawd.不是作为接收者。

    4. 编辑您的/var/ossec/etc/ossec.conf,并将您的 SMTP 更改为访问本地 IP,例如 127.0.0.1localhost

        <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 日更新

    更多配置请阅读this教程和this

    【讨论】:

      猜你喜欢
      • 2017-12-08
      • 1970-01-01
      • 2017-12-19
      • 1970-01-01
      • 2017-02-09
      • 1970-01-01
      • 2016-07-26
      • 1970-01-01
      • 2012-05-07
      相关资源
      最近更新 更多