[pmg-devel] [PATCH spamassassin 1/2] kam-rules: ship full ruleset not only KAM.cf
Stoiko Ivanov
s.ivanov at proxmox.com
Fri Mar 24 13:46:53 CET 2023
The KAM ruleset consists of more files than just KAM.cf - and with the
enabling of the HashBL module in SA 4.0.0 the KAM.cf depends on
settings in other files from the ruleset. This leads to warnings when
starting pmg-smtp-filter on a freshly installed system (more exactly
on a system where pmg-daily did not already download the complete KAM
ruleset to /var/lib)
This patch follows the logic we use in pmg-daily and ships the
complete ruleset in /usr/share/spamassassin-extra
KAM.cf itself was also moved to the kam.sa-channels.mcgrail.org
subdirectory so that we can use the downloaded cf file to get the
correct includes
Given that the default installations from PMG 6.4 on download and use
the complete ruleset the potential for regression should be quite
small.
I shortly considered adding a symlink from KAM.cf pointing to
kam_sa-channels_mcgrail_com/KAM.cf so that users with unadapted
templates still load at least KAM.cf - but since SpamAssassin simply
ignores non-existing files, and most setups, which have modified
templates probably ran pmg-daily at some point resulting in the files
from /var/lib/spamassassin being preferred I left that out.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Makefile | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index 65474a1..a0f6bb9 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,9 @@ DBG_DEB = proxmox-spamassassin-dbgsym_${DEB_VERSION_UPSTREAM_REVISION}_amd64.deb
DEBS = ${DEB} ${DBG_DEB}
DSC = proxmox-spamassassin_${DEB_VERSION_UPSTREAM_REVISION}.dsc
-EXTRA_RULES = KAM.cf
+KAM_CHANNEL_FILE = debian/tree/etc/mail/spamassassin/channel.d/KAM_channel.conf
+KAM_KEYID = $(shell awk -F '=' '/^KEYID/ { print $$2 }' ${KAM_CHANNEL_FILE})
+
SA_UPDATE_GPG_DIR = .sa-update-gpghome
@@ -53,12 +55,12 @@ ${NPKGNAME}.orig.tar.gz: upstream/
cp -a upstream ${NPKGNAME}
tar -czf $@ ${NPKGNAME}
-${NPKGNAME}: sa-updates ${EXTRA_RULES} ${NPKGNAME}.orig.tar.gz
+${NPKGNAME}: sa-updates kam-updates ${NPKGNAME}.orig.tar.gz
cp -a debian $@
mkdir -p $@/debian/tree/usr/share/spamassassin
rsync -av sa-updates/ $@/debian/tree/usr/share/spamassassin
mkdir -p $@/debian/tree/usr/share/spamassassin-extra
- cp -a ${EXTRA_RULES} $@/debian/tree/usr/share/spamassassin-extra
+ rsync -av kam-updates/ $@/debian/tree/usr/share/spamassassin-extra
${OPKGNAME}.tar.gz:
rm -f $@*
@@ -67,15 +69,12 @@ ${OPKGNAME}.tar.gz:
mv $@.asc.tmp $@.asc
gpgv --keyring ./sa-releasekey.gpg $@.asc $@
-KAM.cf:
- wget https://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf -O $@.tmp
- mv KAM.cf.tmp $@
-
${SA_UPDATE_GPG_DIR}/.prepared: ${OPKGNAME}.tar.gz
rm -rf ${SA_UPDATE_GPG_DIR}
mkdir --mode=0700 -p ${SA_UPDATE_GPG_DIR}
tar --strip-components 2 -xzf ${OPKGNAME}.tar.gz ${OPKGNAME}/rules/sa-update-pubkey.txt
sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --import sa-update-pubkey.txt
+ sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --import ${KAM_CHANNEL_FILE}
rm sa-update-pubkey.txt
touch $@
@@ -85,13 +84,20 @@ update-sa: ${SA_UPDATE_GPG_DIR}/.prepared
sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --updatedir updates.tmp --channel updates.spamassassin.org
rsync -av --delete --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt --exclude=MIRRORED.BY updates.tmp/updates_spamassassin_org/ sa-updates
+.PHONY: update-kam
+update-kam: ${SA_UPDATE_GPG_DIR}/.prepared
+ rm -rf kam-updates.tmp
+ sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --gpgkey ${KAM_KEYID} --updatedir kam-updates.tmp --channel kam.sa-channels.mcgrail.com
+ rm -rf kam-updates.tmp/kam_sa-channels_mcgrail_com/MIRRORED.BY
+ mv kam-updates.tmp kam-updates
+
.PHONY: upload
upload: ${DEBS}
tar cf - ${DEBS} | ssh -X repoman at repo.proxmox.com -- upload --product pmg --dist bullseye
.PHONY: clean distclean
clean:
- rm -rf *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp ${SA_UPDATE_GPG_DIR} ${OPKGNAME}.tar.gz.*
+ rm -rf *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp kam-updates.tmp ${SA_UPDATE_GPG_DIR} ${OPKGNAME}.tar.gz.*
distclean: clean
rm -rf ${OPKGNAME}.*
--
2.30.2
More information about the pmg-devel
mailing list