View Issue Details

IDProjectCategoryView StatusLast Update
0001391bareos-coredirectorpublic2021-12-07 14:20
Reporterjeffb255 Assigned Tobruno-at-bareos  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSCentOSOS Version7
Fixed in Version20.0.3 
Summary0001391: When trying to send messages to more than one recipient postfix indicates that there is a syntax error
DescriptionI am trying to send daemon messages to more than one person using a main postfix system, the configuration is correct using director version 19.2.7:

Messages {
  Name = Daemon
  Description = "Message delivery for daemon messages (no job)."
  mail command = "/usr/bin/bsmtp -h 172.16.22.72 -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" \%r"
# mail = john@example.com = all, !skipped, !audit # (0000002)
  mail = john@example.com, fred@example.com = all, !skipped, !audit # (0000002)
  console = all, !skipped, !saved, !audit
  append = "/var/log/bareos/bareos.log" = all, !skipped, !audit
  append = "/var/log/bareos/bareos-audit.log" = audit
}

Steps To ReproduceAdd a comma after the first name and add a second name.
Additional InformationThe remote postfix system shows:

postfix/smtpd: warning: Illegal address syntax from unknown[172.16.22.22] in RCPT command: <john@example.com fred@example.com>

and does not send the message.
TagsNo tags attached.

Activities

bruno-at-bareos

bruno-at-bareos

2021-10-11 13:23

manager   ~0004296

Hello,

From bsmtp man page
USAGE
       recipients is a space separated list of email addresses.

Did you already try that ?
jeffb255

jeffb255

2021-10-11 19:38

reporter   ~0004300

In the Bareos documentation, for the messages configuration files, it states:

Mail
Type: MESSAGES
Send the message to the email addresses that are given as a comma separated list in the address field.

So, when I did not place a comma separating the email addresses, bconsole would display:

11-Oct 13:12 bareos-dir-22-dir: ERROR in lib/res.cc:368 Config error: expected an =, got: fred@example.com
            : line 12, col 72 of file /etc/bareos/bareos-dir.d/messages/Daemon.conf
 mail = john@example.com fred@example.com = all, !skipped, !audit # (0000002)

11-Oct 13:12 bareos-dir-22-dir: ERROR in lib/parse_conf_state_machine.cc:189 Config error: unexpected token 110 BCT_EQUALS in resource definition
            : line 12, col 74 of file /etc/bareos/bareos-dir.d/messages/Daemon.conf
 mail = john@example.com fred@example.com = all, !skipped, !audit # (0000002)

11-Oct 13:12 bareos-dir-22-dir: ERROR in lib/parse_conf.cc:260 Config error: ParseAllTokens failed.
            : line 12, col 74 of file /etc/bareos/bareos-dir.d/messages/Daemon.conf
 mail = john@example.com fred@example.com = all, !skipped, !audit # (0000002)

