Discussion:
[bareos-users] bsmtp
Dakota Pilot
2018-07-24 16:23:57 UTC
Permalink
I'm now trying to get bareos to email my backup admin account. I can run bsmtp from the command line and email gets through but when I run a job Bareos sends nothing. It's set to send all with mail = myemail =all,!skipped, !saved, !audit.

If set up my messages mailcommand to be identical to the command line which works

mailcommand = "/usr/bin/bsmtp -f validemail -s BareosTest myemail

mail = myemail = all,!skipped,!saved,!audit


no email is sent.

So what am I missing? I'm on Centos 7.

I assume I could run mail/mailx which also works fine on my system. Is there any reason to stick with bsmtp over mail? I know bsmtp is a very simple client but given it works from the command line it should work from Bareos.

The docs also say Bareos consolidates emails and sends those for a job as one email so I assume that is Bareos itself and not bsmtp.

What
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Lawley
2018-07-24 16:39:04 UTC
Permalink
This is what I have, missing HOST?

mailcommand = "/usr/bin/bsmtp -h mail.xxxx.com -f \"\(Bareos\) \<%r\>\"
-s \"Bareos daemon message\" %r"
Post by Dakota Pilot
I'm now trying to get bareos to email my backup admin account. I can run bsmtp from the command line and email gets through but when I run a job Bareos sends nothing. It's set to send all with mail = myemail =all,!skipped, !saved, !audit.
If set up my messages mailcommand to be identical to the command line which works
mailcommand = "/usr/bin/bsmtp -f validemail -s BareosTest myemail
mail = myemail = all,!skipped,!saved,!audit
no email is sent.
So what am I missing? I'm on Centos 7.
I assume I could run mail/mailx which also works fine on my system. Is there any reason to stick with bsmtp over mail? I know bsmtp is a very simple client but given it works from the command line it should work from Bareos.
The docs also say Bareos consolidates emails and sends those for a job as one email so I assume that is Bareos itself and not bsmtp.
What
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-24 16:54:12 UTC
Permalink
Hmm. I'll try it and see what happens. It works on the command line with no host given. What is the host - your own email server? There is none on the baeros server so would that be mail.myhost.com?

Thanks.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Lawley
2018-07-24 17:22:46 UTC
Permalink
There is a section in the manual C.4.1 that covers bsmtp and how to set
this up.

It's pretty flexible, but that email server is our email for our domain.
Not one located on the bareos server itself.
Post by Dakota Pilot
Hmm. I'll try it and see what happens. It works on the command line with no host given. What is the host - your own email server? There is none on the baeros server so would that be mail.myhost.com?
Thanks.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-24 17:35:47 UTC
Permalink
I've read that section - many times <G>. I'll play around with it then and see if it works with my mail server.

Thanks.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-25 16:25:38 UTC
Permalink
I'm still working on it. Mail and bsmtp work fine from the command line but not from Bareos.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-26 16:12:09 UTC
Permalink
I finally got it working but the solution may not apply to all. I have a local network behind a Netgate firewall with various subnets for servers, etc and the Bareos server is in the server network. I do NOT have a local mail server on this domain corp.xxx.net. I do have a mail server on a hosting service I use that is xxx.com domain.

I tried all the permutations and combinations of things with bmstp and mail. The -h localhost did not work for me. I was trying to communicate with an email address on user.xxx.com domain. I dug through the mail logs on my local machine. Since my server, the localhost localserver.corp.xx.net, was unknown to the mail server for user.xxx.com it got rejected. I set a whitelist for my IP assigned by my ISP on the mail server at xxx.com and things started working.

