OSSEC电子邮件通知无法发送电子邮件

Gag*_*ous 7 email error-handling smtp ossec

我在尝试获取ossec功能时遇到错误:电子邮件通知.我在这种情况下使用了我的Gmail帐户.我已经尝试过本教程,但是我无法收到任何电子邮件.我在警告里面得到了错误日志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$
Run Code Online (Sandbox Code Playgroud)

以下是我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>
Run Code Online (Sandbox Code Playgroud)

我已经填满<smtp_server>smtp.gmail.com.没有任何改变.它仍然在我的错误信息ossec.log

我怎样才能解决这个问题 ?我安装此应用程序Ubuntu Server: 16.04

Gag*_*ous 4

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

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

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

    sudo apt-get install postfix
    
    Run Code Online (Sandbox Code Playgroud)

    或者

    sudo apt-get install mailutils
    
    Run Code Online (Sandbox Code Playgroud)

    这将安装Postfix以及 . 之后您将看到选项,选择互联网站点

  3. 配置后缀

    搜索main.cf/etc/postfix/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
    
    Run Code Online (Sandbox Code Playgroud)

    sasl_passwd在 处编辑/etc/postfix/sasl_passwd,编辑文件并将以下行添加到sasl_passwd文件中:

    [smtp.gmail.com]:587    your_email_here:your_password here
    
    Run Code Online (Sandbox Code Playgroud)

    您应该将您想要作为 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>
    
    Run Code Online (Sandbox Code Playgroud)

更新于 22/05/2018

如需进一步配置,请阅读教程和