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

2019-09-25 Thread Sven Hartge
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
Description: OpenPGP digital signature


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

2019-09-25 Thread Sven Hartge
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
Description: OpenPGP digital signature


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

2019-09-25 Thread Sven Hartge
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
Description: OpenPGP digital signature


Bug#935886: does not email properly, violating RFC821

2019-09-25 Thread Antoine Beaupré
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 = bacula-serv...@torproject.org 
> = all, !skipped
> | /etc/bacula/bacula-dir.conf:  operator = bacula-serv...@torproject.org = 
> mount
> | /etc/bacula/bacula-dir.conf:  mail = bacula-serv...@torproject.org = 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) 
> bacula-serv...@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@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\) bac...@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\) bac...@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"

Bug#935886: does not email properly, violating RFC821

2019-08-27 Thread 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 = bacula-serv...@torproject.org = 
all, !skipped
| /etc/bacula/bacula-dir.conf:  operator = bacula-serv...@torproject.org = mount
| /etc/bacula/bacula-dir.conf:  mail = bacula-serv...@torproject.org = 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) 
bacula-serv...@torproject.org>


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