LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   BACULA: encrypt messages with gnupg and send them to bsmtp (https://www.linuxquestions.org/questions/linux-software-2/bacula-encrypt-messages-with-gnupg-and-send-them-to-bsmtp-657173/)

Red Pantyhose 07-21-2008 08:57 AM

BACULA: encrypt messages with gnupg and send them to bsmtp
 
Dear Readers

We like to pipe the bacula bsmtp-Messages through gpg because our backup-script run by the RunBeforeJob Option produces very sensitive information.

Is there a possibility to do this ?

# this works
echo 'streng geheim' | gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f test@myhost.ch -s "test" dummy@myhost.ch

# but inside bacula-dir.conf this fails :
mailcommand = "gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"

# and this one fails too
mailcommand = " | gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"

Thanks

Denis

trickykid 07-21-2008 10:39 AM

Quote:

# but inside bacula-dir.conf this fails :
mailcommand = "gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
This should work, it might be that the bacula user doesn't know where gpg is located, so putting full path might work. This is what the original looks like:

Code:

mailcommand = "/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
Try something like this:

Code:

mailcommand = "/usr/bin/gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: %t %e of %c %l\" %r"
The second one you posted wouldn't work cause well, why would you start off with a | (pipe) for the command?

Red Pantyhose 07-22-2008 02:00 AM

It doesn't work :

22-Jul 08:58 typhon-dir JobId 296: message.c:481 Mail prog: usage: gpg [options] --encrypt [filename]
22-Jul 08:58 typhon-dir JobId 296: Error: message.c:492 Mail program terminated in error.
CMD=/usr/bin/gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f "(Bacula) wgsupport@myhost.ch" -s "Bacula: Backup OK of amd64-fd Incremental" wgsupport@myhost.ch
ERR=Child exited with code 2

Any ideas ?

The gpg-key is allready imported ;.) ...

trickykid 07-22-2008 07:03 AM

What happens if you run:

Code:

/usr/bin/gpg --encrypt --always-trust -a -r wgsupport@myhost.ch - | /usr/sbin/bsmtp -h mail.myhost.ch -f "(Bacula) wgsupport@myhost.ch" -s "Bacula: Backup OK of amd64-fd Incremental" wgsupport@myhost.ch
Manually from the command?


All times are GMT -5. The time now is 11:05 AM.