11-Oct 13:12 bareos-dir-22-dir JobId 0: Error: Please correct the configuration in /etc/bareos/bareos-dir.d/*/*.conf
11-Oct 13:12 bareos-dir-22-dir JobId 0: Error: Resetting to previous configuration.
*

I manually ran bsmtp and was able to send a test message without the comma.
With the comma, I would get a syntax error:

 wibsmtp: tools/bsmtp.cc:130-0 Fatal malformed reply from 172.16.0.72: 501 5.1.3 Bad recipient address syntax

Oct 11 13:26:17 mail4 postfix/smtpd[994956]: warning: Illegal address syntax from unknown[172.16.22.22] in RCPT command: <john@example.com,fred@example.com>

Is there a program that can be used with Bareos, that accepts comma separated email addresses or does the routine in Bareos need to be modified to change the comma to a space when it is using bsmtp to send then emails out?
bruno-at-bareos

bruno-at-bareos

2021-10-12 15:37

manager   ~0004301

Thank you for the report and additional info. I found where is located the trouble.

So nor the documentation is wrong, nor the man page. But all of those tools are really nitpicky: it happen that you have a SPACE after the comma
I've just tried and it work flawless if you use user1@domain.tld,user2@domain.tld
Really email separated by coma.
The "without any space" will be added to the documentation see PR#954 https://github.com/bareos/bareos/pull/954
bruno-at-bareos

bruno-at-bareos

2021-10-12 15:39

manager   ~0004302

PR#954 improve documentation by adding a without any space in comma separate list
jeffb255

jeffb255

2021-10-12 21:30

reporter   ~0004303

I removed the space and still have the problem.

Standard.conf
Messages {
  Name = Standard
  Description = "Reasonable message delivery -- send most everything to email address and to the console."
  operatorcommand = "/usr/bin/bsmtp -h 172.16.0.65 -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r"
# mail command = "/usr/bin/bsmtp -h 172.16.0.72 -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" \%r"
  mail command = "/usr/bin/bsmtp -h 172.16.0.72 -f \"\(Bareos\) \%r\\" -s \"Bareos: %t %e of %c %l\" %r"
# operator = root = mount # (0000003)
  operator = biwc.bareos@gmail.com = mount # (0000003)
  mail = john@example.com,fred@example.com = all, !skipped, !audit # (0000002)
  console = all, !skipped, !saved, !audit
  append = "/var/log/bareos/bareos.log" = all, !skipped, !saved, !audit
  catalog = all, !skipped, !saved, !audit
}

Oct 12 15:06:00 mail4 postfix/smtpd[1558370]: warning: Illegal address syntax from unknown[172.16.22.22] in MAIL command: <john@example.com fred@example.com>

I tried it with what you used:

Standard.conf

Messages {
  Name = Standard
  Description = "Reasonable message delivery -- send most everything to email address and to the console."
  operatorcommand = "/usr/bin/bsmtp -h 172.16.0.65 -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r"
  mail command = "/usr/bin/bsmtp -h 172.16.0.72 -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" \%r"
# mail command = "/usr/bin/bsmtp -h 172.16.0.72 -f \"\(Bareos\) \%r\\" -s \"Bareos: %t %e of %c %l\" %r"
# operator = root = mount # (0000003)
# mail = john@example.com,fred@example.com = all, !skipped, !audit # (0000002)
  mail = user1@domain.tld,user2@domain.tld = all, !skipped, !audit # (0000002)
  console = all, !skipped, !saved, !audit
  append = "/var/log/bareos/bareos.log" = all, !skipped, !saved, !audit
  catalog = all, !skipped, !saved, !audit
}

/var/log/messages:

Oct 12 15:23:40 bareos-dir-22 bareos-dir: 12-Oct 15:23 Message delivery ERROR: Mail prog: bsmtp: tools/bsmtp.cc:130-0 Fatal malformed reply from 172.16.0.72: 501 5.1.7 Bad sender address syntax
Oct 12 15:23:40 bareos-dir-22 bareos-dir: 12-Oct 15:23 Message delivery ERROR: Mail program terminated in error.#012CMD=/usr/bin/bsmtp -h 172.16.0.72 -f "(Bareos) <user1@domain.tld user2@domain.tld>" -s "Bareos: Backup OK of mail1-fd Incremental" user1@domain.tld user2@domain.tld#012ERR=Child exited with code 1

/var/log/maillog on remote:

Oct 12 15:23:40 mail4 postfix/smtpd[1560000]: warning: Illegal address syntax from unknown[172.16.0.22] in MAIL command: <user1@domain.tld user2@domain.tld>

P.S. The bsmtp linux man page states that it is space separated too.
bruno-at-bareos

bruno-at-bareos

2021-10-13 10:03

manager   ~0004305

Sorry to say that, but everything is in detail, you will have to care about them. ;-)

The error message you have is about the sender address, not the recipient, and I can only agree with postfix
<user1@domain.tld user2@domain.tld> is not a valid sender address ;-)

Simply you have use %r in the -f flag when %r is only one address this is a valid way of doing things,
when %r contain several addresses this no more true.
You can perhaps use a generic hostmaster@domain.tld valid address
using your example this would give something like

```
mail command = "/usr/bin/bsmtp -h 172.16.0.72 -f \"\(Bareos\) \<hostmaster@example.com\>\" -s \"Bareos: %t %e of %c %l\" \%r"
```

Hope this help to fix your issues.
Regards, Bruno
bruno-at-bareos

bruno-at-bareos

2021-11-10 09:57

manager   ~0004323

Can we have feedback from this case ? Otherwise can it be closed ?
bruno-at-bareos

bruno-at-bareos

2021-12-07 14:20

manager   ~0004381

Fix for space published
No negative return from reporter
Documentation (master) state clearly %r = recipient

Issue History

Date Modified Username Field Change
2021-10-08 20:58 jeffb255 New Issue
2021-10-11 13:23 bruno-at-bareos Note Added: 0004296
2021-10-11 13:25 bruno-at-bareos Assigned To => bruno-at-bareos
2021-10-11 13:25 bruno-at-bareos Status new => assigned
2021-10-11 19:38 jeffb255 Note Added: 0004300
2021-10-12 15:37 bruno-at-bareos Note Added: 0004301
2021-10-12 15:39 bruno-at-bareos Status assigned => confirmed
2021-10-12 15:39 bruno-at-bareos Note Added: 0004302
2021-10-12 21:30 jeffb255 Note Added: 0004303
2021-10-13 10:03 bruno-at-bareos Note Added: 0004305
2021-11-10 09:57 bruno-at-bareos Note Added: 0004323
2021-12-07 14:20 bruno-at-bareos Status confirmed => closed
2021-12-07 14:20 bruno-at-bareos Resolution open => fixed
2021-12-07 14:20 bruno-at-bareos Fixed in Version => 20.0.3
2021-12-07 14:20 bruno-at-bareos Note Added: 0004381