Email Setup

The forum for help and support with FreeNATS as well as any useful hints and tips
damiansadler
Posts: 1
Joined: Thu Jun 26, 2008 10:05 am

Email Setup

Post by damiansadler » Thu Jun 26, 2008 10:12 am

Hello,

I wonder if you can help. I'm having trouble setting up the email alerts. I'm not sure where to start?

Cheers.
D

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Email Setup

Post by dave » Thu Jun 26, 2008 6:05 pm

Hi there,

Emails are generated by an "Alert Action".

Alert actions are setup through the Admin page and can either be a list of email addresses to send to or a list of URLs to connect to (for URL-based alerting). More information on alerts and alert actions is contained within this section of the documentation but briefly to setup email alerting you would:

Go to the admin page
Select alert actions from the list
Select create new alert action
Give it a name, select the type as email and enter the addresses to send to one per line.
Click update action
(You can now test that email is working by using the test action link - you must have clicked update action to save the changes first though)

Once you have created this alert action when you edit any node you will see it listed at the bottom of the node edit page. Here you can tick the box for the new alert action and click update alert actions.

As long as the node has the option "alerts enabled" ticked it will now send a mail to everyone listed in that alert action when it fails.

You can optionally set the alert action to include events such as warnings and alert closures as well.

I hope that helps to resolve your problem. If you have any further problems please let me know.

Cheers,

Dave.

wolfgang
Posts: 21
Joined: Wed Jun 11, 2008 9:09 pm
Location: Montreal, Canada

Re: Email Setup

Post by wolfgang » Mon Jul 07, 2008 2:28 am

Hi,

At first, I love the concept!!!! :-)
Where do you configure the email server for sending emails?
Thanks,Wolfgang

wolfgang
Posts: 21
Joined: Wed Jun 11, 2008 9:09 pm
Location: Montreal, Canada

Re: Email Setup

Post by wolfgang » Tue Jul 08, 2008 3:17 pm

Hmmm, I am still struggling with my alerting with email. I assume that there is a buildt in email server in freeNATS VM, if this is the case then i know why my email is not working, because my ISP (and most others also) block outgoing email from servers in network. To avoid this i would like to know where to configure the outgoing email server, to use the outgoing email server of my ISP instead of the buildt in email server of freeNATs VM.
Dave can you confirm if it shall work with buildt in email server? and if yes how to configure for external outgoing email server?

Thanks,Wolfgang

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Email Setup

Post by dave » Tue Jul 08, 2008 6:05 pm

wolfgang wrote:Hmmm, I am still struggling with my alerting with email. I assume that there is a buildt in email server in freeNATS VM, if this is the case then i know why my email is not working, because my ISP (and most others also) block outgoing email from servers in network. To avoid this i would like to know where to configure the outgoing email server, to use the outgoing email server of my ISP instead of the buildt in email server of freeNATs VM.
Dave can you confirm if it shall work with buildt in email server? and if yes how to configure for external outgoing email server?
Ah yes I'm afraid that is a bit of an issue right now. The VM uses sendmail to send email which will try and deliver directly to the domain.

If you want to configure a mail relay (a "smart" relay in sendmail-speak) then I am afraid what you will need to do is:

- Login to the console as root
- Edit the file /etc/mail/sendmail.cf using the following command:

Code: Select all

pico /etc/mail/sendmail.cf
- Using page down go down to the bit that says (five page-downs):

Code: Select all

# "Smart" relay host (may be null)
DS
(n.b. this is in the "Local Settings" section of the file if you have trouble finding it)
- Change the DS line to read:

Code: Select all

DSmy.mailserver.com
(you can use an IP address - no space between the DS and the mail server)
- Save the file with Control-X and then pressing return to accept the filename

At this point you will want to probably clear your mail queue as it will be full of all the failed messages

Code: Select all

