]> git.proxmox.com Git - pmg-api.git/commit
api: spamassassin: update local channels
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 19 Jan 2021 10:38:14 +0000 (11:38 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 20 Jan 2021 10:28:49 +0000 (11:28 +0100)
commit98fd3ab0d5a35559660cd74f41e4875ebe39b5ea
treea99b6658d115adefad51b79f01709f504932c83e
parentd6b4011d61d38dd3ebf9d286c181ef2b4a623bd4
api: spamassassin: update local channels

This patch adds a helper to loop over all present Spamassassin
channels files in /etc/mail/spamassassin/channel.d and:
* import the included gpg key into sa-update's keyring
* run sa-update for each channel separately

the verbose argument of the helper is for reusing the code in
pmg-daily (where we only want to log errors and be less informative)

the $SA_UPDATE variable hardcoding the path of /usr/bin/sa-update was
dropped in favor of using 'sa-update' without path since we do have a
sensible setting of PATH everywhere, and hardcoding paths is
problematic (especially in usr-merged systems).

The choice of invoking sa-update for each channel separately, instead
of providing multiple '--channel' and '--gpgkey' options to a single
command was made to prevent downloading signatures, which were signed
by a key not configured for the channel.

Importing gpg-keys is also done with individual sa-update invocations,
because sa-update only imports the last present --import argument
(wrong use of Getopt::Long)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/SpamAssassin.pm
src/PMG/Utils.pm