Bug#935886: does not email properly, violating RFC821

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#935886: does not email properly, violating RFC821

Peter Palfrader
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@dictyotum:~# grep bacula-service /etc/bacula/ -r
| /etc/bacula/bacula-dir.conf:  mail on error = [hidden email] = all, !skipped
| /etc/bacula/bacula-dir.conf:  operator = [hidden email] = mount
| /etc/bacula/bacula-dir.conf:  mail = [hidden email] = all, !skipped

emails don't work:

| root@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) [hidden email]>


Cheers
--
                            |  .''`.       ** Debian **
      Peter Palfrader       | : :' :      The  universal
 https://www.palfrader.org/ | `. `'      Operating System
                            |   `-    https://www.debian.org/

Reply | Threaded
Open this post in threaded view
|

Bug#935886: does not email properly, violating RFC821

Antoine Beaupre-8
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@dictyotum:~# grep bacula-service /etc/bacula/ -r
> | /etc/bacula/bacula-dir.conf:  mail on error = [hidden email] = all, !skipped
> | /etc/bacula/bacula-dir.conf:  operator = [hidden email] = mount
> | /etc/bacula/bacula-dir.conf:  mail = [hidden email] = all, !skipped
>
> emails don't work:
>
> | root@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) [hidden email]>

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@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\) [hidden email]\" -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\) [hidden email]\" -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

Reply | Threaded
Open this post in threaded view
|

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

Sven Hartge-5
On 25.09.19 20:23, Antoine Beaupré wrote:

> The safest thing would be to remove all "(Bacula)" stuff from any mailcommand out there.

I agree with your analysis and will look into this in the next days.

Grüße,
Sven.


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Sven Hartge-5
In reply to this post by Antoine Beaupre-8
On 25.09.19 20:23, Antoine Beaupré wrote:

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

I can't find the code in bacula-common_9.4.2-1~bpo9+1

The code in the file you mentioned is correct:

  mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\"
-s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\)
\<%r\>\" -s \"Bacula: Intervention needed for %j\" %r"

 mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s
\"Bacula daemon message\" %r"

And looking at the git history for the source of that file show it was
corrected in 2007 via efbc08878 in version 2.2.0.

I guess the problem here is a very old configuration which has been kept
alive for the last 12 years.

Grüße,
Sven.


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Sven Hartge-5
On 25.09.19 21:02, Sven Hartge wrote:
> On 25.09.19 20:23, Antoine Beaupré wrote:

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

> I can't find the code in bacula-common_9.4.2-1~bpo9+1

To confirm this, I did a fresh install of
bacula-director/stretch-backports and the bacula-dir.conf is correct.

Unless Peter has more input about the origins of his bacula-dir.conf I
think this has not been a bug for the last 12 years.

Grüße,
Sven.


signature.asc (849 bytes) Download Attachment