SMTP TO: address problem

Status
Not open for further replies.

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
I can't get the daily security/run reports to send to the correct TO: address.

I've followed the email setup here http://forums.freenas.org/showthrea...orting-via-email&p=24071&viewfull=1#post24071

(In my case I'll substitute my domain name for shampoo.com to illustrate.)

I have an SMTP server for my domain running inside my LAN already so SMTP setup is simple to mail.shampoo.com:25, no auth (allows local network without auth).

I have updated the root account with my personal email me@shampoo.com

I can send test emails from the Settings->Email tab using From: "admin@freenas.shampoo.com", SMTP server mail.shampoo.com, port 25, no auth, and I receive these perfectly.

I've tried this several times, and even rebooted (freenas 8.3.1-RELEASE).

I do get the daily security run report and the daily run reports, but ONLY because the address they are sent to root@mail.shampoo.com happens to be forwarded to me@shampoo.com on the mail server itself.

Why is freenas sending to root@mail.shampoo.com when there is no configuration item containing that address and I've never used it, for anything, ever.

Any ideas?

Thanks
dsiminiuk
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
Thanks for the RTFM link, but I'm not a noob. I've followed instructions to update the root account with my personal email. It just doesn't work as described.
 

unijabnx2000

Dabbler
Joined
Mar 30, 2012
Messages
27
Thanks for the RTFM link, but I'm not a noob. I've followed instructions to update the root account with my personal email. It just doesn't work as described.

It worked on mine. I setup an exchange server on a .local domain so id have somewhere to send those logs and my firewall logs.

Hope you figure it out GL.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I have no advice. I'm not understanding where root@mail.shampoo.com is coming from. FreeNAS sends email to whatever the root user's email address is. For instance, mine is ***@gmail.com.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
Looking at my SMTP logs it appears to be sending to the right place. Now I have to figure out why it's being re-written on the mail server.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
I changed my email settings to use my GMAIL account to send with and it is logging into the SMTP server and sending to "root". This is why my local mail server was presenting it as root@mail.shampoo.com.

Here is the pertinent part from the GMail message when viewing the "Show original"

Subject: freenas.shampoo.com daily run output
From: myusername@gmail.com
To: root
Date: Mon, 15 Apr 2013 08:01:01 -0000

----

And of course root with no domain name is delivered nowhere.

As I stated before, I have my root user set up as myusername@shampoo.com and I have the email settings set to use GMail with SMTP auth and it sends test messages just fine, yet the daily reports go to "root".

Any other ideas? Turn these reports off and embed the email address in the scripts?
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
Where can I verify the alias of root?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Look at your "root" email address under the users section of FreeNAS. This was what I was trying to get you to look at above when I said:

FreeNAS sends email to whatever the root user's email address is. For instance, mine is ***@gmail.com.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
Yes, I have myusername@shampoo.com (not my real address of course) as root's email address like here...

2013-04-16 11_31_36-freenas - FreeNAS-8.3.png

The on demand SMTP test works fine. See here...

2013-04-16 11_36_45-Test message from FreeNAS gmail.png

However, the daily run reports STILL send to the username "root", no domain name, just "root". See here...

2013-04-16 11_40_26-freenas.siminiuk.com security run output gmail.png

I see an alias for root in /etc/mail/aliases and it is correct.

root: myusername@shampoo.com

In fact it is in the file TWICE!

Code:
# $FreeBSD: releng/8.3/etc/mail/aliases 220104 2011-03-28 17:41:10Z trociny $
#       @(#)aliases     5.3 (Berkeley) 5/24/90
#
#  Aliases in this file will NOT be expanded in the header from
#  Mail, but WILL be visible over networks.
#
#       >>>>>>>>>>      The program "newaliases" must be run after
#       >> NOTE >>      this file is updated for any changes to
#       >>>>>>>>>>      show through to sendmail.
#
#
# See also RFC 2142, `MAILBOX NAMES FOR COMMON SERVICES, ROLES
# AND FUNCTIONS', May 1997
#       http://tools.ietf.org/html/rfc2142

# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.

root:   myusername@shampoo.com

# Basic system aliases -- these MUST be present
MAILER-DAEMON: postmaster
postmaster: root

# General redirections for pseudo accounts
_dhcp:  root
_pflogd: root
bin:    root
bind:   root
daemon: root
games:  root
hast:   root
kmem:   root
mailnull: postmaster
man:    root
news:   root
nobody: root
operator: root
pop:    root
proxy:  root
smmsp:  postmaster
sshd:   root
system: root
toor:   root
tty:    root
usenet: news
uucp:   root

# Well-known aliases -- these should be filled in!
# manager:
# dumper:

# BUSINESS-RELATED MAILBOX NAMES
# info:
# marketing:
# sales:
# support:

# NETWORK OPERATIONS MAILBOX NAMES
abuse:  root
# noc:          root
security:       root

# SUPPORT MAILBOX NAMES FOR SPECIFIC INTERNET SERVICES
ftp:            root
ftp-bugs:       ftp
# hostmaster:   root
# webmaster:    root
# www:          webmaster

# NOTE: /var/msgs and /var/msgs/bounds must be owned by sendmail's
#       DefaultUser (defaults to mailnull) for the msgs alias to work.
#
# msgs: "| /usr/bin/msgs -s"

# bit-bucket: /dev/null
# dev-null: bit-bucket
# $FreeBSD: releng/8.3/etc/mail/aliases 220104 2011-03-28 17:41:10Z trociny $
#       @(#)aliases     5.3 (Berkeley) 5/24/90
#
#  Aliases in this file will NOT be expanded in the header from
#  Mail, but WILL be visible over networks.
#
#       >>>>>>>>>>      The program "newaliases" must be run after
#       >> NOTE >>      this file is updated for any changes to
#       >>>>>>>>>>      show through to sendmail.
#
#
# See also RFC 2142, `MAILBOX NAMES FOR COMMON SERVICES, ROLES
# AND FUNCTIONS', May 1997
#       http://tools.ietf.org/html/rfc2142

# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.

root: myusername@shampoo.com

# Basic system aliases -- these MUST be present
MAILER-DAEMON: postmaster
postmaster: root

# General redirections for pseudo accounts
_dhcp:  root
_pflogd: root
bin:    root
bind:   root
daemon: root
games:  root
hast:   root
kmem:   root
mailnull: postmaster
man:    root
news:   root
nobody: root
operator: root
pop:    root
proxy:  root
smmsp:  postmaster
sshd:   root
system: root
toor:   root
tty:    root
usenet: news
uucp:   root

# Well-known aliases -- these should be filled in!
# manager:
# dumper:

# BUSINESS-RELATED MAILBOX NAMES
# info:
# marketing:
# sales:
# support:

# NETWORK OPERATIONS MAILBOX NAMES
abuse:  root
# noc:          root
security:       root

# SUPPORT MAILBOX NAMES FOR SPECIFIC INTERNET SERVICES
ftp:            root
ftp-bugs:       ftp
# hostmaster:   root
# webmaster:    root
# www:          webmaster

# NOTE: /var/msgs and /var/msgs/bounds must be owned by sendmail's
#       DefaultUser (defaults to mailnull) for the msgs alias to work.
#
# msgs: "| /usr/bin/msgs -s"

# bit-bucket: /dev/null
# dev-null: bit-bucket
Daniel: daniel@shampoo.com
Mimi: mimi@shampoo.com
xbox: xbox@shampoo.com


Hmm... it looks like the file has been appended with another copy of itself. Look for the "$FreeBSD" to find the beginning of the 2nd copy.

Maybe because I have added other users for CIFS shares (see the bottom) it has not overwritten the file but appended to it?

I edited the aliases file, deleted the top half. Saved it. The file says I should run newalises but that doesn't work.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
I changed the email on one of my CIFS users and sure enough, the aliases file had double the content in it again, with the only difference being that the CIFS users appear only in the 2nd copy.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Sounds like your configuration is FUBAR somehow.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
It's a brand new installation. Not even a month old. It appears to be FU but that doesn't mean it is BAR.

Can somebody tell me what process creates the /etc/mail/aliases file when a user is changed?

-rw-r--r-- 1 root wheel 1756 Apr 16 12:08 aliases

After splitting the file into one copy (again) I updated chmoded the file to 664.

-rw-rw-r-- 1 root wheel 1756 Apr 16 12:08 aliases

Then I changed the root user email just to see if it also doubles up the aliases file.

Interestingly, the top half of the aliases file has the old email me@shampoo.com and the bottom half has the new email address myself@shampoo.com. go figure.

So it appears that the bottom half is being updated only. This may have been part of the problem because root was directed to two different addresses. IF there is a newalises command running somewhere it should have complained about the duplicate root.

There is an aliases file in /conf/base/etc/mail but that is a read only file system. However, it has my personal email address in it for root.

mount -rw /

cp aliases aliases.bak

edit aliases and remove root: me@shampoo.com and all comments. Leave the aliases from all others to root.

Now when I update the email of any CIFS user or the root account these values appear in the /etc/aliases/mail file only once.

When I run "periodic daily" however, the message is still being sent to "root" (no domain name).

This isn't fixed yet.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
Calling sendmail invokes the python script /etc/find_alias_for_smtplib.py from the entry in /etc/mail/mailer.conf

There is an alias lookup function inside the script so there is no need for the aliases.db file or the newalises utility.

Sending mail with commands "sendmail root" or "sendmail me@shampoo.com" both work!!! I receive the message either way. That tells me that there isn't an issue with the mailer.

I'm going to have a closer look at periodic now and see how mail is sent from there.
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
I edited /etc/defaults/periodic.conf and replaced all the "root" targets to my email address and ran it and I received the reports just fine.

It appears that something in periodic is bypassing the python mailer.

I'm done with this for now.
 
Joined
Aug 22, 2013
Messages
1
I'm having the exact same issue here. Emails are being sent daily from freenas to my smtp relay but are landing in the badmail folder with the following error:

Diagnostic-Code: smtp;554 Transaction failed: Missing final '@domain'
...
Here is the original header sent from freenas:

Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: freenas.mycompany.com daily run output
From: freenas@mycompany.com
To: root
Date: Thu, 22 Aug 2013 10:01:01 -0000
Return-Path: freenas@mycompany.com

freenas.PNG


Thought that upgrading to 9.1 last night might fix it but did not.
Like dsiminiuk said the "test email" function works just fine sending to my address.
I'll mention that I have not tried any backend fixes to this system, purely GUI configured (just basic file sharing) and only using CIFS and SMART service.

Theres my .2 I'll post back if I figure anything out.

Other than this minor issue I would like to state that I'm having a great time with freenas, awesome free product!
 

BossyBear

Dabbler
Joined
Mar 27, 2013
Messages
48
agent_boinker, I also did a fresh installation of 9.1 and the "problem" has returned.

But is it a problem really?

I do receive the email that is apparently sent "To: root@mail.shampoo.com", this is the name shown in message, however on closer inspection of the header you may find that it is being sent to the correct email after all. It appears that the email shown in the "To:" field is just confusing things.

I again edited /etc/defaults/periodic.conf and replaced "root" with my email anyway, because I want it to have MY address in the "To:" field as you would expect, just like it is in the test message.
 
Status
Not open for further replies.
Top