rm -Rf /var/spool/mqueue/*
Edit:Sorry but the line above was missing a / which deleted the mqueue directory (and maybe other things!)

- Now restart sendmail

Code: Select all

/etc/rc.d/init.d/sendmail stop
[i]will output a stop message...[/i]
/etc/rc.d/init.d/sendmail stop
[i]should fail to stop this time...[/i]
/etc/rc.d/init.d/sendmail start
After issuing the start you should see "Starting Sendmail: Ok". If it fails make a careful note of the exact error.

This should now cause sendmail to relay mail through the SMTP server specified.

A few notes though: this won't work if you normally need to authenticate to the mail server to send mail and you may suffer from a problem another user has had if your ISP has very strict anti-spam rules (unlikely).

If you make the change, sendmail starts ok and you still don't get mail wait until you've tried to send a few and then grab a copy/screenshot of the outputs of the following commands on the console:

Code: Select all

mailq
tail -c 1024 /var/log/maillog
Let me know how you get on. Sorry for the console editing - I'm looking at putting some sort of easy configurator in.

Regards,

Dave.

bsemingson
Posts: 4
Joined: Thu Aug 28, 2008 10:27 pm

Email Alerts

Post by bsemingson » Fri Aug 29, 2008 12:00 am

I get the alert messages from rPath regarding updates.
I do see 2 main types of error emails in the FreeNATS root mailbox.
The first one is: "<<<550 5.7.1 <myemailaddress>... we do not relay <apache@localhost.localdomain.com>...
550 5.1.1 <myemailaddress>... User unknown."
The second message error is: "/etc/cron.five/freenats-monitor.sh:
/etc/cron.five/freenat-monitor.sh: ./test-threaded.sh: /usr/bin/php: bad interpreter: No such file or directory."

The second message started after I updated FreeNATS.

Do you see this as an issue on our mail server or in the config of FreeNATS? If in the mail server, why rPath notice work and not FreeNATS?

Thanks for the help

bps

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Email Setup

Post by dave » Fri Aug 29, 2008 8:57 am

hi there,

rpath and bats alerts use a different method of delivery. Have you set a mail relay (outgoing mail server) for rpath?

With regard to the other error- what version of FreeNATS are you running please? And do you know what you upgraded from for the error to start. I'll have a proper look when I get home tonight.

Cheers,

Dave

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Email Setup

Post by dave » Fri Aug 29, 2008 4:31 pm

Ok I think this is two different problems - one slightly more serious than the other

Email Problem

I can't tell from the error which email server it is rejecting the email for relaying: yours, some ISP or the actual FreeNATS sendmail process itself. Can you post one of the messages in full (with whatever obscured) so I can see who it was talking to when the error occurred.

It might just be that rPath formats its source better or perhaps you've specified a relay?

Is the Email From address in the alert action valid?

If it's FreeNATS dodgy formatting then it's probably a quick fix. If you need to alter the mail relay then it depends which version of FreeNATS you're running (the development version has mail relay configurable in the interface http://www.purplepixie.org/freenats/wiki/Mail_Settings).

PHP Problem

I've just run 0.02.25b and then 1.00.12a on the 3.3b VM and couldn't replicate the fault. I have no idea how/why php has moved/disappeared from your VM. It is very odd.

Until it's fixed then none of your testing will actually be happening.

Can you try the following commands:

Code: Select all

which php
php -v
cd /opt/freenats/server/bin
./tester.sh freenats
And let me know what the output is. If any of the commands fail have a look and see what files are in /usr/local/bin

Code: Select all

ls /usr/local/bin
I'm wondering if it somehow got deleted?

bsemingson
Posts: 4
Joined: Thu Aug 28, 2008 10:27 pm

Re: Email Setup

Post by bsemingson » Fri Aug 29, 2008 8:27 pm

Hello Dave,

Regarding the rev-up, I went from 3.3b to 4.25b.

I use the same internal mail server for both rPath and Freenats. Neither of the 'From' email addresses are valid. I do not use a relay in rPath.

The results of running the version commands were to error with command not found

The contents of the bin directory are as follows:
arch df gzexe mount sh unlink
ash dmsg gzip mv sleep usleep
ash.static dnsdomainname hostname netstat sort vi
awk doexec igawk nice sty view
basename domainname ipcalc nisdomainname su vim-minimal
bash dumpkeys kbd_mode pgawk sync ypdomainname
bsh echo kill ping tar zcat
cat Egrep link ping6 touch zcmp
chgrp env ln ps tracepath zdiff
chmod ex loadkeys pwd tracepath6 zfgrep
chown false login rm traceroute6 zfgrep
cp fgrep ls rmdir true zforce
cpio gawk mkdir rvi umount zgrep
cut grep mknod rview uname zless
date gtar mktemp sed unicode_start zmore
dd gunzip more setfont unicode_stop znew

I'll submit the content of the emails shortly

Thanks for the help

bps

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Email Setup

Post by dave » Fri Aug 29, 2008 8:53 pm

Email Setup
If you are using an internal mail server is it valid for MX lookups from an internal DNS server?

By default sendmail will queue the message and try and deliver it by looking up the mail servers (MX records) for the domain and then delivering it directly to them via SMTP. If you're using internal-only email addresses the system must be able to resolve them via DNS.

If it is getting that far then your mail server is rejecting the connection based upon one of from From headers. Let's see if we can get the other problem sorted then can look at it in more detail.

PHP Issue
What was the result of the which php and the other commands please?

Also - I think there is a bit of confusion over the version. There are two different things - the Virtual Appliance which I'm assuming is 3.3b in your case and then the actual FreeNATS software which is run on it, which I'm assuming is 0.04.25b?

Oh and lastly sorry I gave you the wrong directory. Can you try a

Code: Select all

ls /usr/bin
It should have loads of files in it - one of which should be php.


Is it possible for me to get remote SSH access to the system? I could hopefully diagnose both bugs quite quickly. I think you can private message via this forum, if not post a reply and I'll email you with my private contact details.

Cheers,

Dave.

Post Reply