bsmtp

536 views
Skip to first unread message

Dakota Pilot

unread,
Jul 24, 2018, 12:23:57 PM7/24/18
to bareos-users
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

David Lawley

unread,
Jul 24, 2018, 12:39:14 PM7/24/18
to bareos...@googlegroups.com
This is what I have, missing HOST?

mailcommand = "/usr/bin/bsmtp -h mail.xxxx.com -f \"\(Bareos\) \<%r\>\"
-s \"Bareos daemon message\" %r"

Dakota Pilot

unread,
Jul 24, 2018, 12:54:12 PM7/24/18
to bareos-users
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.

David Lawley

unread,
Jul 24, 2018, 1:22:55 PM7/24/18
to bareos...@googlegroups.com
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.

Dakota Pilot

unread,
Jul 24, 2018, 1:35:47 PM7/24/18
to bareos-users
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.

Dakota Pilot

unread,
Jul 25, 2018, 12:25:39 PM7/25/18
to bareos-users
I'm still working on it. Mail and bsmtp work fine from the command line but not from Bareos.

Dakota Pilot

unread,
Jul 26, 2018, 12:12:10 PM7/26/18
to bareos-users
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.

Dakota Pilot

unread,
Jul 26, 2018, 4:59:01 PM7/26/18
to bareos-users
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.

Bruno Friedmann

unread,
Jul 27, 2018, 3:40:29 PM7/27/18
to bareos...@googlegroups.com
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
\<ser...@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



Dakota Pilot

unread,
Jul 27, 2018, 3:44:07 PM7/27/18
to bareos-users
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?

Bruno Friedmann

unread,
Jul 27, 2018, 4:04:03 PM7/27/18
to bareos...@googlegroups.com
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

Dakota Pilot

unread,
Jul 27, 2018, 4:05:03 PM7/27/18
to bareos-users
Great. Thanks. I'll give that a try later tonight.

Dakota Pilot

unread,
Jul 29, 2018, 4:45:40 PM7/29/18
to bareos-users
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://us...@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.

Reply all
Reply to author
Forward
0 new messages