If I had a local mail server that would also work but at this point I'm not ready to set one up now. Maybe later.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-26 20:59:00 UTC
Permalink
More information. Sometimes we have a duh! moment!! I should have know that it Thunderbird was connecting but Bareos wasn't what was going on. The account I am connection to requires authentication with a username and password so not only was the server unknown but there was no authentication. This link, https://www.binarytides.com/linux-mail-with-smtp/, may help fix this so I'm going to try it.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bruno Friedmann
2018-07-27 19:40:19 UTC
Permalink
Post by Dakota Pilot
I finally got it working but the solution may not apply to all. I have a
local network behind a Netgate firewall with various subnets for servers,
etc and the Bareos server is in the server network. I do NOT have a local
mail server on this domain corp.xxx.net. I do have a mail server on a
hosting service I use that is xxx.com domain.
I tried all the permutations and combinations of things with bmstp and mail.
The -h localhost did not work for me. I was trying to communicate with an
email address on user.xxx.com domain. I dug through the mail logs on my
local machine. Since my server, the localhost localserver.corp.xx.net, was
unknown to the mail server for user.xxx.com it got rejected. I set a
whitelist for my IP assigned by my ISP on the mail server at xxx.com and
things started working.
If I had a local mail server that would also work but at this point I'm not
ready to set one up now. Maybe later.
You just need to setup a local service able to forward to a relay host.
So you local postfix for example is easily configurable to use
smtp submission port 587 with a dedicated username/password paar
and with valid email aliases.
bonus you can also communicate encrypted using tls connection to your mail
serveur.

I show you here an example of my setup (a bit anonyzed)
(this is normally a one line)
MailCommand = "/usr/sbin/bsmtp -8 -a -h localhost -f \"server1 Bareos
\<***@mydomain.tld\>\" -s \"server1-bareos: %n %t %e of %c %l\" %r"

my local postfix as my main real mailer declared as relay host,
and the credential needed to connect to it.
--
Bruno Friedmann
Ioda-Net Sàrl www.ioda-net.ch
Bareos Partner, openSUSE Member, fsfe fellowship
GPG KEY : D5C9B751C4653227
irc: tigerfoot

openSUSE Tumbleweed
Linux 4.16.9-1-default x86_64 GNU/Linux, nvidia: 390.59
Qt: 5.10.0, KDE Frameworks: 5.46.0, Plasma: 5.12.5, kmail2 5.8.1
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-27 19:44:07 UTC
Permalink
Thanks. Yes, that's what I was thinking of doing. I'll give it a try.

Is there a place to put this in a postfix configuration file so I don't need the credentials on the command line?
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bruno Friedmann
2018-07-27 20:03:58 UTC
Permalink
Post by Dakota Pilot
Thanks. Yes, that's what I was thinking of doing. I'll give it a try.
Is there a place to put this in a postfix configuration file so I don't need
the credentials on the command line?
yes in /etc/postfix/sasl_passwd (don't forget the 0600 root only)

cat sasl_passwd
[fqdn.mail.tld]:587 username:YouPassW0rd
# sasl_passwd
# Syntax:
# domain username:password
# Example:
# foo.com username:password

then a postmap sasl_passwd to have the new value updated and postfix reload
restart.

should to the trick
--
Bruno Friedmann
Ioda-Net Sàrl www.ioda-net.ch
Bareos Partner, openSUSE Member, fsfe fellowship
GPG KEY : D5C9B751C4653227
irc: tigerfoot

openSUSE Tumbleweed
Linux 4.16.9-1-default x86_64 GNU/Linux, nvidia: 390.59
Qt: 5.10.0, KDE Frameworks: 5.46.0, Plasma: 5.12.5, kmail2 5.8.1
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-27 20:05:03 UTC
Permalink
Great. Thanks. I'll give that a try later tonight.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dakota Pilot
2018-07-29 20:45:40 UTC
Permalink
Okay. I got it working. I just had to go into /etc/mail.rc and add these commands at the end.

account backupadmin {
set smtp-use-starttls
set ssl-verify=ignore
set smtp-auth=login
set folder=imaps://***@mydomain.com:port/INBOX
set from=fromaddr
set smtp-auth-user=theuser
set smtp-auth-password=thepasword
set nss-config=/etc/ssl/certs/ca-bundle.crt
}

I use
mailcommand = "mailx -A backupadmin -s \"The subject\" recipients"

It works great so far.
--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users+***@googlegroups.com.
To post to this group, send email to bareos-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...