LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2019, 03:48 PM   #1
Corvette
Member
 
Registered: Jul 2017
Location: Missouri, United States
Distribution: Debian 9
Posts: 110

Rep: Reputation: 24
Difficulty Configuring OSSEC to Send Email Notifications Through GMail SMTP


Greetings:
I am attempt to set up OSSEC to send email notifications through Google's SMTP on my CentOS system. I have referenced the following tutorial: https://myopsblog.wordpress.com/2017...ts-from-gmail/

I have sSMTP package functioning. That is, I can send email to my Yahoo account through something such as follows:
Code:
ssmtp xxx@yahoo.com < message.txt
However, OSSEC fails to send email alerts properly.

Code:
2019/02/22 05:10:01 ossec-maild(1223): ERROR: Error Sending email to localhost (smtp server)
My ssmtp.conf file:

Code:
AuthMethod=LOGIN
AuthUser=xxx@gmail.com
AuthPass=xxx
mailhub=smtp.gmail.com:587
UseSTARTTLS=yes
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
FromLineOverride=YES
rewriteDomain=gmail.com
UseTLS=YES
My ossec.conf file:

Code:
<global>
    <email_notification>yes</email_notification>
    <email_to>xxxx@yahoo.com</email_to>
    <smtp_server>localhost</smtp_server>
    <email_from>xxx@gmail.com</email_from>
  </global>
Any advice would be appreciated.Based upon the article referenced above, the OSSEC config should be simple, but I am having no success.
Thanks.
 
Old 02-23-2019, 04:44 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Why are you configuring ossec to use localhost? Do you have a mail server configured? As you've configured ssmtp, it's not a mail server but just a connector to gmail, as I understand it.

Can you configure ossec to use ssmtp? If not try configuring ossec to use gmail directly, as you've done for ssmtp.
 
Old 02-23-2019, 05:15 PM   #3
Corvette
Member
 
Registered: Jul 2017
Location: Missouri, United States
Distribution: Debian 9
Posts: 110

Original Poster
Rep: Reputation: 24
Thanks for the response. I was configuring OSSEC to use localhost because, according to the article/tutorial I was following:
"Local postfix will redirect all delivery requests to gmail user set in SSMTP."
This may be incorrect, but I am not familar enough with either Postfix or sSMTP to say for certain one way or another.

Unfortunately, I do not see how I would configure OSSEC to use GMail directly, since I see no way to specify necessary options such as port, credentials, etc. According to my understanding of the OSSEC documentation, there are only a handful of options relevant to email - smtp_server, email_to, email_from, etc.

While I have some familiarity with e-mail protocols, I have never set-up a full SMTP server on a system. If my current sSMTP configuration is not capable of performing the task of forwarding OSSEC's request to GMail, is there some sSMTP configuration that can be performed, or must a different MTA package/utility be used?

Thanks.
 
Old 02-23-2019, 05:36 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Corvette View Post
Thanks for the response. I was configuring OSSEC to use localhost because, according to the article/tutorial I was following:
"Local postfix will redirect all delivery requests to gmail user set in SSMTP."
This may be incorrect, but I am not familar enough with either Postfix or sSMTP to say for certain one way or another.
That's probably correct, but, apparently, you are not running postfix, or any MTA (Mail Transport Agent) as sendmail, qmail, dovecot, etc.

Reading the how-to about OSSEC on digitalocean.com I find.
Quote:
Optional: If you want to send mail from a local SMTP server, you should install Postfix for simple email sending
 
1 members found this post helpful.
Old 02-23-2019, 05:52 PM   #5
Corvette
Member
 
Registered: Jul 2017
Location: Missouri, United States
Distribution: Debian 9
Posts: 110

Original Poster
Rep: Reputation: 24
I actually do have Postfix installed and running; it was installed with the system. I just never touched any of the configuration files. I am guessing I have to configure Postfix itself; configuring the sSMTP package is not sufficient even though I can send email through the command line? Sorry, for the stupid question; I am a bit unclear on the relationship between Postfix and sSMTP. The article I was following explained how to configure sSMTP, but only referenced installing (not detailing the configuration of) Postfix.

Thanks.
 
Old 02-23-2019, 06:26 PM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
If postfix is running, perhaps the only issue is that it's not "at" localhost. Try using 127.0.0.1 instead of localhost in your ossec configuration.
 
1 members found this post helpful.
Old 02-23-2019, 06:34 PM   #7
Corvette
Member
 
Registered: Jul 2017
Location: Missouri, United States
Distribution: Debian 9
Posts: 110

Original Poster
Rep: Reputation: 24
That was indeed the problem. Really not sure why OSSEC was not able to find the Postfix server at localhost, but it did with the IP. Thanks much!
 
Old 02-23-2019, 11:50 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Glad I could help.

What’s in /etc/hosts?

Last edited by scasey; 02-23-2019 at 11:52 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to send email notifications using Gmail SMTP server on Linux LXer Syndicated Linux News 0 11-12-2015 02:30 PM
LXer: How to send email notifications using Gmail SMTP server on Linux LXer Syndicated Linux News 0 11-09-2015 12:00 AM
Webmin - Send monitoring notifications through gmail rather than local mail server adenicol Linux - Server 7 02-22-2012 11:49 AM
Can't get Nagios 3.3.1 to send email Notifications but smtp port works fine in shell Kahndale Linux - General 1 12-16-2011 03:15 PM
Command based email client to send email through secure smtp havolinec Linux - Newbie 2 07-27-2010 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration