mail for root and periodic crontab reports

Post your general questions or comments about GhostBSD here!
Post Reply
Jes
Posts: 42
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Contact:

mail for root and periodic crontab reports

Post by Jes »

I'd like to review the crontab periodic execution reports but there's a problem with mail. I cannot send a mail to root and in /var/log/mailog I can read lines like :

sendmail[85968]: v0DLNmL5085968: to=root, ctladdr=jjess (1001/1001), delay=00:01:15, xdelay=00:01:15, mailer=relay, pri=30066, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Operation timed out with [127.0.0.1]

I guess the problem is sendmail is not running because in /etc/rc.conf I have this:

# Disable sendmail in livecd
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

This lines were added by the ghostbsd installation. Should I run sendmail in my computer? I don't like much sendmail (I used to run exim many years ago).

Wich would be the best solution in order to get mails from crontab periodic reports regarding to security?

Thanks

Jes
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

Re: mail for root and periodic crontab reports

Post by ASX »

Those settings (disable sendmail) were supposed to be only on liveDVD sessions, and not on an installed system, so that's a bug that need to be fixed.

sendmail_enable="YES" will fix that.
Jes
Posts: 42
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Contact:

Re: mail for root and periodic crontab reports

Post by Jes »

Thx AX.

Another question related to this. My /var/spool/clientmqueue had strange permissions and owner/group (root/wheel). Finding in the web it seems it should be:

drwxrwx--- 2 smmsp smmsp 1536 Jan 14 04:15 clientmqueue

So I don't know if those permissions and ownership was due to some wrong command I typed or it comes from the ghostbsd installation. Could you check in your machines?

BR
Jes
Posts: 42
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Contact:

Re: mail for root and periodic crontab reports

Post by Jes »

More related to this. Maybe it's a problem related to ghostbsd installation or I did something wrong in the past with /var/spool. But here how I fixed.

As root:

make -C /etc/mail aliases

chown root:smmsp /var/spool/clientmqueue
chmod ug+rwx /var/spool/clientmqueue

chmod ug+rwx /var/spool/mqueue

My /var/spool appear as:

drwxrwx--- 2 root smmsp 512 Jan 14 21:29 clientmqueue
drwx--x--- 3 root cups 512 Dec 6 09:25 cups
drwxr-x--x 3 root daemon 512 Dec 6 09:25 cups-pdf
dr-xr-xr-x 2 root wheel 512 Jan 14 12:24 lock
dr-xr-xr-x 2 root wheel 512 Mar 25 2016 lpd
drwxrwxr-x 2 root wheel 512 Jan 14 21:29 mqueue
dr-xr-xr-x 2 root wheel 512 Mar 25 2016 opielocks
dr-xr-xr-x 3 root wheel 512 Mar 25 2016 output

Test:

echo "que tal?" | mail -s "hola" root

and it works.
kraileth
Posts: 312
Joined: Sun Sep 04, 2016 12:30 pm

Re: mail for root and periodic crontab reports

Post by kraileth »

Jes wrote:drwxrwx--- 2 smmsp smmsp 1536 Jan 14 04:15 clientmqueue

So I don't know if those permissions and ownership was due to some wrong command I typed or it comes from the ghostbsd installation. Could you check in your machines?
Here's mine:

drwxrwx--- 2 smmsp smmsp 1024 15 Jan. 04:15 .

So you're right about this.
kraileth
Posts: 312
Joined: Sun Sep 04, 2016 12:30 pm

Re: mail for root and periodic crontab reports

Post by kraileth »

BTW:
# Disable sendmail in livecd
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
This is wrong, btw. Not only does the comment suggest that it shold not be transfered to the installed system, but it's not perfect on the live media, either. According to rc.sendmail(8):
rc.sendmail wrote:sendmail_enable
(str) If set to “YES”, run the sendmail(8) daemon at system boot time. If set to “NO”, do not run a sendmail(8) daemon to listen for incoming network mail. This does not preclude a sendmail(8) daemon listening on the SMTP port of the loopback interface. The “NONE” option is deprecated and should not be used. It will be removed in a future release.
I've checked back older versions: "NONE" was only the canonical way for a short period of time; rc.sendmail was introduced in FreeBSD 4.6 and remained that way up to 4.11. Even 5.0 deprecated this setting. I've seen it still being used quite frequently, though. But we should do things right, don't we? ;)
Post Reply