[pkg-bacula-devel] Bug#935886: does not email properly, violating RFC821

Antoine Beaupré anarcat at debian.org
Wed Sep 25 19:23:52 BST 2019


On 2019-08-27 09:57:50, Peter Palfrader wrote:
> Package: bacula-director
> Version: 9.4.2-1
> Severity: normal
>
> This is actually against 9.4.2-1~bpo9+1 on stretch.
>
> With postfix setting strict_rfc821_envelopes = yes and
>
> | root at dictyotum:~# grep bacula-service /etc/bacula/ -r
> | /etc/bacula/bacula-dir.conf:  mail on error = bacula-service at torproject.org = all, !skipped
> | /etc/bacula/bacula-dir.conf:  operator = bacula-service at torproject.org = mount
> | /etc/bacula/bacula-dir.conf:  mail = bacula-service at torproject.org = all, !skipped
>
> emails don't work:
>
> | root at dictyotum:~# cat /var/log/mail.warn-20190827 
> | Aug 26 19:13:40 dictyotum/dictyotum postfix/smtpd[1301]: warning: Illegal address syntax from localhost[127.0.0.1] in MAIL command: <(Bacula) bacula-service at torproject.org>

This is actually a problem with the documentation as well. In chapter 22
[Messages Resources][], it says:

    mailcommand = "/home/kern/bacula/bin/bsmtp -h mail.example.com -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"

[Messages Resources]: https://www.bacula.org/9.4.x-manuals/en/main/Messages_Resource.html

And unfortunately, this configuration is shipped in the Debian package,
in /usr/share/bacula-common/defconfig/bacula-dir.conf

We made this patch locally to workaround the problem:

@@ -121,7 +121,7 @@ Messages {
 # Message delivery for daemon messages (no job).
 Messages {
   Name = Daemon
-  mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
+  mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"%r\" -s \"Bacula daemon message\" %r"
   mail = <%= @email_daemon %> = all
   console = all, !skipped, !saved
   syslog = all

And `strict_rfc821_envelopes = yes` works again.

Interestingly, the 9.4.4 version might actually be correct, at least in
the manpage, which says:

         mailcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) \<%r\>\"
                                  -s \"Bacula: %t %e of %c %l\" %r"
         operatorcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f \"\(Bacula\) \<%r\>\"
                                        -s \"Bacula: Intervention needed for %j\" %r"

... but I haven't tested that configuration. The safest thing would be
to remove all "(Bacula)" stuff from any mailcommand out there. Here are
the possibly affected source files:

anarcat at curie:bacula-9.4.4(master)$ grep -r bsmtp.*Bacula
examples/conf/m4.bacula-dir.conf:  mailcommand = "/opt/bacula/sbin/bsmtp -h ifm.liu.se -f \"\(Bacula\) bacula at ifm.liu.se\" -s \"Bacula: %t %e of %c %l\" %r"
examples/conf/m4.bacula-dir.conf:  operatorcommand = "/opt/bacula/sbin/bsmtp -h ifm.liu.se -f \"\(Bacula\) bacula at ifm.liu.se\" -s \"Bacula: Intervention needed for %j\" %r"
.pc/debian/fix-default-config/src/dird/bacula-dir.conf.in:  mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
.pc/debian/fix-default-config/src/dird/bacula-dir.conf.in:  operatorcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
.pc/debian/fix-default-config/src/dird/bacula-dir.conf.in:  mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
scripts/btraceback.in:    | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula DBX traceback of ${PNAME}" @dump_email@
scripts/btraceback.in:    | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula GDB traceback of ${PNAME}" @dump_email@
manpages/bsmtp.1: bsmtp \- Bacula's SMTP client (mail submission program)
manpages/bsmtp.1:  mailcommand = "/home/bacula/bin/bsmtp \-h mail.domain.com \-f \\"\\(Bacula\\) \\<%r\\>\\"
manpages/bsmtp.1:  operatorcommand = "/home/bacula/bin/bsmtp \-h mail.domain.com \-f \\"\\(Bacula\\) \\<%r\\>\\"
src/win32/full_win32_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
src/win32/full_win32_installer/bacula-dir.conf.in:  operatorcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
src/win32/full_win32_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
src/win32/win64_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
src/win32/win64_installer/bacula-dir.conf.in:  operatorcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
src/win32/win64_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
src/win32/win32_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
src/win32/win32_installer/bacula-dir.conf.in:  operatorcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
src/win32/win32_installer/bacula-dir.conf.in:  mailcommand = "\"@bin_dir@\\bsmtp\" -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
src/dird/bacula-dir.conf.in:  mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
src/dird/bacula-dir.conf.in:  operatorcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"
src/dird/bacula-dir.conf.in:  mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"

Cheers,

A.

-- 
The survival of humans and other species on planet Earth in my view can
only be guaranteed via a timely transition towards a stationary
state, a world economy without growth.
                         - Peter Custers



More information about the pkg-bacula-devel mailing list